Optimizing tessellation based on displacement decal (displacement adaptive tessellation)

By modifying our hull shader constant function, we can easily modify the tessellation factor based on whether or not a decal is located within the vicinity of a patch. This is also known as displacement adaptive tessellation.

Getting ready

Within the completed sample available for download in Implementing displacement decals, there is an additional function in Shaders\CommonDecal.hlsl that adds the provided tessellation factor to the appropriate edges and inside tessellation factors depending on whether the decal position and radius would impact the current patch.

void DecalTessellationFactor(float3 p[3], inout float3 edgeTessFactor, inout float insideTessFactor, ...

Get Direct3D Rendering Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.