0
\$\begingroup\$

I have the following simple patch function in DX11, but I keep getting rips, and when I look at the wireframe its clear that adjacent edges are not getting the same tessellation factor. The CalcTessFactor() function just does a distance from the camera to the point passed, so should always give the same value for the same edge center that I pass in.

PatchTess patchFunction_Far(InputPatch<VertexToPixel_Far, 3> patch, uint patchID : SV_PrimitiveID)
 {
  PatchTess pt;

 // Compute midpoint on edges, and patch center
  float3 e0 = 0.5f*(patch[0].WorldPosition + patch[1].WorldPosition);
  float3 e1 = 0.5f*(patch[1].WorldPosition + patch[2].WorldPosition);
  float3 e2 = 0.5f*(patch[2].WorldPosition + patch[0].WorldPosition);
  float3  c = (patch[0].WorldPosition + patch[1].WorldPosition + patch[2].WorldPosition) / 3.0f;

 pt.EdgeTess[0] = CalcTessFactor(e0);
  pt.EdgeTess[1] = CalcTessFactor(e1);
  pt.EdgeTess[2] = CalcTessFactor(e2);

 pt.InsideTess = CalcTessFactor©;


 return pt;
 }

My patches are triangles.

Is there something I'm doing trivially wrong here (like assuming that EdgeTess[0] is correctly assumed to be edge 0-1, rather than edge 2->0 for instance ? - its a wild guess..

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

For the record - the cracks were appearing becasue I got the index of the ptEdgeTess assignment wrong. The correct code is;

pt.EdgeTess[2] = CalcTessFactor(e0);
pt.EdgeTess[0] = CalcTessFactor(e1);
pt.EdgeTess[1] = CalcTessFactor(e2);
\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .