Order Indep. Transparency & Depth_replace

I’ve been looking at the Order Independent Transparency paper by Cass Everitt, from the Nvidia site. The idea is to peel away layers by using a shadow map to drop fragments that are too close, while using the regular ZBuffer to make sure that only the closest fragment passing the shadow test affects RGB.

What I can’t figure out is how depth_replace fits into the picture. The straightforward way to do the peeling seems to be, move xyzw into strq and set texture matrix == projection * modelview. At what point would one want to change the rendered fragment’s Z ??

I must be missing something

Hi bpeers,

On NV2x hardware depth_replace was required for depth invariance. So that peeling matched exactly.

On NV3x (GeForce FX) depth replace is not required.

Thanks -
Cass

Where can I download a demo (w/src if possible) of this effect?

Hi Cass,

thanks for the update !

Do you mean that with NV2x, the final s,t is not accurate enough to access eg a 1024x1024 map with some certainty that you’re grabbing the right pixel ?
I can see how depth_replace helps with this, but I’m still not sure how you’d route the resulting Z to the shadowmap side of the comparison, and not the fragment side…?

Thanks !
bert

You use the shadow mapping functionality to compare a depth component (from a texture) to a texture coordinate (generated such that R=Z). However, texture coordinates are interpolated differently from depth. Depth is interpolated linearly, whereas texture coordinates are interpolated with perspective correction. See section 3.4.1 of the spec.

This means that your shadow map depths and your texture coordinate depths are not necessarily the same after interpolation, so your depth comparison is hosed. To get around this, depth replace can be used to override the linearly interpolated depth values with perspective-corrected values. Only then can you perform a meaningful depth comparison to do your depth peeling.

– Tom

Right - what Tom said.

Also, On GeForceFX, you depth peel by doing

TEX R0, f[WPOS], TEX0, RECT;

And f[WPOS] is interpolated such that it is invariant with fixed-function depth.

Thanks -
Cass

Wouldn’t you know, I think the fog is starting to clear

Thanks guys !

bert