Generating Barycentric Coordinates similar to hardware tesselation ?

Started by
1 comment, last by cippyboy 9 years, 4 months ago

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.

Relative Games - My apps

Advertisement

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 smile.png ) 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.

http://www.opengl.org/registry/specs/ARB/tessellation_shader.txt

Relative Games - My apps

I recently added Instanced tesselation to my app, Relative Benchmark for iOS under OpenGL ES 3 : https://itunes.apple.com/us/app/relative-benchmark/id560637086?mt=8

Relative Games - My apps

This topic is closed to new replies.

Advertisement