Graphics Reference
In-Depth Information
At this point, it is possible to compile and run the project to see displacement mapping in
action. The bottom right image (D) of the following figure shows an example of the result:
Tree log render: (A) no displacement and with a tessellation factor of 2.0, (B) as per A, but with
normal mapping applied, (C) as per A, but with displacement mapping applied and using a displacement
scale of 0.020, (D) as per C, but with normal mapping applied.
How it works...
Displacement mapping modifies the structure of the mesh in the direction of the normal.
Looking at the tree log render and the comparison of normal and displacement mapping in
the previous recipe, it is clear that normal mapping or displacement mapping alone are not
enough. However, when combined together, they can have a profound impact on the scene.
We have combined these techniques by first modifying our model's material to support
multiple textures in addition to the diffuse texture (refer to the Referencing multiple textures
in a material with the Visual Studio graphics content pipeline recipe), the normal map,
and the displacement or height map. We then sample these textures within the pixel
shader and domain shader respectively.
 
Search WWH ::




Custom Search