Jump to content

  • Log In with Google      Sign In   
  • Create Account


Generating Barycentric Coordinates similar to hardware tesselation ?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Ciprian Stanciu   Members   -  Reputation: 206

Like
0Likes
Like

Posted 16 September 2013 - 06:30 PM

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, 16 September 2013 - 06:31 PM.

Relative Games - My apps


Sponsor:

#2 Ciprian Stanciu   Members   -  Reputation: 206

Like
0Likes
Like

Posted 02 October 2013 - 07:56 AM

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


Edited by cippyboy, 02 October 2013 - 03:53 PM.

Relative Games - My apps





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS