Implementing order-independent transparency using dual depth peeling
In this recipe, we will implement dual depth peeling. The main idea behind this method is to peel two depth layers at the same time. This results in a much better performance with the same output, as dual depth peeling peels two layers at a time; one from the front and one from the back.
The code for this recipe is contained in the
How to do it…
The steps required to implement dual depth peeling are as follows:
- Create an FBO and attach six textures in all: two for storing the front buffer, two for storing the back buffer, and two for storing the depth buffer values.
glGenFramebuffers(1, &dualDepthFBOID); glGenTextures (2, texID); glGenTextures ...