Rendering hair with graphics hardware Tae-Yong Kim Rhythm & Hues Studios

Slides:



Advertisements
Similar presentations
Bath, 25 Years of CG Hair Modelling, Animation, and Rendering Wen Tang School of Computing, University of Teesside
Advertisements

Exploration of advanced lighting and shading techniques
COMPUTER GRAPHICS SOFTWARE.
Compositing and Blending Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive Computer Graphics.
Technische Universität München Computer Graphics SS 2014 Graphics Effects Rüdiger Westermann Lehrstuhl für Computer Graphik und Visualisierung.
CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
Graphics Pipeline.
RealityEngine Graphics Kurt Akeley Silicon Graphics Computer Systems.
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
Real-Time Rendering TEXTURING Lecture 02 Marina Gavrilova.
Compositing and Blending Mohan Sridharan Based on slides created by Edward Angel 1 CS4395: Computer Graphics.
Image Compositing Angel 8.11 Angel: Interactive Computer Graphics5E © Addison-Wesley
Rasterization and Ray Tracing in Real-Time Applications (Games) Andrew Graff.
A Survey of Real-time Soft Shadows Algorithms Speaker: Alvin Date: 2003/7/23 EUROGRAPHICS 2003 J.-M. Hasenfratz, M. Lapierre, N. Holzschuch and F.X. Sillion.
CGDD 4003 THE MASSIVE FIELD OF COMPUTER GRAPHICS.
Fur and hair are not typically uniform in color but instead are many slightly different shades. We wanted to simulate this using a single texture map.
18.1 Si31_2001 SI31 Advanced Computer Graphics AGR Lecture 18 Image-based Rendering Light Maps What We Did Not Cover Learning More...
Skin Rendering GPU Graphics Gary J. Katz University of Pennsylvania CIS 665 Adapted from David Gosselin’s Power Point and article, Real-time skin rendering,
IN4151 Introduction 3D graphics 1 Introduction to 3D computer graphics part 2 Viewing pipeline Multi-processor implementation GPU architecture GPU algorithms.
Real-Time High Quality Rendering COMS 6160 [Fall 2004], Lecture 3 Overview of Course Content
GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology Beyond Meshes Spring 2012.
Computer Graphics Shadows
Hidden Surface Removal
Computer Graphics Mirror and Shadows
Ansh Bahri Sandeep Thippeswamy Sohil Himanish Anuja Chandorkar
Ray Tracing Primer Ref: SIGGRAPH HyperGraphHyperGraph.
1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 19 Other Graphics Considerations Review.
CS 638, Fall 2001 Today Light Mapping (Continued) Bump Mapping with Multi-Texturing Multi-Pass Rendering.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
Programmable Pipelines. Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
Interactive Hair Rendering Under Environment Lighting Valentin JANIAUT Zhong Ren, Kun Zhou, Tengfei Li, Wei Hua, Baining Guo.
Lecture 3 : Direct Volume Rendering Bong-Soo Sohn School of Computer Science and Engineering Chung-Ang University Acknowledgement : Han-Wei Shen Lecture.
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.
Interactive Time-Dependent Tone Mapping Using Programmable Graphics Hardware Nolan GoodnightGreg HumphreysCliff WoolleyRui Wang University of Virginia.
09/09/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Event management Lag Group assignment has happened, like it or not.
C O M P U T E R G R A P H I C S Guoying Zhao 1 / 14 C O M P U T E R G R A P H I C S Guoying Zhao 1 / 14 Going-through.
CS 450: COMPUTER GRAPHICS REVIEW: INTRODUCTION TO COMPUTER GRAPHICS – PART 2 SPRING 2015 DR. MICHAEL J. REALE.
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.
1 Introduction to Computer Graphics SEN Introduction to OpenGL Graphics Applications.
Stream Processing Main References: “Comparing Reyes and OpenGL on a Stream Architecture”, 2002 “Polygon Rendering on a Stream Architecture”, 2000 Department.
Tone Mapping on GPUs Cliff Woolley University of Virginia Slides courtesy Nolan Goodnight.
Computer Graphics 2 Lecture 7: Texture Mapping Benjamin Mora 1 University of Wales Swansea Pr. Min Chen Dr. Benjamin Mora.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Rendering Fake Soft Shadows with Smoothies Eric Chan Massachusetts Institute of Technology.
09/16/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Environment mapping Light mapping Project Goals for Stage 1.
- Laboratoire d'InfoRmatique en Image et Systèmes d'information
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
Computing & Information Sciences Kansas State University Lecture 12 of 42CIS 636/736: (Introduction to) Computer Graphics CIS 636/736 Computer Graphics.
Real-Time Relief Mapping on Arbitrary Polygonal Surfaces Fabio Policarpo Manuel M. Oliveira Joao L. D. Comba.
Shadows David Luebke University of Virginia. Shadows An important visual cue, traditionally hard to do in real-time rendering Outline: –Notation –Planar.
1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.
Non-Photorealistic Rendering FORMS. Model dependent Threshold dependent View dependent Outline form of the object Interior form of the object Boundary.
09/23/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Reflections Shadows Part 1 Stage 1 is in.
Compositing and Blending Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Real-Time Relief Mapping on Arbitrary Polygonal Surfaces Fabio Policarpo Manuel M. Oliveira Joao L. D. Comba.
Introduction Hair Geometry Hair Shading Introduction 4,095 individual hairs 123,000 vertices (just for the hair rendering)
Computer Graphics I, Fall 2008 Compositing and Blending.
Hair Modelling, Animation, and Rendering
Ying Zhu Georgia State University
Chapter 10 Computer Graphics
Graphics Processing Unit
3D Graphics Rendering PPT By Ricardo Veguilla.
The Graphics Rendering Pipeline
Real-time Rendering Shadow Maps
RADEON™ 9700 Architecture and 3D Performance
Introduction to Computer Graphics
Presentation transcript:

