Hair Rendering and Shading

Similar documents
INTRODUCTION TO RENDERING TECHNIQUES

OpenGL Performance Tuning

Image Synthesis. Fur Rendering. computer graphics & visualization

Image Processing and Computer Graphics. Rendering Pipeline. Matthias Teschner. Computer Science Department University of Freiburg

Procedural Shaders: A Feature Animation Perspective

Optimizing AAA Games for Mobile Platforms

The Evolution of Computer Graphics. SVP, Content & Technology, NVIDIA

Shader Model 3.0. Ashu Rege. NVIDIA Developer Technology Group

Optimizing Unity Games for Mobile Platforms. Angelo Theodorou Software Engineer Unite 2013, 28 th -30 th August

An introduction to Global Illumination. Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology

Image Synthesis. Transparency. computer graphics & visualization

Rendering Microgeometry with Volumetric Precomputed Radiance Transfer

Introduction to Computer Graphics

Far Cry and DirectX. Carsten Wenzel

Computer Graphics. Introduction. Computer graphics. What is computer graphics? Yung-Yu Chuang

Computer Applications in Textile Engineering. Computer Applications in Textile Engineering

Non-Photorealistic Rendering of Hair for Animated Cartoons

Introduction to Computer Graphics. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

DIGITAL ELEMENT CREATION

Silverlight for Windows Embedded Graphics and Rendering Pipeline 1

CSE 564: Visualization. GPU Programming (First Steps) GPU Generations. Klaus Mueller. Computer Science Department Stony Brook University

Computer Graphics Global Illumination (2): Monte-Carlo Ray Tracing and Photon Mapping. Lecture 15 Taku Komura

GPU(Graphics Processing Unit) with a Focus on Nvidia GeForce 6 Series. By: Binesh Tuladhar Clay Smith

Lezione 4: Grafica 3D*(II)

Computer-Generated Photorealistic Hair

Volume Rendering on Mobile Devices. Mika Pesonen

Modern Graphics Engine Design. Sim Dietrich NVIDIA Corporation

Recent Advances and Future Trends in Graphics Hardware. Michael Doggett Architect November 23, 2005

DRY AND WET FAKE FUR RENDERING. SANTIAGO, C. H 1, Walter, M 2. Recife- PE, Brasil. hemir.santiago@gmail.com, marcelow@cin.ufpe.br

Advances in Real-Time Skin Rendering

Modeling Hair Influenced by Water and Styling Products

A Short Introduction to Computer Graphics

Introduction Week 1, Lecture 1

Making natural looking Volumetric Clouds In Blender 2.48a

NVPRO-PIPELINE A RESEARCH RENDERING PIPELINE MARKUS TAVENRATH MATAVENRATH@NVIDIA.COM SENIOR DEVELOPER TECHNOLOGY ENGINEER, NVIDIA

Deferred Shading & Screen Space Effects

Interactive Information Visualization using Graphics Hardware Študentská vedecká konferencia 2006

Water Flow in. Alex Vlachos, Valve July 28, 2010

A Language for Shading and Lighting Calculations

Using Photorealistic RenderMan for High-Quality Direct Volume Rendering

Renderman on Film Combining CG & Live Action using Renderman with examples from Stuart Little 2

How To Understand The Power Of Unity 3D (Pro) And The Power Behind It (Pro/Pro)

Maya 2014 Still Life Part 1 Texturing & Lighting

GPU Shading and Rendering: Introduction & Graphics Hardware

Monash University Clayton s School of Information Technology CSE3313 Computer Graphics Sample Exam Questions 2007

Plug-in Software Developer Kit (SDK)

Dhiren Bhatia Carnegie Mellon University

COMP175: Computer Graphics. Lecture 1 Introduction and Display Technologies

Computer Graphics Hardware An Overview

Our One-Year 3D Animation Program is a comprehensive training in 3D using Alias

Approval Sheet. Interactive Illumination Using Large Sets of Point Lights

Cartoon-Looking Rendering of 3D-Scenes

CAUSTICS are complex patterns of shimmering

Computer Graphics CS 543 Lecture 12 (Part 1) Curves. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

Computer Animation: Art, Science and Criticism

Outline. srgb DX9, DX10, XBox 360. Tone Mapping. Motion Blur

Silhouette Extraction Bruce Gooch, University of Utah

3 hours One paper 70 Marks. Areas of Learning Theory

Visualizing Data: Scalable Interactivity

CUBE-MAP DATA STRUCTURE FOR INTERACTIVE GLOBAL ILLUMINATION COMPUTATION IN DYNAMIC DIFFUSE ENVIRONMENTS

COMP-557: Fundamentals of Computer Graphics McGill University, Fall 2010

The RADIANCE Lighting Simulation and Rendering System

Materials in NX Render

