I'm making a voxel game and it looks quite good but then i thought of special blocks like minecrafts grass leaf blocks, and translucent water. I had the idea for the grass blocks to put them in a seperate VAO and render them after the blocks because they might look like an X from above.

How could you do water? I know you could enable blending in OpenGL and render from back to front and you could sort their distances each frame with a map.

My problem is how to render all of these waters, I could use instanced rendering but then i would have to update the buffers every time the player moved or i could draw them all individually but that would involve thousands of draw calls ex. 8000 draw calls for 20*20*20 blocks (each draw call sends a whole cube)

what would be a fast method of doing this?

up vote 0 down vote accepted

A solution to rendering transparent objects without resorting by distance all of the time would be to use order independent transparency. Disable depth writing and change the blend mode to add the fragment colour to the current colour. glBlendFunc(GL_ONE, GL_ONE) also I would make sure that only the visible faces of the voxels are rendered so you don't see extra sides underwater. This is an easy method that makes pretty good transparent water without much complexity.

see more about order independent transparency

http://www.openglsuperbible.com/2013/08/20/is-order-independent-transparency-really-necessary/

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.