Non-photorealistic Rendering.  a longtime goal of graphics research has been to render a scene that is indistinguishable from a photograph of the scene.

Slides:



Advertisements
Similar presentations
16.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 16 – Some Special Rendering Effects.
Advertisements

Procedural Textures. Noise in glman  glman automatically creates 2D and 3D textures (with default sizes 64x64 and 64x64x64) named  Noise2  Noise3 
Virtual Realism TEXTURE MAPPING. The Quest for Visual Realism.
1 Graphics CSCI 343, Fall 2013 Lecture 18 Lighting and Shading.
Non-Photorealistic Rendering: Toon Shading David Luebke University of Virginia.
Illumination and Shading
 Introduction  Illustration Techniques  Automatic Shading Model  Conclusion and Future work  Demo.
Computer Graphics (Fall 2005) COMS 4160, Lecture 16: Illumination and Shading 1
Lighting and Shading Wen-Chieh (Steve) Lin
(conventional Cartesian reference system)
GLSL I May 28, 2007 (Adapted from Ed Angel’s lecture slides)
GLSL I Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University of New Mexico.
Computer-Generated Pen-and-Ink Illustration Georges Winkenbach and David H. Salesin University of Washington SIGGRAPH 1994.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Shading Week 5, Wed 1 Oct 2003 recap: lighting shading.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Lighting and Shading Week.
Non-photorealistic Rendering Pablo Picasso - The Bird Cage No electrons were harmed during the production of this presentation.
Week 14 - Wednesday.  What did we talk about last time?  Collision handling  Collision detection  Collision determination  Collision response  BSPs.
SET09115 Intro Graphics Programming
Image Processing.  a typical image is simply a 2D array of color or gray values  i.e., a texture  image processing takes as input an image and outputs.
1 Texture. 2 Overview Introduction Painted textures Bump mapping Environment mapping Three-dimensional textures Functional textures Antialiasing textures.
Shading (introduction to rendering). Rendering  We know how to specify the geometry but how is the color calculated.
Geometry Shaders. Visualizing Normal Vectors  textbook calls this a “hedgehog plot” but (I think) that this is a misuse of the term  a hedgehog plot.
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) CS 426 Intro to 3D Computer Graphics © 2003, 2004, 2005 Jason Leigh Electronic.
COMPUTER GRAPHICS CS 482 – FALL 2014 AUGUST 27, 2014 FIXED-FUNCTION 3D GRAPHICS MESH SPECIFICATION LIGHTING SPECIFICATION REFLECTION SHADING HIERARCHICAL.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
A Non-Photorealistic Fragment Shader in OpenGL 2.0 Bert Freudenberg Institut für Simulation und Graphik University of Magdeburg, Germany.
A Non-Photorealistic Model for Automatic Technical Illustration Amy Gooch Bruce Gooch Peter Shirley Elaine Cohen SIGGRAPH 1998 Presented by Anteneh.
Computer Graphics An Introduction. What’s this course all about? 06/10/2015 Lecture 1 2 We will cover… Graphics programming and algorithms Graphics data.
Lecture by: Martin Deschamps CSE 4431
VIS Group, University of Stuttgart Tutorial T4: Programmable Graphics Hardware for Interactive Visualization Non-photorealistic rendering (Daniel Weiskopf)
Taku KomuraComputer Graphics Local Illumination and Shading Computer Graphics – Lecture 10 Taku Komura Institute for Perception, Action.
Advanced Computer Graphics Advanced Shaders CO2409 Computer Graphics Week 16.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology Basic Rendering Pipeline and Shading Spring 2012.
Paint By Numbers The goal of a visual artist (Hagen): Without modeling detail, painters use brush strokes to: –Represent objects –Direct attention The.
CSE 381 – Advanced Game Programming GLSL Lighting.
Non-Photorealistic Rendering Motivation: Much of the graphical imagery created is not photographic in nature Particularly in some domains: –Art –Animation.
Non-Photorealistic Rendering: Toon Shading David Luebke University of Virginia.
Realtime NPR Toon and Pencil Shading Joel Jorgensen May 4, 2010.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
Shading in OpenGL Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E.
CS 325 Introduction to Computer Graphics 03 / 29 / 2010 Instructor: Michael Eckmann.
RENDERING Introduction to Shading models – Flat and Smooth shading – Adding texture to faces – Adding shadows of objects – Building a camera in a program.
Global Illumination. Local Illumination  the GPU pipeline is designed for local illumination  only the surface data at the visible point is needed to.
RENDERING Introduction to Shading models – Flat and Smooth shading – Adding texture to faces – Adding shadows of objects – Building a camera in a program.
A Non-Photorealistic Lighting Model For Automatic Technical Illustration Presented by: Chris Lattner April 8, 2003 CS497yzy.
Lecture Fall 2001 Illumination and Shading in OpenGL Light Sources Empirical Illumination Shading Transforming Normals Tong-Yee Lee.
UV Mapping After a 3D object has been modeled it must be prepared for texturing. 3D surfaces can be “unwrapped” into a 2D representation with. This process.
Week 3 Lecture 4: Part 2: GLSL I Based on Interactive Computer Graphics (Angel) - Chapter 9.
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
Day 06 Vertex Shader for Ambient-Diffuse-Specular Lighting.
What are shaders? In the field of computer graphics, a shader is a computer program that runs on the graphics processing unit(GPU) and is used to do shading.
Advanced Art Review Elements of Design. Elements of Design: Lines Line- a continuous mark made on a surface by a moving point. Lines can be painted along.
Illumination Model How to compute color to represent a scene As in taking a photo in real life: – Camera – Lighting – Object Geometry Material Illumination.
CDS 301 Fall, 2008 From Graphics to Visualization Chap. 2 Sep. 3, 2009 Jie Zhang Copyright ©
Programming with OpenGL Part 3: Shaders Ed Angel Professor of Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive.
Lighting and Reflection Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
GLSL I.  Fixed vs. Programmable  HW fixed function pipeline ▪ Faster ▪ Limited  New programmable hardware ▪ Many effects become possible. ▪ Global.
Non-photorealistic rendering
Week 14 - Wednesday CS361.
Tips for Shading Your Terrain
Chapter 14 Shading Models.
GLSL I Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University of New Mexico.
CSC461: Lecture 23 Shading Computation
Day 05 Shader Basics.
Programming with OpenGL Part 3: Shaders
Chapter 14 Shading Models.
Computer Graphics Shading in OpenGL
Shading in OpenGL Ed Angel Professor Emeritus of Computer Science
CS 480/680 Fall 2011 Dr. Frederick C Harris, Jr. Computer Graphics
Presentation transcript:

