Graphics Reference
In-Depth Information
The Domain Shader
So far in this section, the discussion has centered on construction of the control mesh from
the input positions and normal vectors. As discussed earlier, these are analogous to the
coefficients of the equation that represents the ideal curved surface.
It is the domain shader's responsibility to take these coefficients, along with the sam-
pling points generated by the fixed-function tessellator, and evaluate the new geometry that
makes up the final curved surface:
(9.11)
(9.12)
Equation (9.11) shows the cubic function that needs to be evaluated for each output
position from the domain shader stage. Similarly, Equation (9.12) shows the quadratic
function for computing each normal vector. Listing 9.21 shows an HLSL implementation
of these two functions.
cbuffer Transforms
{
matrix mWorld;
matrix mViewProj;
matrix mlnvTposeWorld;
};
cbuffer TessellationParameters
{
float4 EdgeFactors;
};
cbuffer RenderingParameters
{
float3 cameraPosition;
float3 cameraLookAt;
};
struct DS_OUTPUT
{
float4 Position
: SV_Position;
float3 Colour
: COLOUR;
};
[domain("tri")]
DS_OUTPUT dsMain
Search WWH ::




Custom Search