O'Reilly logo

DirectX 11.1 Game Programming by Pooya Eimandar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Basic tessellation

We have introduced the functionality of each stage of tessellation; now it is time to check out the first example of this chapter. Open the Basic Tessellation project; this example will implement the most basic tessellation patterns.

The Hull Shader stage

Open the TriHullShader.hlsl file by navigating to Assets/Shaders/Triangle; we are going to draw our attention to the Hull Shader. The following function is a patch constant function which called by the Hull Shader once per patch.

HS_Const CalcHSPatchConstants(InputPatch<HS_Input, NUM_CONTROL_POINTS> ip, uint PatchID : SV_PrimitiveID) { HS_Const OUT = (HS_Const)0; OUT.EdgeTessFactor[0] = OUT.EdgeTessFactor[1] = OUT.EdgeTessFactor[2] = TessEdge; OUT.InsideTessFactor = TessInside; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required