Académique Documents
Professionnel Documents
Culture Documents
Chas. Boyd
DirectX Graphics Architect Windows Gaming & Graphics Technology
Microsoft Corporation
Motivation
Lighting and surface effects are clearly discernable to end-users
Enables novelty for them, and differentiation for you
Enable a title to have a distinct look See other talks on lighting models, this one focuses on surfaces
Overview
Surfaces vs. Lighting Surface Types
Metal Rough Specular Subsurface Layered Materials Maya, SOFTIMAGE, Renderman
Assumptions
For all surfaces: Other effects such as shadows will be applied in the lighting model These are independent of the surface effects described here
Surface-Light Interaction
Light comes in Surface modifies it Light leaves towards camera/eye Surface interactions include
Absorption, reflection, self-shadowing, self-occlusion, scattering
Subsurface effects
Absorption, scattering, re-emission
Fundamentals of Surfaces
Surfaces often contain multiple constituents
Absorptive dies, reflective layers, scattering particles of various sizes
STM Micrograph
Polished Metal
Map-Based Technique
Apply environment map for reflection Scale it by metal color
Accounts for some colors absorbed
Procedural Technique
Use very high specular exponent
~100 or higher
Accurate model for single constant color round light source C = light*dot(N,H)^100 * base
Gamma Note: picking exponent
Use in Games
Works for gold, copper, bronze
some anodized effects
Rougher Surfaces
Smudges, scuffs, dust, oxides
Rough Surface
Diffuse Scattering
Reduced Specular
Map-based Technique
Roughness varies per-pixel in gloss map e.g. alpha of base tex Scale down environment map c = gloss*envmap*base Blur environment map in areas of low gloss
MIP LOD or post-process effect MIP LOD is per-pixel in ps.2.0
Procedural Technique
Use procedural specular spec = light*dot(N,H)**25 but with same gloss term c = gloss*spec*base Decrease exponent to achieve blur
Both Techniques
Add diffuse scattering term
Increased Roughness
Rough Surfaces
Concrete Sand Cloth Plaster Marble, non-polished Pavement Stone
Moon Photograph
Moon Rendering
Rough Surfaces
Diffuse reflector Lambertian or Oren-Nayar effects
Map-based Technique
Blur map across very large scale Integrate entire hemisphere
Diffuse only
Procedural Technique
Model only Diffuse term For directional light: c = light * dot(N,L) * base Or use hemisphere light Gamma Note:
Correct using sqrt or 1-(1-x)**2 for non-CAD applications
Layered Surface
Varnish
Dye Layer
Layered Surface
Thin layer of smooth clear material Over rough dye particles Underlayer is rough because particles may be suspended
Plastics Linoleum Enameled metal car finish Varnished surface wood
Map-Based Technique
Envt. map scaled by gloss term spec = gloss*envmap Added to diffuse term: c = dot(N,L)*base + spec Base color does not tint highlight Gamma Note: add should be linear
Correct to linear, add, convert back if have enough precision and time
Specular Only
Procedural Technique
Base color does not modulate specular, only light color does spec = light*dot(N,H)**100 c = dot(N,L)*base + spec*gloss
Summary
Polished specular*gloss*base
Rough
Varnished
diffuse*base
spec*gloss + diffuse*base
Fresnel Effect
At top layer interface
Some light is reflected, Remainder is transmitted through
Depends on surface material And on incident angle! Fresnel term f is proportion reflection
grazing angles: 100% reflected normal angles: 5% reflected
Fresnel Mid
60% reflected
Air Material
40% transmitted
Fresnel Normal
10% reflected
Fresnel Grazing
90% reflected
Air Material
10% transmitted
Fresnel Profile
Measurement
0o
45o
90o
r0,-r0,c14 // compute eye ray r3.x,r0.xyz,r0.xyz r3.xyz,r3.x r0.xyz,r0.xyz,r3.xyz// normalize it r0,r0,r1; r0,c1111,-r0 r1,r0,r0 r0,r1,r1 r0,r0,c1 oD0,r0,c0 // // // // // // dot eye ray with normal complement color **2 **4 scale for fresnel bias and emit as diffuse
ps.1.1
; def v0 def c0 def c1 tex t0 dp3 mul mul mad r0,v0_bx2,t0_bx2; r1,1-r0,1-r0 r0,r1,r1 r0,r0,c1,c0 // // // // // // // // eye ray 5% bias 95% scale normal map dot eye ray with normal complement and square **4 scale & bias
Fresnel Comparison
1- cosq
(1- cosq)4
Measurement
0o
45o
90o
Fresnel Term
Metallic Flake
Can used BEML with random Gaussian distribution of perturbation pixels Can use similar trick for glass buildings
point sampled displacement map gives each window a separate normal Or use filtering to get curved windows then must mask seams with alphatest
MicroFlake
Use procedural specular term with low exponent ~8
Feasible with DirectX 8.* pixel shader
Still need enviroment map for car finish enamel gloss coat
Varnish
Flakes
Dye Layer
Sub-Surface Effects
Absorption
Light has to get inside
Re-emission
Light has to get out again
Subsurface Absorption
Can be impacted by Fresnel effects
Only non-reflected light penetrates
Skin
A layer of ketchup covered by tissue paper Probably more translucent than real ketchup
Anisotropic Effects
Most visible in specular case Brushed metal Cloth fabrics Wire spools
Anisotropic Hair
Hair Tufts
snip a lock, put it in scanner
Eyelashes
use alpha channel mask per-vertex anisotropic
no per-pixel direction variation
Key References
Nelson Max Christophe Schlick Peter Shirley
Empiricism
Shading is not fully understood Most efforts not based on pure physics Equations are fit to measured data Equations are chosen to look good
Empirical Process
Discern an effect Measure how it varies Curve fit some equation to it Tweak it until it looks good
Empirical Process
Measure
Plot Fit Eqn
Render
Tweak Evaluate
Nelson Max
Horizon mapping: shadows for bump-mapped surfaces
Basis of last years GDC talk on realtime self-shadowing bump maps Available as sample in DX8.1 SDK
Christophe Schlick
A Customizable Reflectance Model for Everyday Rendering
Uses his procedurally generated BRDF Generic Lighting Model
Single shader for specular vs diffuse, and isotropic vs anisotropic surfaces
Peter Shirley
Real-time Ray-tracing
Hemisphere lighting model
Books
Foley & Van Dam, Feiner, Hughes
Still lots of good background material Fundamentals
Miscellaneous
Graphics Gems Game Programming Gems Real-time Photorealistic Rendering
Eric Haines
Call to Action
Pick a unique Look and do it Toon several methods Cheesy unlit or flat shaded Retro std FF pipelines Radiosity soft lighting only Shadows horror movie Gritty ultra realistic
Uses photos for concept art