Realtime NPR Toon and Pencil Shading Joel Jorgensen May 4, 2010.

Slides:



Advertisements
Similar presentations
POST-PROCESSING SET09115 Intro Graphics Programming.
Advertisements

Saito, T. and Takahashi, T. Comprehensible Rendering of 3-D Shapes Proc. of SIGGRAPH '90 Genesis of Image Space NPR.
CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
Ray tracing. New Concepts The recursive ray tracing algorithm Generating eye rays Non Real-time rendering.
CS 4363/6353 BASIC RENDERING. THE GRAPHICS PIPELINE OVERVIEW Vertex Processing Coordinate transformations Compute color for each vertex Clipping and Primitive.
Form is an Element of Art. Question: If SHAPES are 2-dimensional, what are FORMS??
Sorce: Suggestive Contours for Conveying Shape. (SIGGRAPH 2003) Doug DeCarlo, Adam Finkelstein, Szymon Rusinkiewicz, Anthony Santella. 1 Suggestive Contours.
Texture Mapping. Texturing  process that modifies the appearance of each point on a surface using an image or function  any aspect of appearance can.
Week 7 - Monday.  What did we talk about last time?  Specular shading  Aliasing and antialiasing.
Week 10 - Monday.  What did we talk about last time?  Global illumination  Shadows  Projection shadows  Soft shadows.
3D Graphics Rendering and Terrain Modeling
Computer Graphics Visible Surface Determination. Goal of Visible Surface Determination To draw only the surfaces (triangles) that are visible, given a.
Non-Photorealistic Rendering: Toon Shading David Luebke University of Virginia.
SE 313 – Computer Graphics Lecture 13: Lighting and Materials Practice Lecturer: Gazihan Alankuş 1.
Non-Photo Realistic Rendering Jian Huang CS594 Fall 2003 This set of slides are modified from the NPR Course during SIGGRAPH’2003.
How to Draw What You See!.
Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova.
Chapter 6: Vertices to Fragments Part 2 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
(conventional Cartesian reference system)
CIS 310: Visual Programming, Spring 2006 Western State College 310: Visual Programming Ray Tracing.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Shading Week 5, Wed 1 Oct 2003 recap: lighting shading.
Week 14 - Wednesday.  What did we talk about last time?  Collision handling  Collision detection  Collision determination  Collision response  BSPs.
Introduction to 3D Graphics John E. Laird. Basic Issues u Given a internal model of a 3D world, with textures and light sources how do you project it.
Post-rendering Cel Shading & Bloom Effect
09/18/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Bump Mapping Multi-pass algorithms.
9/20/2001CS 638, Fall 2001 Today Finishing Up Reflections More Multi-Pass Algorithms Shadows.
SET09115 Intro Graphics Programming
Shadows Computer Graphics. Shadows Shadows Extended light sources produce penumbras In real-time, we only use point light sources –Extended light sources.
1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 19 Other Graphics Considerations Review.
1 Computer Graphics Week13 –Shading Models. Shading Models Flat Shading Model: In this technique, each surface is assumed to have one normal vector (usually.
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) CS 426 Intro to 3D Computer Graphics © 2003, 2004, 2005 Jason Leigh Electronic.
Modelling and Simulation Types of Texture Mapping.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
Computer Graphics World, View and Projection Matrices CO2409 Computer Graphics Week 8.
Shading & Texture. Shading Flat Shading The process of assigning colors to pixels. Smooth Shading Gouraud ShadingPhong Shading Shading.
BASIC DRAWING SKILLS 6 th Grade Art & Introduction to Art Ms. McDaniel.
Advanced Computer Graphics Depth & Stencil Buffers / Rendering to Textures CO2409 Computer Graphics Week 19.
CS 638, Fall 2001 Multi-Pass Rendering The pipeline takes one triangle at a time, so only local information, and pre-computed maps, are available Multi-Pass.
Week 6 - Wednesday.  What did we talk about last time?  Light  Material  Sensors.
Advanced Computer Graphics Advanced Shaders CO2409 Computer Graphics Week 16.
CSE 381 – Advanced Game Programming GLSL Lighting.
Shader Study 이동현. Vision engine   Games Helldorado The Show Warlord.
1 Perception and VR MONT 104S, Fall 2008 Lecture 21 More Graphics for VR.
1 Artificial Intelligence: Vision Stages of analysis Low level vision Surfaces and distance Object Matching.
Non-Photorealistic Rendering: Toon Shading David Luebke University of Virginia.
Design Studies 20 ‘Show Off’ Project How to make a computer monitor In Google Sketchup By: Liam Jack.
09/16/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Environment mapping Light mapping Project Goals for Stage 1.
CS 325 Introduction to Computer Graphics 03 / 29 / 2010 Instructor: Michael Eckmann.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
RENDERING Introduction to Shading models – Flat and Smooth shading – Adding texture to faces – Adding shadows of objects – Building a camera in a program.
Cel shading By jared brock.
Higher Dimensions. x Let's say we use a pencil to mark a point on paper. x is this point. We pick a direction and move the pencil along this direction.
11/5/2002 (c) University of Wisconsin, CS 559 Last Time Local Shading –Diffuse term –Specular term –All together –OpenGL brief overview.
Local Illumination and Shading
Real Time Nonphotorealistic Rendering. How to achieve real time NPR? Economy of line: present a lot of information with very few strokes. Silhouettes.
CS 445 / 645: Introductory Computer Graphics Review.
Shadows David Luebke University of Virginia. Shadows An important visual cue, traditionally hard to do in real-time rendering Outline: –Notation –Planar.
Introduction to Computer Graphics
Compositing and Rendering
Shaders, part 2 alexandri zavodny.
Computer Graphics Imaging
Week 14 - Wednesday CS361.
Week 7 - Monday CS361.
3D Graphics Rendering PPT By Ricardo Veguilla.
How to Draw What You See!.
© University of Wisconsin, CS559 Fall 2004
Projection in 3-D Glenn G. Chappell
Computer Animation Texture Mapping.
UMBC Graphics for Games
Computer Graphics Material Colours and Lighting
Presentation transcript:

