Non-photorealistic rendering Marko Täht Topics
• Rendering • Photorealism • Non-photorealistic rendering Rendering
• Rendering is the process of generating an image from a 2D or 3D model by means of computer programs. • Multiple models are collectively called a scene file. • Scene file contains: geometry, viewpoint, texture, lighting and shading. • Data in scene files is passed to rendering program to be processed and output as digital image or raster graphics. • Rendering image from scene file is called graphics pipeline along rendering device. Graphics pipeline • Graphics pipeline or rendering pipeline refers to sequence of steps in order to make 2D raster representation of a 3D scene.
https://en.wikipedia.org/wiki/Graphics_pipeline#Stages_of_the_graphics_pipeline
Photorealism
• Photorealism is a genre of art that encompasses painting, drawing and other graphic media, in which an artist studies a photograph and then attempts to reproduce the image as realistically as possible in another medium. • https://www.youtube.com/watch?v=NxXwfT3LeyE Clay-render
Final picture Face made in blender
“If photorealism is the holy grail of CG, then a photorealistic face must be the holy, HOLY grail.”
http://www.blenderguru.com/articles/24- photorealistic-blender-renders/ Non-photorealistic rendering
• Non-photorealistic rendering (NPR) is an area of computer graphics that focuses on enabling a wide variety of expressive styles for digital art. • It is inspired by artistic styles. • In movies and video games NPR has appeared in form of “Toon shading”. Modern use of this is cel-shaded animation. Paint brush Technical drawings
• Photorealistic images not reasonable • Give better overview • Exploded view
Exploded view Leonardo da Vinci Reciprocating motion machine Wireframe • Only edges are drawn • Used in making models • Visualizes the structure of object • Simple and fast to calculate • Often used when high- framerate is needed
Pen and ink
• Strokes - wavy lines of varying thickness • Texture - collection of strokes • Tone - lines of equal weight and spacing • Outlines – Boundary line of the structure to separate it from background
http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.116.7335&rep=rep1&type=pdf
Watercolor
• Suspension of pigment particles in water, binder and surfactant • Each stroke needs fluid simulation • Paper affects fluid flow
http://grail.cs.washington.edu/projects/watercolor/paper_tiny.pdf http://grail.cs.washington.edu/projects/watercolor/paper_tiny.pdf Toon shading
• Also known as cel-shading • Designed to make models look flat by using less shading color
Sobel filter
• Creates image emphasizing on edges. • It is a discrete differentiation operator, computing an approximation of the gradient of the image intensity function. • Operator is based on convolving the image with a small, separable, and integer-valued filter in the horizontal and vertical directions and is therefore relatively inexpensive in terms of computations.
https://en.wikipedia.org/wiki/Sobel_operator
Why not in real life Games that use cel-shader
• https://www.youtube.com/watch?v=tWVLDq661H Q Borderlands Antichamber The Simpsons Game Creating cel-shader
• Vertex shader:
uniform vec3 lightDir; //Defined in world space varying float intensity; void main() { intensity = dot(lightDir, gl_Normal); gl_Position = ftransform(); } • Fragment shader:
Sets the fragment color based on intensity varying float intensity;
void main() { vec4 color; if (intensity > 0.95) color = vec4(1.0, 0.5, 0.5, 1.0); else if (intensity > 0.5) color = vec4(0.6, 0.3, 0.3, 1.0); else if (intensity > 0.25) color = vec4(0.4, 0.2, 0.2, 1.0); else color = vec4(0.2, 0.1, 0.1, 1.0); gl_FragColor = color; } Result