Graphics Reference
In-Depth Information
HS_BezierPatchConstant result =
(HS_BezierPatchConstant)0;
// Perform rounding
...SNIP as per quad patch constant function above
// Apply constant information
[unroll]
for (uint I = 0; i < 16; i++)
{
result.TextureUV[i] = patch[i].TextureUV;
}
return result;
}
6.
Next, we create the Bezier patch domain shader. This time, we will use bicubic
Bezier surface interpolation with the DeCasteljauBicubic function within
CommonTess.hlsl . The domain shader code for the Bezier surface is as follows:
// Applies control point weighting using Bezier bicubic
// interpolation
[domain(""quad"")]
PixelShaderInput DS_Bezier( HS_BezierPatchConstant constantData,
const OutputPatch<DS_ControlPointInput, 16> patch,
float2 uv : SV_DomainLocation )
{
PixelShaderInput result = (PixelShaderInput)0;
// input Colors
float3 c[16];
// input Control points
float3 p[16];
[unroll]
for(uint i=0;i<16;i++) {
p[i] = patch[i].Position;
c[i] = patch[i].Diffuse.rgb;
}
float3 position, normal;
// Perform De Casteljau bicubic interpolation of
// positions then output final position and normal
DeCasteljauBicubic(uv, p, position, normal );
// Perform De Casteljau bicubic interpolation of UV
DeCasteljauBicubic(uv, constantData.TextureUV,
result.TextureUV );
 
Search WWH ::




Custom Search