Realtime NPR Toon and Pencil Shading Joel Jorgensen May 4, 2010

Toon Shading Fairly easy to go from Phong shading to Toon shading coloring Just quantize the color based on some thresholds of the light intensity

Outlines Silhouette edges are tricky Image volume-based method, 2 passes First, render normals (compressed into RGB values) and depth (as alpha) into texture

Outlines (cont) Then render scene normally, and at the end overlay with rectangle that takes up full screen and is textured with the normal/depth texture from first pass Use special shader when drawing rectangle to detect discontinuities between normals and depths (Also use pencil texture instead of black when switching to pencil outline)

Pencil Texture 3D texture, increasing in darkness along depth Draw a bunch of slightly curved (with cos) lines by subtracting small, slightly varying amounts from each pixel in the line The more overlapping lines, the darker it gets Randomly scatter starting points around image to get decent coverage Each image is copy of image above it with more lines drawn on, gives continuity as light shifts Also wrap around horizontally and vertically so adjacent textures are continuous

Direction of Curvature Pencil lines follow direction of min curvature Our brains are good at using them as shape cues Mathematically challenging to calculate well; beyond my abilities Simple approximation: test neighboring points’ distance from tangent plane – Farthest point from tangent plane lies in direction of max curvature – Closest point to tangent plane lies in direction of min curvature Project onto tangent plane to get curvature at that vertex

Layering/Blending Humans aren’t perfect – Lines aren’t all parallel – Overlap a bit to create more visual interest Model is too “perfect” – An approximation with flat faces, but it makes those faces really flat – If we just put one texture on each face, it would be obviously faceted Blend multiple lines in different directions to hide the faceted nature of the model

Blending/Layering (cont) For each face, draw texture 3 times, rotated in each of the directions of minimum curvature of its corresponding vertices Pass directions of min curvature to vertex shader along with texture coordinates For each of the three directions of curvature – Project direction of min curvature onto screen – Determine angle of rotation – Rotate texture coordinates by that amount – Pass rotated texture coordinates to fragment shader

Fragment Shader Calculates intensity as in Phong model, dot product of light vector and surface normal Looks up 3 texture values – Uses the rotated texture coordinates from vertex shader for s, t – Uses intensity as depth coordinate Blends them together and uses that as the color for the fragment

Billboarding Will o’ the Wisp – Wandering spirit – Light source – Particle system (sparkles) Sparkles are textured squares Rotated to face the camera each frame Uses a method similar to the camera’s lookAt method (with some tweaks because they’re not the camera, so some things are kind of backwards)

But wait, there’s more!

Colored Pencils! Blend the texture with the color of the material Tricky, since just adding makes things lighter, and just multiplying would result in a totally colored object where it should have been white (since the “empty” pencil texture layer is pure white) Have to subtract both the pencil texture and the diffuse material color from 1, then multiply the result, then subtract that result from 1 again to get back to the right colors – Actually subtracted from the sepia tone to give it a more “papery” look, but same idea

Difficulties Math is hard! – Tried to wrap my head around some of the techniques for approximating the principal directions of curvature for several hours. – Determined that the amount of time I would need to actually get something like that working would far exceed the amount available for the project. – Switched to crude approximation

Problems Sliding/swimming textures – Unable to figure out why this is happening. Probably something to do with the projection and rotation code, but I haven’t been able to determine what exactly is causing it – Might be able to precompute these instead of trying to do them on the fly

Problems (cont) Triangles very obvious in areas where they’re close together and narrow (e.g. bottoms of the bowls) – Probably caused by the texture being scaled down in the mipmaps and pressed together so they kind of blur into a uniform grey color – Might be able to fix it by explicitly generating mipmaps that try to scale things more cleverly, similar to the TAMs described in the book, rather than using hardware mipmap generation

Problems (cont) Sparkles from the Will o’ the Wisp slide behind the outline because it’s decaled on top of the whole scene – Could fix by rendering the Will o’ the Wisp the very last

Problems (cont) Sparkles sometimes chop bits out of each other (transparent background of sparkles that are in front of other sparkles but rendered before those sparkles will be grey even if there’s another sparkle behind it) – Could be fixed by doing depth sort and then rendering from back to front – Not very obvious, though, so probably not worth the effort at this point; would be a bigger deal if the sparkles were larger