Graphics Reference
In-Depth Information
See also
F Chapter 5 , Applying Hardware Tessellation , provides more information on the
hardware tessellation process
F The Optimizing tessellation through back-face culling and dynamic Level-of-Detail
recipe in Chapter 5 , Applying Hardware Tessellation , includes how to reduce the
tessellation factor for nonsilhouette triangles
F Search on YouTube for blender baking displacement or blender baking normals for
tutorials on how to bake normal and displacement maps in Blender
F The following link provides an overview of the decimate modifier (to produce a
low-poly model from a high-poly model) within Blender: http://wiki.blender.
org/index.php/Doc:2.4/Manual/Modifiers/Generate/Decimate
F MeshLab is a useful software for mesh manipulation (Visual Computing Lab
of-ISTI-CNR at http://meshlab.sourceforge.net/ )
F An overview and implementation of parallax occlusion mapping can be found at:
http://www.d3dcoder.net/Data/Resources/ParallaxOcclusion.pdf
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 decal, include the texture references we need, and house the functions
to calculate our decal's displacement:
1. First, create a new HLSL file, Shaders\CommonDecal.hlsl ; be sure to change
the encoding or copy an existing HLSL file and clear the contents.
2. Within our new shader file, add the following global textures:
// To support decal displacement mapping
Texture2D DecalDisplacementMap : register(t2);
 
Search WWH ::




Custom Search