Non-photorealistic Rendering

 a longtime goal of graphics research has been to render a scene that is indistinguishable from a photograph of the scene  non-photorealistic rendering, or stylized depiction, is inspired by artistic styles  painting  drawing  etching  technical illustration  cartoons

Hatching  attempts to render an object so that it looks hand drawn with strokes drawn with pen and ink  strokes lead to perception of shape and lighting  stroke width and placement are important

Hatching  vertex shader outputs per-vertex diffuse lighting  no ambient or specular component  intensity only  vertex shader outputs model coordinates of each vertex  model coordinates are used to access a noise texture  vertex shader outputs one component of the incoming texture coordinate  strokes are rendered along the other texture coordinate direction

Hatching  vertex shader outputs one component of the incoming texture coordinate  strokes are rendered along the other texture coordinate direction OpenGL Shading Language, 3 rd Edition

Hatching  fragment shader procedurally generates strokes  relies on generating a regular striped pattern float sawtooth = fract(V * 16.); float triangle = abs(2. * sawtooth – 1.); float square = step(0.5, triangle);

Hatching  want stripes of uniform width  how do we calculate how wide a stripe is at a given location on the surface?  look at how quickly the texture coordinate changes skinny here fat here float dp = length(vec2(dFdx(V), dFdy(V)));

Hatching  each time dp doubles, the number of strokes doubles  strokes become too thin and too densely placed  suppose that we want N strokes for some value of dp = G dpNumber of strokes GN 2G2GN / 2 4G4GN / 4 8G8GN / 8 float logdp = -log2(dp); float ilogdp = floor(logdp); float freq = exp2(ilogdp); float sawtooth = fract(V * freq * stripes);

Hatching OpenGL Shading Language, 3 rd Edition

Hatching  notice that suddenly reducing the number of strokes leads to strong visual artifacts OpenGL Shading Language, 3 rd Edition

Hatching  the trick is to use the fraction part of logdp to do a smooth blend of the two frequencies float transition = logdp – ilogdp; triangle = abs((1. + transition) * triangle – transition); OpenGL Shading Language, 3 rd Edition

Hatching  width of stripes is used to simulate lighting effects  dark stripes should be wider where light intensity is low and narrower where light intensity is high float sawtooth = fract(V * 16.); float triangle = abs(2. * sawtooth – 1.); float square = step(0.5, triangle); this value affects the width of the stripe OpenGL Shading Language, 3 rd Edition

Hatching  use the computed light intensity to modulate the stripe width float edge0 = clamp(LightIntensity - edgew, 0., 1.); float edge1 = clamp(LightIntensity, 0., 1.); float square = 1. - smoothstep(edge0, edge1, triangle); OpenGL Shading Language, 3 rd Edition