First, let me do a super fast introduction,

High Dynamic Range and other Fun Shader Tricks. Simon Green

Consolidated Visualization of Enormous 3D Scan Point Clouds with Scanopy

Cork Education and Training Board. Programme Module for. 3 Dimensional Computer Graphics. Leading to. Level 5 FETAC

CIS 536/636 Introduction to Computer Graphics. Kansas State University. CIS 536/636 Introduction to Computer Graphics

A.R.I.S.E. Architectural Real-time Interactive Showing Environment. Supervisor: Scott Chase

NVIDIA Material Definition Language 1.1

Lighting & Rendering in Maya: Lights and Shadows

3D Modelling in Blender Based on Polygonal Data

REAL-TIME IMAGE BASED LIGHTING FOR OUTDOOR AUGMENTED REALITY UNDER DYNAMICALLY CHANGING ILLUMINATION CONDITIONS

2: Introducing image synthesis. Some orientation how did we get here? Graphics system architecture Overview of OpenGL / GLU / GLUT

Path Tracing. Michael Doggett Department of Computer Science Lund university Michael Doggett

Scan-Line Fill. Scan-Line Algorithm. Sort by scan line Fill each span vertex order generated by vertex list

Overview Motivation and applications Challenges. Dynamic Volume Computation and Visualization on the GPU. GPU feature requests Conclusions

Shadows. Shadows. Thanks to: Frédo Durand and Seth Teller MIT. Realism Depth cue

Software Virtual Textures

Monte Carlo Path Tracing

SkillsUSA 2014 Contest Projects 3-D Visualization and Animation

GPU-Driven Rendering Pipelines

Advanced Rendering for Engineering & Styling

Glass coloured glass may pick up on scan. Top right of screen tabs: these tabs will relocate lost windows.

GPU Architecture. Michael Doggett ATI

PRODUCT LIFECYCLE MANAGEMENT COMPETENCY CENTRE RENDERING. PLMCC, JSS Academy of Technical Education, Noida Rendering 1 of 16

Activity Set 4. Trainer Guide

Dynamic Resolution Rendering

Motivation. Motivation

Vertex and fragment programs

IT 386: 3D Modeling and Animation. Review Sheet. Notes from Professor Nersesian s IT 386: 3D Modeling and Animation course

3D Computer Games History and Technology

