1
votes

I'm currently wrapping my head around how to efficiently render polygons within a vertex buffer in back-to-front order to get transparency working..

I got my vertex buffers and index buffers set up, doing glDrawElements rendering and everything works nicely except transparency cause i currently render in arbitrary (the order the objects were created) order..

I will later implement octree rendering, but this will only help in the overall vertex-buffer-rendering order (what vertex buffer to render first), but not the order WITHIN the vertex buffer..

The only thing I can think of is reorder my index buffers every time i do a camera position change, which feels terrible inefficient since i store around 65.000 vertexes per vbo (using a GLushort for the indexes to achieve an optimal vbo size of around 1-4MB)..

Is there a better way to order vertexes in the vertex buffer object (or better phrased the corresponding indexes in the index buffer object)?

1

1 Answers

1
votes

There are two methods for that (I have not used any of them myself though)

  1. Peeling (dual peeling) http://developer.download.nvidia.com/SDK/10/opengl/src/dual_depth_peeling/doc/DualDepthPeeling.pdf

  2. Stochastic Transparency http://www.cse.chalmers.se/~d00sint/StochasticTransparency_I3D2010.pdf

Also if your objects are convex peeling can be easily implemented by first drawing back faces and front faces (using GL_CULL_FACE and inverting normals for correct lighting in a shader)