# trying to implement Bézier triangle patches

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

## Recommended Posts

I need some advice on implementing bezier triangle patches.

First question.

Do I pump in only 3 vertices for the triangle or 10 vertices to my vertex shader. Or do I make the control points in the shader

ex...a triangle with 10 vertices

And second...what are some extra ideas about implementing Triangle np ...Will I have to find the berstein and derivative of berstein and implement on a surface sum for normal and  for the Bezier curve??what would be the degree?

Edited by terryeverlast

##### Share on other sites

I assume you are asking about DirectX 11 tesslation. Since I do not have much time right now for long posts, here is a relatively good introductory material, which you might find useful: Direct3D 11 Tutorial: Tessellation. Hope this helps.  :)

Edited by vanka78bg

##### Share on other sites

Yes, you can send all 10 control points through your vertex shader and into your hull shader. In the most basic implementation, your hull shader will set some tesselation factors and spit out the control points again.

In your domain shader, you'll have access to all the points your hull shader output along with a SV_DomainLocation value that you can use to output an evaluated point on your surface. You can use this to perform whatever evaluation you want.

Alternatively you could store your control points in a different data structure -- you're not strictly tied to keeping them in a vertex buffer. For instance, you might put them in a texture or buffer and sample them in your hull shader perhaps. But processing control points as vertex data is the most simple.

Edited by Dingleberry

##### Share on other sites

I can do a berzier curve on a rectangle by summing up all the points in the domain shader in this order...

float3 CubicBezierSum(const OutputPatch<HullOut, 16> bezpatch, float4 basisU, float4 basisV)
{
float3 sum = float3(0.0f, 0.0f, 0.0f);
sum  = basisV.x * (basisU.x*bezpatch[0].PosL  + basisU.y*bezpatch[1].PosL  + basisU.z*bezpatch[2].PosL  + basisU.w*bezpatch[3].PosL );
sum += basisV.y * (basisU.x*bezpatch[4].PosL  + basisU.y*bezpatch[5].PosL  + basisU.z*bezpatch[6].PosL  + basisU.w*bezpatch[7].PosL );
sum += basisV.z * (basisU.x*bezpatch[8].PosL  + basisU.y*bezpatch[9].PosL  + basisU.z*bezpatch[10].PosL + basisU.w*bezpatch[11].PosL);
sum += basisV.w * (basisU.x*bezpatch[12].PosL + basisU.y*bezpatch[13].PosL + basisU.z*bezpatch[14].PosL + basisU.w*bezpatch[15].PosL);

return sum;
}

Edited by terryeverlast

##### Share on other sites

If i submit 10 points into the vertex shader for a Triangle, how would i put the triangle together in the domain shader to make it a perfect triangle. What would be the order of control points. The post above is the order for a rectangle. I need a triangle order..

Edited by terryeverlast

1. 1
2. 2
3. 3
Rutin
12
4. 4
5. 5
• ### Forum Statistics

• Total Topics
633695
• Total Posts
3013382
×