Rendering hair with graphics hardware Tae-Yong Kim Rhythm & Hues Studios

Overview State of the Art in Hair Rendering and Modeling Issues in Hardware Hair Rendering Line drawing with Graphics Hardware Illumination and Hardware Shader Shadows

Hair representation Hair is not a single entity – always consider hair volume a a whole Surface (polygons, nurbs, etc.) Line (guide hair, curve, polyline..) Volumetric representation (implicit surface, 3D texture, tubes, …)

Representation - Polygons ATI Polygonal Model ( from SIGGRAPH Sketch by Thorsten Scheuermann) Real-time rendering Suited for existing artists asset Limited hairstyle Animation difficult

Representation - Lines nVidia – Line representation (from Matthias Wloka’s Eurographics 2004 tutorial) Dynamic hair No restriction in hairstyle Advanced rendering possible No standard modeling technique Can be time consuming to render

Model Generation Use control tools to generate bunch of hairs Control curves (guide hairs) Cylinders – single level/multi level Fluid flow, 3D vector field Automated methods emerging

Guide hair Small number of guide hairs control hair shape Interpolation generates whole instances of hairs to render Properties like density, length can be controlled with maps

Other guide objects (fluid) Create vector fields (e.g. with fluid dynamics) hairs through 3D vector filed Each hair is instanced through fluid control Hadap and Nadia M. Thalmann Eurographics 2001

Other guide objects (cylinders) Cylinders to shape hair Instance hairs inside each tube Multi-layered control of cylinders Kim and Neumann SIGGRAPH 2002

Emerging techniques Hair modeling from photographs Directly recover hair geometry from images S. Paris, H. Briceno, F. Sillion SIGGRAPH 2004

Hair as line drawing k hair per human scalp >100 lines per each hair > millions of lines (micro polygons) typical in production hair render Use of graphics hardware

Hair segment as a GL line DrawHairLine(p s, p e, c s, c e ) { glBegin(GL_LINES) glColor3fv(c s ); glVertex3fv(p s ); glColor3fv(c e ); glVertex3fv(p e ); glEnd() }

Hair as GL lines DrawHair(p 0,p 1,..,p n-1,c 0,c 1,….c n-1 ) { glBegin(GL_LINE_STRIP) glColor3fv(c 0 ); glVertex3fv(p 0 ); glColor3fv(c 1 ); glVertex3fv(p 1 ); … glColor3fv(c n-1 ); glVertex(p n-1 ); glEnd() }

