PDA

View Full Version : Depth Peeling



Jose Ricardo
12-04-2009, 05:09 AM
Hi People,

I'm doing a research that I need to make depth peeling but not for sorting of transparency. I need it to get the boundary of the mesh at various depth levels, as done in http://http.developer.nvidia.com/GPUGems3/gpugems3_ch29.html. (http://http.developer.nvidia.com/GPUGems3/gpugems3_ch29.html) So, does someone knows how can I save various layers of my depth and steeping in a predefined value? For example, each iteration my depth buffer is compared to the earlier depth buffer + 5.

Thanks a lot!

scagja
12-05-2009, 04:47 AM
Maybe you are searching for a pre-processing depth peeling step . The result is stored by using high precision textures.
So, i suggest you to read this paper:
Real-Time Volumetric Tests Using Layered Depth Images.

But, if you'd like to take a look at state of the art real-time depth peeling techniques, you should read these papers:

2001 - Interactive Order-Independent Transparency : (Front2Back Peeling)
2006 - Multi-Layer Depth Peeling via Fragment Sort : (MRT)
2007 - Multi-Fragment Effects on the GPU using the k-Buffer :(MRT)
2008 - Order Independent Transparency with Dual Depth Peeling : (Dual Peeling)
2009 - Efficient Depth Peeling via Bucket Sort :(MRT)

You may find opengl/glsl source code for some of these algorithms...

Jose Ricardo
12-07-2009, 12:44 PM
Hi scagja,

Thanks a lot for your reply! Some of the papers that you suggested me I've already ready but some others was very helpfull.

In my case, I'm doing a test in fragment shader with the following code:


void main()
{
if (gl_FragCoord.z < 0.5)
discard;

gl_FragColor = gl_Color;
}


With this code, I will only seen half of my object (moreless due the zbuffer imprecision) right?

Thanks!

scagja
12-14-2009, 04:43 AM
Sorry for the delay...





if (gl_FragCoord.z < 0.5) discard;

With this code, I will only seen half of my object (moreless due the zbuffer imprecision) right?


Not for sure...Discarding depths less than 0.5 doesn't mean that you will clip half of your object. It is possible to clip the entire object or no part of it. It depends on the initialization of the Znear and Zfar attributes and the position of the camera. For example, you will get different rendering results by zooming in/out the camera using this code.