Jump to content
  • Advertisement
Sign in to follow this  
Quat

SV_DomainPoint question

This topic is 2606 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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!