Are we done? DrawHair(p 0,p 1,..,p n-1,c 0,c 1,….c n-1 ) { glBegin(GL_LINE_STRIP) glColor3fv(c 0 ); glVertex3fv(p 0 ); glColor3fv(c 1 ); glVertex3fv(p 1 ); … glColor3fv(c n-1 ); glVertex(p n-1 ); glEnd() } Algorithm1 For each hair, call this function!

Not quite..

Point samples Computed sample color True sample The aliasing problem

Compare this..

Remedies  Increase sampling rate ( large image size, accumulation buffer)  Image quality depends on number of samples at a slow convergence rate  Required sampling rate is above 10,000 x 10,000 pixel resolution  Thinner (smaller) hairs require even higher sampling rate

Remedies  Hardware antialiasing of line drawing  GL_LINE_SMOOTH  Thickness control with alpha blending

 = Thickness control with alpha blending

Correct Visibility order is important correct wrong

Hair as visibility ordered lines Algorithm 2 1. Compute color for each end point of the lines (shading, shadowing) 2. Compute the visibility order 3. Draw lines sorted by the visibility order

r o k a d b c e g f v s u p t q m h i j l n k,l,m d,e c f,g,h i,j n,o,p,q r,s,t u,v b a A simple visibility ordering scheme Drawing order: a, b, c, d, e, f, g, h, I, j, k, l, m, n, o, p, q, r, s, t, u, v

A simple visibility ordering scheme  Efficient (700K lines per second on 700Mhz CPU)  Approximate, but works well for small line fragments

CorrectCached Coherence of visibility ordering  Visibility ordering can be cached and reused (useful for interactive application)

Hair shading model  Describes the amount of reflected/scattered light toward the viewing direction  Kajiya-Kay (1989)  Marschner et al. (2003)

L V T Kajiya-Kay model

L V T H

Example cg program

Real-time hair shading Hair as set of unstructured lines Sort visibility of hair lines line render with vertex shader

Shadow2Color2Tangent2Pos2 Shadow1Color1Tangent1Pos1 Data structure  Position: comes from modeling, animation  Tangent : computed from position  (Unshadowed) Color: shaded with either CPU/ or Vertex Shader  Shadow: computed with opacity shadow maps  Sort each line with visibility order

.. ShadowNColorN Tangent N PosNN.. Shadow4Color4Tangent4Pos44 Shadow3Color3Tangent3Pos33 Shadow2Color2Tangent2Pos22 1 Index Shadow1Color1Tangent1Pos1 ShadowColorTangentPos Vertex table N V1 NM V2Index Line table Data structure

 A shading model describes the amount of reflected light when hair is fully lit  Most hair receives attenuated light due to self-shadowing  Crucial for depicting volumetric structure for hair Self-shadows

No shadows With shadows Self-shadows

Front lighting Back lighting Self-shadows

 Shadow is a fractional visibility function  How many hairs between me and the light?  What percentage of light is blocked? Self-shadows

 Shadow is a fractional visibility function Self-shadows

Opacity shadow maps [Kim and Neumann EGRW 2001] Fast approximation of the deep shadowing function Idea: use graphics hardware as much as possible

Ω(l) l Transmittance Opacity Monotonically increasing Self-shadows

Opacity Shadow Maps

Opacity Shadow Maps - Algorithm for (1  i  N) Determine the opacity map’s depth D i from the light for each shadow sample point p j in P (1  j  M) Find i such that D i-1  Depth(p j ) < D i Add the point p j to P i. Clear the alpha buffer and the opacity maps B prev, B current. for (1  i  N) Swap B prev and B current. Render the scene clipping it with D i-1 and D i. Read back the alpha buffer to B current. for each shadow sample point p k in P i Ω prev = sample(B prev, p k ) Ω current = sample(B current, p k ) Ω = interpolate (Depth(p k ), D i-1, D i, Ω prev, Ω current ) τ(p k ) = e -κΩ Φ(p k ) = τ(p k )

Uniform slicing1D BSPNonlinear spacing How many opacity maps?

