Direct3D 12 - Textures - The role of texture mapping

normal map

Increase the surface details without increasing the triangle.
Any pixel has a perturbation on its normal, and recalculates the normal by defining different heights and the height difference between adjacent positions. The texture
defines any point, its relative height Movement, changing the normal through changes in height. The original surface
Insert image description here
normal vector n (p) = (0,1)
The derivative of point p is dp = c * [h(p+1) - h§] Tangent
perturbation normal n§ = (-dp, 1).normalized() calculates the original surface normal vector n§ = (0,0,1)
Insert image description here
in 3D space . The derivative of point p is

  • dp/du = c1 * [h(u+1) - h(u)]
  • dp/dv = c2 * [h(v+1) - h(v)]

Perturbed normal n = (-dp/du, -dp/dv, 1).normalized()
Note that this is in local coordinates!

Displacement map

Bump maps and displacement maps are defined by using a texture to define the relative height difference that any point of them should have, so they have exactly the same input and use exactly the same texture.
Displacement maps actually move vertices. Instead of converting it into a normal transformation through position movement, and then making a fake vertex movement.
The bump map does not actually change any geometry, it will be exposed at the edge of the geometry, it will not produce shadows when the geometry is relatively complex, and it will not project itself onto itself.
Displacement mapping actually has a price. The price is that the triangle needs to be thin enough, so thin that it is higher than the frequency of the texture. Direct3D's dynamic surface subdivision optimization means that such thin triangles are not needed at the beginning and can be subdivided as needed.
Insert image description here

Textures can also be 3D in fact

It defines the value of any point in the space. In fact, there is no graph that actually generates the texture. It is a function that defines the noise in the three-dimensional space. Therefore, at any point in the space, it has an analytical formula that can calculate the value of the noise. How much, and then there is a noise in the three-dimensional space. After a series of processing, this noise can be binarized, and can be added, subtracted, multiplied, and divided. After the operation, it can become what you want.

Perlin noise algorithm, which can define three-dimensional noise

3D textures are widely used in volume rendering

Guess you like

Origin blog.csdn.net/weixin_43945471/article/details/130188467