Course Overview. CSCI 480 Computer Graphics Lecture 1. Administrative Issues Modeling Animation Rendering OpenGL Programming [Angel Ch.

Data Parallel Computing on Graphics Hardware. Ian Buck Stanford University

Rally Sport Racing Game: CodeName Space Racer

Hardware design for ray tracing

B2.53-R3: COMPUTER GRAPHICS. NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions.

The 3D rendering pipeline (our version for this class)

Efficient View-Dependent Image-Based Rendering with Projective Texture-Mapping

SELF ASSESSMENT GUIDE

Transcription:

Hair Rendering and Shading Thorsten Scheuermann 3D Application Research Group ATI Research, Inc.

Overview Hair rendering technique using polygonal a hair model Shader: Mix of Kajiya-Kay hair shading model Marschner s model presented at SIGGRAPH 2003 Simple approximate depth-sorting scheme Demo 2

Hair Rendering Hair is important visually Most humans have hair on their heads Hair is hard: There is a lot of it 100K-150K hair strands on a human head Many different hair styles ~25% of the total render time of Final Fantasy - The Spirits Within was spent on the main character s hair 3

Why We Chose a Polygonal Hair Model Lower geometric complexity than line rendering Makes depth sorting faster Integrates well into our art pipeline 4

Hair Model Authoring Several layers of patches to approximate volumetric qualities of hair Ambient occlusion to approximate selfshadowing Per vertex 5

Hair Model - Textures Base texture Stretched noise Alpha texture should have fully opaque regions Specular shift texture Specular noise texture More on these later 6

Hair Lighting: Kajiya-Kay Model Anisotropic strand lighting model Use hair strand tangent (T) instead of normal (N) in lighting equations Assumes hair normal to lie in plane spanned by T and view vector (V) Example: Specular N.H term T L H N dot( N, H ) specularity sin( T, H) specularity 1 dot( T, H) 2 = specularity V 7

Hair Lighting: Marschner Model Based on measurements of hair scattering properties Observations Primary specular highlight shifted towards hair tip Secondary specular highlight colored shifted towards hair root Sparkling appearance of secondary highlight Math is complex, we re just trying to match these observations phenomenologically 8

Shader Breakdown Vertex Shader Just passes down tangent, normal, view vector, light vector, ambient occlusion term Pixel Shader Diffuse Lighting Kajiya-Kay diffuse term sin(t, L) looks too bright without proper self-shadowing We use a tweaked N.L term Two shifted specular highlights Combining terms 9

Shifting Specular Highlights To shift the specular highlight along the length of the hair, we nudge the tangent along the direction of the normal Assuming T is pointing from root to tip: Positive nudge moves highlight towards root Negative nudge moves highlight towards tip Look up shift value from texture to break up uniform look over hair patches T T T N float3 ShiftTangent (float3 T, float3 N, float shift) { float3 shiftedt = T + shift * N; return normalize (shiftedt); } 10

Specular Strand Lighting We do strand specular lighting using the halfangle vector Using reflection vector and view vector would make the shader a little more complicated Two highlights with different colors, specular exponents and differently shifted tangents Modulate secondary highlight with noise texture float StrandSpecular (float3 T, float3 V, float3 L, float exponent) { float3 H = normalize(l + V); float dotth = dot(t, H); float sinth = sqrt(1.0 - dotth*dotth); float diratten = smoothstep(-1.0, 0.0, dot(t, H)); return diratten * pow(sinth, exponent); } 11

Putting it All Together (Note: external constants are light blue) float4 HairLighting (float3 tangent, float3 normal, float3 lightvec, float3 viewvec, float2 uv, float ambocc) { // shift tangents float shifttex = tex2d (tspecshift, uv) 0.5; float3 t1 = ShiftTangent (tangent, normal, primaryshift + shifttex); float3 t2 = ShiftTangent (tangent, normal, secondaryshift + shifttex); } // diffuse lighting: the lerp shifts the shadow boundary for a softer look float3 diffuse = saturate (lerp (0.25, 1.0, dot(normal, lightvec)); diffuse *= diffusecolor; // specular lighting float3 specular = specularcolor1 * StrandSpecular (t1, viewvec, lightvec, specexp1); // add 2 nd specular term, modulated with noise texture float specmask = tex2d (tspecmask, uv); // approximate sparkles using texture specular += specularcolor2 * specmask * StrandSpecular (t2, vievec, lightvec, specexp2); // final color assembly float4 o; o.rgb = (diffuse + specular) * tex2d (tbase, uv) * lightcolor; o.rgb *= ambocc; // modulate color by ambient occlusion term o.a = tex2d (talpha, uv); // read alpha texture return o; 12

Ambient Occlusion Diffuse Term Specular Term Combined 13

Approximate Depth Sorting Need to draw in back-to-front order for correct alpha-blending For a head with hair this is very similar to inside to outside Use static index buffer with inside to outside draw order, computed at preprocess time Sort connected components (hair strand patches) instead of individual triangles 14

Sorted Hair Rendering Scheme Pass 1 opaque parts Enable alpha test to only pass opaque pixels Disable backface culling Enable Z writes, set Z test to Less Pass 2 transparent back-facing parts Enable alpha test to pass all non-opaque pixels Cull front-facing polygons Disable Z writes, set Z test to Less Pass 3 transparent front-facing parts Enable alpha test to pass all non-opaque pixels Cull back-facing polygons Enable Z writes, set Z test to Less 15

Performance Tuning Use early Z culling extensively to save us from running expensive pixel shader Usually half the hair is hidden behind the head Draw head first Early Z culling can t be used when alpha test is enabled! Solution: Prime Z buffer with a very simple shader that uses alpha test Use Z testing instead of alpha testing in subsequent passes for same effect Early Z culling saves considerable fill overhead! 16

Optimized Rendering Scheme Pass 1 prime Z buffer Enable alpha test to only pass opaque pixels Disable backface culling Enable Z writes, set Z test to Less Disable color buffer writes Use simple pixel shader that only returns alpha Pass 2 opaque parts Disable backface culling Disable Z writes, set Z test to Equal Pass 3 transparent back-facing parts Cull front-facing polygons Disable Z writes, set Z test to Less Pass 4 transparent front-facing parts Cull back-facing polygons Enable Z writes, set Z test to Less 17

Demo 18

Pros and Cons Pros: Low geometric complexity Lessens load on vertex engine Makes depth sorting faster Usable on lower-end hardware with simpler shaders or fixed-function pipeline Cons: Sorting scheme assumes little animation in hair model Things like dangling pony tails need to be handled separately Sort geometry at run-time to overcome this Not suitable for all hair styles 19

Conclusion Polygonal hair model Hair lighting Simple approximate depth-sorting scheme Optimization Tips 20

References J. Kajiya and T. Kay. Rendering fur with three dimensional textures. In SIGGRAPH 89 Conference Proceedings, pp. 271-280, 1989. Stephen R. Marschner, Henrik Wann Jensen, Mike Cammarano, Steve Worley, and Pat Hanrahan, Light Scattering from Human Hair Fibers. In Proceedings of SIGGRAPH 2003. SIGGRAPH 2003 Hair Rendering Course Notes 21