# The steps in implementing Bézier triangle patches

What are the steps in creating a Bézier triangle patches. What steps would you do in order to create this in directx 11?

Say I just input 3 vertices and create a simple triangle. Is this enough? Or should I create a triangle with 9 vertices, all of them in different heights so it would make a bumpy triangle, then I apply berstein's formulas and make them smooth. so I get like a smooth triangle, not all bumpy.

A triangle like

My book says Research and implement Bézier triangle patches.

Luna, Frank D. (2012-05-21). Introduction to 3D Game Programming with DirectX 11 (Kindle Location 11901). Mercury Learning and Information. Kindle Edition.

So what are the steps you would do in order to accomplish it? Please no "coulds"

Edit: The triangle's Bezier-curved edges are of the same order as the Bernstein you use; the edges of a third-order Bezier triangle are third-order Bezier curves. The order also determines the number of control points you need (or vice-versa). (Yes, a triangle with 3 vertices can be tessellated)

• Set topology to D3D11_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST
(there are 10)
• Set vertex buffer
• Draw(10);

10 vertices go into the vertex shader and (probably) come right out the other end:

void VS(inout float3 inputVertex) { }


These are fed into the hull shader which tells the GPU exactly how you intend to subdivide the patch. The hull shader sends the points it creates (and the input control points) to the domain shader. (a tessellated triangle)

The domain shader applies the Berstein polynomial to "Bezier" each input point. At this point, we are in "patch-space" using UV's to represent coordinates on the unit-[DOMAIN] (quad,tri,isoline). The pixel shader expects the inputs to be in clip-space, so the domain shader applies transformation instead of the vertex shader.

float4 DS(..., ..., ...) : SV_POSITION
{
//Bernstein
//Project
}


[domain("tri")]
[partitioning("integer")]
(patch constant function) TessFactors[] == 2 //split each control edge into two


Looks like this:

If you have trouble getting past tessellation to the Bernstein, try this first: (You can ignore "4"; the geometry shader just makes it solid)

• So if i pump 10 vertices into the vertex shader, does it matter which order they are in? Just 10 points out of space, that form a triangle. Do they have to have indices because if they dont, they will be points. is this right? Apr 17, 2016 at 14:36
• You must specify a domain for the hull shader to use; it is similar to how you specify TOPOLOGY_TRIANGLESTRIP to make the GPU treat input vertices as groups of 3 (triangles) - vertices (1,2,3) then (2,3,4). You can feed it whatever you want, but it's going to read them as consecutive vertices of a single primitive (including the original primitive and any subdivided primitives generated from it).
– Jon
Apr 17, 2016 at 14:44
• so i need to sum up the control points in the domain shader, right? Apr 17, 2016 at 14:49
• sum up the control points into a shape ike a triangle...right? Apr 17, 2016 at 14:57
• The domain shader only needs to take each input vertex (including the control points) and weight them according to the Bernstein. Since this all occurs on the unit-triangle, the UVW's specify an exact "starting" location for each vertex, which is modified by the Bernstein.
– Jon
Apr 17, 2016 at 14:57