Book Image

Direct3D Rendering Cookbook

By : Justin Stenning, Justin Stenning
Book Image

Direct3D Rendering Cookbook

By: Justin Stenning, Justin Stenning

Overview of this book

Table of Contents (19 chapters)
Direct3D Rendering Cookbook
About the Author
About the Reviewers
Further Reading

Adding surface detail with displacement mapping

In this recipe, we will use displacement mapping via the tessellation pipeline to add additional geometric detail to an otherwise smooth or flat surface. This is the key technique used for approximating the detail on high-poly meshes using a low-poly version of the same mesh.

Displacement mapping uses a displacement map texture (also known as a height map) that consists of a single channel that is used to control the amount to displace a vertex. Depending on the method of construction, this height map can have a midpoint that allows the vertex to be lowered/raised, or the map may only support displacement in one direction. A displacement map will generally use the same UV coordinates as the diffuse texture and normal map. We will make changes to our existing tessellation shaders and incorporate displacement mapping to the solution to improve the surface detail of the final render.

Getting ready

In this recipe, we require the normal mapping changes...