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 enter image description here

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"


1 Answer 1


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)

    (there are 10)
  • Set vertex buffer
  • Set shaders
  • 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

An example hull shader snippet:

(patch constant function) TessFactors[] == 2 //split each control edge into two

Looks like this:

enter image description here

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

enter image description here

  • \$\begingroup\$ 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? \$\endgroup\$
    – terry
    Apr 17, 2016 at 14:36
  • \$\begingroup\$ 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). \$\endgroup\$
    – Jon
    Apr 17, 2016 at 14:44
  • \$\begingroup\$ so i need to sum up the control points in the domain shader, right? \$\endgroup\$
    – terry
    Apr 17, 2016 at 14:49
  • \$\begingroup\$ sum up the control points into a shape ike a triangle...right? \$\endgroup\$
    – terry
    Apr 17, 2016 at 14:57
  • \$\begingroup\$ 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. \$\endgroup\$
    – Jon
    Apr 17, 2016 at 14:57

You must log in to answer this question.

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