Graphics Reference
In-Depth Information
barycentric.y * v2;
}
float3 BarycentricInterpolate(float3 v[3],
float3 barycentric)
{
return BarycentricInterpolate(v[0], v[1], v[2],
barycentric);
}
2.
To perform bilinear interpolation between the four values of a quad domain, add a
Bilerp function to CommonTess.hlsl . Again, we will need to interpolate between
float2 and float3 values. The following code snippet shows the implementation
for the four float3 values; you need to do the same using float2 and float4 :
float3 Bilerp( float3 v[4] , float2 uv)
{
// bilerp the float3 values
float3 side1 = lerp( v[0], v[1], uv.x );
float3 side2 = lerp( v[3], v[2], uv.x );
return lerp( side1, side2, uv.y );
}
3.
The hull shader constant data that is generated for a triangle patch will use the
following structure, which we also add to CommonTess.hlsl :
// Max 32 outputs
struct HS_TrianglePatchConstant {
float EdgeTessFactor[3] : SV_TessFactor;
float InsideTessFactor : SV_InsideTessFactor;
float2 TextureUV[3]: TEXCOORD0;
float3 WorldNormal[3] : TEXCOORD3;
};
4.
Lastly, to support the hull shader constant data for a quad patch, add the following
HLSL structure:
// Max 32 outputs
struct HS_QuadPatchConstant {
float EdgeTessFactor[4] : SV_TessFactor;
float InsideTessFactor[2] : SV_InsideTessFactor;
float2 TextureUV[4]: TEXCOORD0;
float3 WorldNormal[4] : TEXCOORD4;
};
 
Search WWH ::




Custom Search