Real - Time Rendering Lighting / Shading
Transcript of Real - Time Rendering Lighting / Shading
Real Time Rendering
Lighting / Shading
Michal ČerveňanskýJuraj Starinský
10.03.2010 2
Overview Light Sources Lighting Shading Texturing Alpha Mapping Gloss Mapping Light Mapping Rough Surface
10.03.2010 3
Light Sources
Directional light Point light Spot light Colour, intensity
10.03.2010 4
Lighting model
Phong model Colour, Intensity Ambient, Diffuse, Specular
++
=
10.03.2010 5
Lighting model ambient
Constant colour Light form other surfaces
+
10.03.2010 6
Lighting model diffuse
Lambert's law Photons are scattered equally
+
φcos=⋅= lndiffi
diffdiffdiff smlni ⊗⋅= )(
10.03.2010 7
Lighting model specular
The highlight simulation
l)n2(nlr ⋅+−=shishi mm
speci )(cos)( ρ=⋅= vr
specspecm
specshi smvri ⊗⋅= ))(,0max(
10.03.2010 8
Lighting model (2)
Half vector Speedup i = iamb + idiff + ispec
10.03.2010 9
Shading
Flat, Gouraud, Phong Per primitive, vertex, fragment
10.03.2010 10
Shading (2)
Tessellation is important
10.03.2010 11
Texturing Light Sources
Lighting
Shading
Texturing− Texture mapping− Texture settings− Texture filtering
Alpha Mapping
Environment Mapping
Gloss Mapping
...
10.03.2010 12
Texture mapping 1D, 2D, 3D, Cube Texture transformations Texture projections (spherical,
cylindrical, planar, natural)
10.03.2010 13
Texture settings
Wrap modes (repeat, mirror, clamp, border) Compression (DXT, S3C, …) Multitexturing
10.03.2010 14
Texture filtering
Nearest Linear – (tri/bi)linear interpolation Bicubic – ATI or shaders
Nearest Linear CatmulRom CubicBSpline
10.03.2010 15
Texture filtering (2)
Mipmapping – minification− Down sampled textures to half− Memory requirements 133%− d = log2(sqrt(A))− Trilinear filtering (interpolation)
10.03.2010 16
Texture filtering (3)
Anisotropic− < 16 samples− Vertical, horizontal
10.03.2010 17
Alpha mapping
Billboards Transp. Textures
− trees,... Animated textures
− fire, ...
10.03.2010 18
Gloss mapping
Material properties in texture Used for specular
10.03.2010 19
Light mapping
Diffuse light view independent Precomputed light text.
− Low resolution− Various approaches
Combine with surface Shadows (static) Animated maps
10.03.2010 20
Light mapping (2)
10.03.2010 21
Rough surfaces ...
Gloss Mapping
Light Mapping
Rough Surface− Bump mapping− Normal mapping− Displacement mapping− Parallax mapping− Relief mapping− Combinations
Ambient Occlusion
10.03.2010 22
Bump mapping Rendering of structured surfaces Visual improvement without additional
geometry Silhuette without change No shadows
10.03.2010 23
Bump mapping (2)
Height map − Calculated normal− Central differences− uv space
Perturbing surface normal by height map normal More computation Less memory
10.03.2010 24
Normal mapping Replaces surface normals from texture Normals in texture
− Generated from high res. model− High resolution− Compressed [1,1] [0,1]→− uv space
10.03.2010 25
Displacement mapping
Displacement along surface normal Applied to vertexes
− Adaptive tessellation Costly technique New GPU (DX11)
Tesselator shader Automatic LOD
10.03.2010 26
Parallax mapping Approximation of original geometry More apparent depth Trace rays against height fields
Normal Paralax Relief
10.03.2010 27
Parallax mapping Calculate offset
s,b (scale, bias) based on material
s=00.1, b=s*(0.5) hn=h*sb Tn = T0+(hn*Vxy/Vz)• Vz 0→
Limited offset Tn = T0+(hn*Vxy)
10.03.2010 28
Relief mapping More accurate than parallax m. Selfshadowing, selfocclusion,
silhouettes Based on raytracing
− Various speedup techniques
10.03.2010 29
Comparison
10.03.2010 30
Comparison
10.03.2010 31
Comparison
10.03.2010 32
Comparison
10.03.2010 33
Comparison
10.03.2010 34
Comparison (2)
10.03.2010 35
Combinations Steep Parallax Mapping Interval Mapping …
10.03.2010 36
References Realtime rendering slides
GeForce 8 and 9 Series GPU Programming
http://en.wikipedia.org/wiki/
http://flickr.com/photos/buou/2126755136/
http://vr.kaist.ac.kr/_r011.htm
http://www.vis.unistuttgart.de/eng/teaching/lecture/ws04/seminar_spiele/bsp/
http://www.cg.tuwien.ac.at/courses/Realtime/
http://graphics.cs.ucf.edu/IntervalMapping/
http://graphics.cs.brown.edu/games/SteepParallax/index.html
http://www.inf.ufrgs.br/~oliveira/RTM.html
http://ati.amd.com/developer/SIGGRAPH05/TatarchukParallaxOcclusionMappingSketchprint.pdf
10.03.2010 37
Questions ?