Introduction to normal mapping Karl Tarbe Faculty of Mathematics - - PowerPoint PPT Presentation
Introduction to normal mapping Karl Tarbe Faculty of Mathematics - - PowerPoint PPT Presentation
Introduction to normal mapping Karl Tarbe Faculty of Mathematics and Computer Science October 2, 2014 The problem What we want? better graphics better frame rate Karl Tarbe Bump mapping October 2, 2014 2 / 14 Solution - More polygons!
The problem
What we want?
better graphics better frame rate
Karl Tarbe Bump mapping October 2, 2014 2 / 14
Solution - More polygons!
What we get?
better graphics better frame rate
Karl Tarbe Bump mapping October 2, 2014 3 / 14
Solution - More polygons!
What we get?
better graphics better frame rate
Karl Tarbe Bump mapping October 2, 2014 3 / 14
Shading makes the difference
Example
Karl Tarbe Bump mapping October 2, 2014 4 / 14
Bump mapping
Example from wikipedia
Karl Tarbe Bump mapping October 2, 2014 5 / 14
Bump mapping
Example from wikipedia How to:
Simulate displacement of surface. Profit!
Karl Tarbe Bump mapping October 2, 2014 5 / 14
Bump mapping
Example from wikipedia How to:
Simulate displacement of surface. Profit! Topic of today.
Karl Tarbe Bump mapping October 2, 2014 5 / 14
Texture mapping
Texture Textured plane
Karl Tarbe Bump mapping October 2, 2014 6 / 14
Normal compression
Normal vector
Three components Range −1.0 ≤ ni ≤ 1.0
- n = (x, y, z)
RGB color
Three components Range 0 ≤ ci ≤ 255
- color = (r, g, b)
Karl Tarbe Bump mapping October 2, 2014 7 / 14
Normal compression
Normal vector
Three components Range −1.0 ≤ ni ≤ 1.0
- n = (x, y, z)
RGB color
Three components Range 0 ≤ ci ≤ 255
- color = (r, g, b)
Compression
ci = 127.5 ∗ (ni + 1.0) ni = 1 127.5 ∗ ci − 1.0
Karl Tarbe Bump mapping October 2, 2014 7 / 14
Normal map example
3D model Corresponding normal map
Karl Tarbe Bump mapping October 2, 2014 8 / 14
Height map
Texture Corresponding height map
Karl Tarbe Bump mapping October 2, 2014 9 / 14
From height map to normal map
Gradient
xgrad = pix(x −1, y)−pix(x +1, y) ygrad = pix(x, y −1)−pix(x, y +1)
- n′ =
n + U · xgrad + V · ygrad
Karl Tarbe Bump mapping October 2, 2014 10 / 14
Revisiting Blinn-Phong lighting model
Different terms
Diffuse Ambient Specular
Final equation
I = LA · MA + nT · l · LD · MD + (r T · v)c · LS · MS
Karl Tarbe Bump mapping October 2, 2014 11 / 14
Applying normal map
How to
Choose a consistent base. Convert normal to that base. Use that normal in the lighting model.
Example from The Cg Tutorial
Karl Tarbe Bump mapping October 2, 2014 12 / 14
Disadvantages of bump mapping
Example from wikipedia Disadvantages
Shadows Outline
Karl Tarbe Bump mapping October 2, 2014 13 / 14
Parallax mapping
Bump mapping Parallax mapping
Karl Tarbe Bump mapping October 2, 2014 14 / 14