Hatching  finally, adding noise to the stripe generating function will create a “hand drawn” effect float noise = texture(Noise3, ObjPos).r; float sawtooth = fract((V + noise * 0.0) * frequency * stripes); OpenGL Shading Language, 3 rd Edition

Hatching

Technical Illustration Shading  illustrations in technical books (manuals, textbooks, CAD drawings) are typically stylized illustrations that tend to emphasize important details and de-emphasize other details (e.g., no shadows, no reflections, etc.)

Technical Illustration Shading  Gooch, Gooch, Shirley, Cohen proposed a list of common characteristics for airbrush and pen drawings  surface boundaries, silhouette edges, and surface discontinuities are drawn with black curves  single light source, white highlights, positioned above the object  effects that add realism (shadows, reflections, multiple light sources) are omitted  matte objects are shaded with intensities far from white or black so as to be distinct from edges and highlights  warmth or coolness of color indicates curvature of surface

Gooch Shading  “low dynamic range artistic tone algorithm” 1. requires edge information 2. specular highlights computed using Phong model and shaded white 3. limited range of luminance used to indicate curvature  diffuse term only  add a warm-to-cool color gradient to convey more information about surface curvature  warm colors tend to advance towards the viewer and cool colors tend to recede from the viewer

Gooch Shading A Non-Photorealistic Lighting Model For Automatic Technical Illustration

Gooch Shading A Non-Photorealistic Lighting Model For Automatic Technical Illustration

Gooch Shading A Non-Photorealistic Lighting Model For Automatic Technical Illustration

Gooch Shading A Non-Photorealistic Lighting Model For Automatic Technical Illustration

Gooch Shading A Non-Photorealistic Lighting Model For Automatic Technical Illustration

Gooch Shading A Non-Photorealistic Lighting Model For Automatic Technical Illustration

Gooch Shading  edge information can be obtained in several ways  edge detection  silhouette only  best way is to identify important edges in modelling process

Gooch Shading  warm and cool colors  pick a cool color for surfaces angled away from the light source  pick a warm color for surfaces facing the light source  add in the diffuse illumination and mix based on the value of

Gooch Shading  vertex shader  performs the usual transformation of vertices and normals  computes at each vertex (for the fragment shader)  computes the view and reflection vectors at each vertex (for the fragment shader)

Gooch Shading #version 330 compatibility in vec4 aVertex; in vec4 aNormal; uniform mat4 uModelViewProjectionMatrix; uniform mat4 uModelViewMatrix; uniform mat4 uNormalMatrix; out float vNdotL; out vec3 vReflectDir; out vec3 vViewDir; // light position in eye coordinates const vec3 myLightPosition = vec3(5., 5, 1.);

Gooch Shading void main(void) { vec3 ecPos = vec3(uModelViewMatrix * aVertex); vec3 norm = normalize(vec3(uNormalMatrix * aNormal)); vec3 lightDir = normalize(myLightPosition - ecPos); vReflectDir = normalize(reflect(-lightDir, norm)); vViewDir = normalize(-ecPos); vNdotL = dot(lightDir, norm) * ; gl_Position = uModelViewProjectionMatrix * aVertex; }

Gooch Shading  geometry shader computes silhouette edges and passes per-vertex information from vertex shader to fragment shader  geometry shader needs adjacency information  fragment shader computes Phong specular term and blends the warm and cool colors

Gooch Shading #version 330 compatibility uniform vec4 uSurfaceColor; uniform vec4 uWarmColor; uniform vec4 uCoolColor; uniform float uDiffuseWarm; uniform float uDiffuseCool; in float gNdotL; in vec3 gReflectDir; in vec3 gViewDir; flat in int gIsEdge; out vec4 fFragColor;

Gooch Shading void main() { if (gIsEdge == 0) { vec3 kcool = min(uCoolColor.rgb + uDiffuseCool * uSurfaceColor.rgb, 1.); vec3 kwarm = min(uWarmColor.rgb + uDiffuseWarm * uSurfaceColor.rgb, 1.); vec3 kfinal = mix(kcool, kwarm, gNdotL); vec3 nreflect = normalize(gReflectDir); vec3 nview = normalize(gViewDir); float spec = max(dot(nreflect, nview), 0.); spec = pow(spec, 32.); fFragColor = vec4(min(kfinal + spec, 1.), 1.); } else { fFragColor = vec4(0., 0., 0., 1.); }

Gooch Shading

A Non-Photorealistic Lighting Model For Automatic Technical Illustration