• Advertisement
Sign in to follow this  

SV_DomainPoint question

This topic is 2483 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Sign in to follow this  

  • Advertisement