Graphics Reference
In-Depth Information
2.
That's it. The resulting output with a base tessellation factor of 1.0 is shown in the
following figure:
Example output of meshes with a tessellation increase of 10.0 for patches impacted by the displacement decal
How it works…
When we calculate the edge and inside tessellation factors, we are now adding 10.0 to
the tessellation factor value if a decal happens to be located within range of the patch.
The calculation correctly ignores edges that are not covered by the decal, and it generally
results in crack free decal displacements. In situations where cracks appear, try using the
inside tessellation factor only and discard the changes to the edges—or create a modified
version of the DecalTessellationFactor method to exclude the edges or inside
tessellation factor, as appropriate.
float3 ignoreEdge;
DecalTessellationFactor(p, ignoreEdge , roundedInsideTessFactor,
10);
The DecalTessellationFactor method determines the tessellation factors for us
using the Pythagorean Theorem to calculate the distance of each edge of the current
patch (triangle) from the location of the decal as provided by the DecalPosition and
DecalRadius properties in the decal constant buffer.
The example output shown previously uses a tessellation factor of 1.0 for all triangles not
covered by a decal, and a tessellation factor of 11.0 for those that are. It can be seen that
the increase in triangle count can be quite significant. Therefore, it is a good idea to apply
the [maxtessfactor(12.0f)] attribute to your hull shaders, as shown in the following code snippet.
This will prevent decals from increasing the tessellation factor beyond a certain limit,
safeguarding performance:
[domain("tri")]
...
[maxtessfactor(12.0f)]
 
Search WWH ::




Custom Search