# OpenGL Generating Barycentric Coordinates similar to hardware tesselation ?

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

## Recommended Posts

I was thinking about a way to do tessellation under OpenGL ES 3 using instancing. What I thought about doing is store 3 times the vertex data per vertex ( the 3 constituent vertices of a triangle, while ofcourse giving up on indexing ) and then set up a uniform block with the barycentric coordinates and using instancing I could render 3*n triangles per each original triangle and then interpolate for their final values. This will later on be coupled with vertex shader texture sampling into a depth map. This all sounds good in theory but I'm wondering if there is already out there a library of some sort to give me an n-complexity set of barycentric coordinates for sub-triangles. Like n=1 (instance) would result in 1,0,0 - 0,1,0 - 0,0,1 or the original triangle. n=3(instances) would create a vertex inside the triangle and the 3 related sub-triangles. I know GL4+ hardware does this, I'm looking for some already written code that does this, if you happen to know.

Edited by cippyboy

##### Share on other sites

If anyone stumbles upon this, I figured out where to get the barycentric coordinates from, GL 4.0 tesselation factors (more specifically I wrote the values out with a shader storage buffer ) but there's a small caveat, you don't get indices for those barycentric coordinates. So like you get 7 sets of coordinates but there's 6 triangles involved (for level 2). I'll probably write my own barycentric generator and the related indices to go along with it. I also switched the technique a bit to get vertex data from uniform buffers, the small problem here is that you're limited to around 1024 vertices in a uniform buffer, but those are the initial vertices anyway, the tessellated mesh will have that times the number of instances, so in theory you can get to high numbers pretty fast.

UPDATE : Section 2.X.2.1 of the ARB_tesselation_shader spec seems to go in detail about those coordinates.

Edited by cippyboy

• 13
• 18
• 29
• 11
• 27