Difference between revisions of "Hardware 3D (C++ DirectX Graphics) Tutorial 34"

From Chilipedia
Jump to: navigation, search
(Created page with "Normal mapping is like what texture mapping would be if it actually lived up to its name. Time to learn about tangent space all other such things. == Topics Covered == === Pa...")
 
(Topics Covered)
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
Normal mapping is like what texture mapping would be if it actually lived up to its name. Time to learn about tangent space all other such things.
+
Normal mapping is like what texture mapping would be if it actually lived up to its name. Time to learn about tangent space and other such weird things, I guess.
  
 
== Topics Covered ==
 
== Topics Covered ==
Line 6: Line 6:
 
* Texture alignment
 
* Texture alignment
 
* RGB encoding of normal vectors
 
* RGB encoding of normal vectors
 +
=== Part 2 ===
 +
* Translation of object space normal map into view space
 +
* Refactoring using SOLID principles
 +
** Single Responsibility Principle
 +
** Open / Closed Principle
 +
* Definition and limitations of object space normal mapping
 +
=== Part 3 ===
 +
* Tangent Space
 +
* Extraction of Tangent and Bitangent vectors from vertex data (pos, normal, uv)
 +
* Synthesis of TBN matrix (tangent space rotation matrix)
 +
* Fixing the mapping from Green color channel => Z component of normal map vector
 +
 +
== <span style="color:red">Errata</span> ==
 +
In '''Part 1''', Chili decodes the z component of the normal map by mapping from 0..1 => 0..1 directly, but this mapping is not common, nor is it correct for the map we are using. All channels should be mapped with 0..1 => -1..+1. This will be corrected in '''Part 3'''. It ''is'' true that the z channel will never be less than zero in a proper (tangent space) normal map, but it does ''not'' seem to be common to use this unused range to expand the dynamic range of the z channel encoding.
  
 
== Video Timestamp Index ==
 
== Video Timestamp Index ==
* [https://youtu.be/gl9hyyyyyy Tutorial 34]
+
* [https://youtu.be/1aaAyL6SyE0 Tutorial 34 - Part 1]
 +
* [https://youtu.be/Tf2ZOyc0XcQ Tutorial 34 - Part 2]
 +
* [https://youtu.be/PnazRFnPPcg Tutorial 34 - Part 3]
  
 
== Source Code ==
 
== Source Code ==

Latest revision as of 19:13, 14 September 2019

Normal mapping is like what texture mapping would be if it actually lived up to its name. Time to learn about tangent space and other such weird things, I guess.

Topics Covered

Part 1

  • Normal mapping motivation / goal
  • Texture alignment
  • RGB encoding of normal vectors

Part 2

  • Translation of object space normal map into view space
  • Refactoring using SOLID principles
    • Single Responsibility Principle
    • Open / Closed Principle
  • Definition and limitations of object space normal mapping

Part 3

  • Tangent Space
  • Extraction of Tangent and Bitangent vectors from vertex data (pos, normal, uv)
  • Synthesis of TBN matrix (tangent space rotation matrix)
  • Fixing the mapping from Green color channel => Z component of normal map vector

Errata

In Part 1, Chili decodes the z component of the normal map by mapping from 0..1 => 0..1 directly, but this mapping is not common, nor is it correct for the map we are using. All channels should be mapped with 0..1 => -1..+1. This will be corrected in Part 3. It is true that the z channel will never be less than zero in a proper (tangent space) normal map, but it does not seem to be common to use this unused range to expand the dynamic range of the z channel encoding.

Video Timestamp Index

Source Code

See also