Implementing displacement decals

In this recipe, we will be creating a displacement decal in order to add dynamic detail to a mesh on the GPU in real-time. This technique combines hardware tessellation and displacement to implement local mesh deformations such as footsteps, bullet holes, and craters.

Getting reading

We are using three new textures that are available in the downloaded content for this recipe, Crater_Diffuse.png, Crater_Displacement.png, and Crater_Normal.png. The completed project can be found in the companion code Ch06_02DisplacementDecals.

How to do it…

We will begin by creating our new Shaders\CommonDecal.hlsl HLSL shader file. This will introduce a new constant buffer to hold the necessary information that will be applied to our ...

Get Direct3D Rendering Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.