Sign in to follow this  
Quat

SV_DomainPoint question

Recommended Posts

Hi, I am just experimenting tessellating a simple quad. For example, I have the following quad patch in the xz-plane (+y = up direction):

XMFLOAT3 vertices[4] =
{
XMFLOAT3(-10.0f, 0.0f, -10.0f),
XMFLOAT3(-10.0f, 0.0f, +10.0f),
XMFLOAT3(+10.0f, 0.0f, +10.0f),
XMFLOAT3(+10.0f, 0.0f, -10.0f)
};

I tessellate the quad evenly to 4 quads (2 triangles each) and I specify [outputtopology("triangle_cw")].

In my domain shader, I write (where float2 uv : SV_DomainLocation):

float3 v1 = lerp(quad[0].Pos, quad[1].Pos, uv.y);
float3 v2 = lerp(quad[3].Pos, quad[2].Pos, uv.y);
float3 p = lerp(v1, v2, uv.x);

// Transform p to homogeneous clip space

However, this generates the triangles with reverse winding order, so I am seeing the backsides and not seeing the front sides. If I modify my interpolation to the following it works:

float3 v1 = lerp(quad[1].Pos, quad[0].Pos, uv.y);
float3 v2 = lerp(quad[2].Pos, quad[3].Pos, uv.y);
float3 p = lerp(v1, v2, uv.x);

What directions do the uv axes go and where is the uv-space origin?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this