Real Time Rendering
Total Page:16
File Type:pdf, Size:1020Kb
Real - Time Rendering Lighting / Shading Michal Červeňanský Juraj Starinský Overview Light Sources Lighting Shading Texturing Alpha Mapping Gloss Mapping Light Mapping Rough Surface 10.03.2010 2 Light Sources Directional light Point light Spot light Colour, intensity 10.03.2010 3 Lighting model Phong model Colour, Intensity Ambient, Diffuse, Specular + + = 10.03.2010 4 Lighting model - ambient Constant colour Light form other surfaces + 10.03.2010 5 Lighting model - diffuse = ⋅ = φ Lambert©s law idiff n l cos + Photons are scattered equally = ⋅ ⊗ i diff (n l)mdiff sdiff 10.03.2010 6 Lighting model - specular The highlight simulation r = −l + 2(n⋅l)n = ⋅ mshi = ρ mshi ispec (r v) (cos ) = ⋅ mshi ⊗ i spec max(0,(r v) )mspec sspec 10.03.2010 7 Lighting model (2) Half vector Speed-up i = iamb + idiff + ispec 10.03.2010 8 Shading Flat, Gouraud, Phong Per - primitive, vertex, fragment 10.03.2010 9 Shading (2) Tessellation is important 10.03.2010 10 Texturing Light Sources Lighting Shading Texturing − Texture mapping − Texture settings − Texture filtering Alpha Mapping Environment Mapping Gloss Mapping 10.03.2010 ... 11 Texture mapping 1D, 2D, 3D, Cube Texture transformations Texture projections (spherical, cylindrical, planar, natural) 10.03.2010 12 Texture settings Wrap modes (repeat, mirror, clamp, border) Compression (DXT, S3C, ¼) Multi-texturing 10.03.2010 13 Texture filtering Nearest Linear ± (tri/bi)linear interpolation Bi-cubic ± ATI or shaders Nearest Linear Catmul-Rom CubicBSpline 10.03.2010 14 Texture filtering (2) Mipmapping ± minification − Down sampled textures to half − Memory requirements 133% − d = log2(sqrt(A)) − Trilinear filtering (interpolation) 10.03.2010 15 Texture filtering (3) Anisotropic − < 16 samples − Vertical, horizontal 10.03.2010 16 Alpha mapping Billboards Transp. Textures − trees,... Animated textures − fire, ... 10.03.2010 17 Gloss mapping Material properties in texture Used for specular 10.03.2010 18 Light mapping Diffuse light view independent Precomputed light text. − Low resolution − Various approaches Combine with surface Shadows (static) Animated maps 10.03.2010 19 Light mapping (2) 10.03.2010 20 Rough surfaces ... Gloss Mapping Light Mapping Rough Surface − Bump mapping − Normal mapping − Displacement mapping − Parallax mapping − Relief mapping − Combinations Ambient Occlusion 10.03.2010 21 Bump mapping Rendering of structured surfaces Visual improvement without additional geometry Silhuette without change No shadows 10.03.2010 22 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 23 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 24 Displacement mapping Displacement along surface normal Applied to vertexes − Adaptive tessellation Costly technique New GPU (DX11) Tesselator shader Automatic LOD 10.03.2010 25 Parallax mapping Approximation of original geometry More apparent depth Trace rays against height fields 10.03.2010 26 Normal Paralax Relief Parallax mapping Calculate offset s,b (scale, bias) based on material s=00.1, b=s*(-0.5) hn=h*s-b Tn = T0+(hn*Vxy/Vz) · → Vz 0 Limited offset 10.03.2010Tn = T0+(hn*Vxy) 27 Relief mapping More accurate than parallax m. Self-shadowing, self-occlusion, silhouettes Based on ray-tracing − Various speed-up techniques 10.03.2010 28 Comparison 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 (2) 10.03.2010 34 Combinations Steep Parallax Mapping Interval Mapping ¼ 10.03.2010 35 Real-time rendering slides References 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.uni-stuttgart.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/Tatarchuk-ParallaxOcclusionMapping-Sketch-print.pdf 10.03.2010 36 Questions ? 10.03.2010 37.