Opacity Shadow Maps - Algorithm for (1  i  N) Determine the opacity map’s depth D i from the light for each shadow sample point p j in P (1  j  M) Find i such that D i-1  Depth(p j ) < D i Add the point p j to P i. Clear the alpha buffer and the opacity maps B prev, B current. for (1  i  N) Swap B prev and B current. Render the scene clipping it with D i-1 and D i. Read back the alpha buffer to B current. for each shadow sample point p k in P i Ω prev = sample(B prev, p k ) Ω current = sample(B current, p k ) Ω = interpolate (Depth(p k ), D i-1, D i, Ω prev, Ω current ) τ(p k ) = e -κΩ Φ(p k ) = τ(p k )

 Storing all the opacity maps incur high memory usage  Sort shadow computation points based on the map’s depth P0P0 PiPi P N- 1  As soon as the current map is rendered, compute shadows for corresponding sample points. Preparing Shadow Samples

Opacity Shadow Maps - Algorithm for (1  i  N) Determine the opacity map’s depth D i from the light for each shadow sample point p j in P (1  j  M) Find i such that D i-1  Depth(p j ) < D i Add the point p j to P i. Clear the alpha buffer and the opacity maps B prev, B current. for (1  i  N) Swap B prev and B current. Render the scene clipping it with D i-1 and D i. Read back the alpha buffer to B current. for each shadow sample point p k in P i Ω prev = sample(B prev, p k ) Ω current = sample(B current, p k ) Ω = interpolate (Depth(p k ), D i-1, D i, Ω prev, Ω current ) τ(p k ) = e -κΩ Φ(p k ) = τ(p k )

 The alpha buffer is accumulated each time the scene is drawn.  The scene is clipped with D i and D i-1  Speedup factor of 1.5 to 2.0  In very complex scenes, preorder the scene geometry so that the scene object is rendered only for a small number of maps.  More speedup and reduce memory requirement for scene graph Clipping and Culling

Opacity Shadow Maps - Algorithm for (1  i  N) Determine the opacity map’s depth D i from the light for each shadow sample point p j in P (1  j  M) Find i such that D i-1  Depth(p j ) < D i Add the point p j to P i. Clear the alpha buffer and the opacity maps B prev, B current. for (1  i  N) Swap B prev and B current. Render the scene clipping it with D i-1 and D i. Read back the alpha buffer to B current. for each shadow sample point p k in P i Ω prev = sample(B prev, p k ) Ω current = sample(B current, p k ) Ω = interpolate (Depth(p k ), D i-1, D i, Ω prev, Ω current ) τ(p k ) = e -κΩ Φ(p k ) = τ(p k )

Opacity Shadow Maps

Opacity Shadow Maps - Algorithm for (1  i  N) Determine the opacity map’s depth D i from the light for each shadow sample point p j in P (1  j  M) Find i such that D i-1  Depth(p j ) < D i Add the point p j to P i. Clear the alpha buffer and the opacity maps B prev, B current. for (1  i  N) Swap B prev and B current. Render the scene clipping it with D i-1 and D i. Read back the alpha buffer to B current. for each shadow sample point p k in P i Ω prev = sample(B prev, p k ) Ω current = sample(B current, p k ) Ω = interpolate (Depth(p k ), D i-1, D i, Ω prev, Ω current ) τ(p k ) = e -κΩ Φ(p k ) = τ(p k )

1.0 Quantization in alpha buffer limits Ω to be 1.0 at maximum κ scales the exponential function s. t. Ω value of 1.0 represents a complete opaqueness (τ = 0) κ = 5.56 for 8 bit alpha buffer (e -κ = 2 -8 ) Exponential Attenuation

N = 7(5secs) N = 15(7secs) N = 30(10secs) N = 60(16secs) N = 100(25secs) N = 200(46secs) N = 500(109secs) No shadow Opacity Shadow Maps

Hair rendering with lines in graphics hardware  Setup pass:  Compute the visibility order  Compute shadow values  Drawing pass:  For each line segment L i ordered due to the visibility order  Set thickness (alpha value)  Draw L i with programmable shader

Opacity Shadow Maps – Recent Extensions Whole opacity maps stored in 3D texture nVidia’s demo Koster et al., Real-Time Rendering of Human Hair using Programmable Graphics Hardware, CGI 2004 Mertens et al, A Self-Shadow Algorithm for Dynamic Hair using Density Clustering, EGSR 2004

Hair rendering with lines in graphics hardware Antialiasing Shading through vertex/fragment shader Shadows with opacity maps

Questions