Transparent shadow casters with 'Translucency Map'

Started by
2 comments, last by knarkowicz 9 years, 3 months ago

I am reading about 'translucency map' in crytek and related presentations, but I am not able to understand the concept. It is related to casting translucent shadows from things like particles to use along with a shadowmap. The slides is: http://www.crytek.com/download/Playing%20with%20Real-Time%20Shadows.pdf. The part is titled 'Shadows & Transparency'. I reproduce the information below:

"

For alpha blended shadow receivers
Forward passes to apply shadows
For transparent shadow casters(e.g. hair, smoke) we accumulate alpha values of the casters
Stored in a 8-bit render target

Translucency map generation:
Depth testing using depth buffer from a regular opaque shadow map to avoid back projection/leaking
Transparency alpha is accumulated only for objects that are not in “opaque” shadows
Alpha blended shadow generation pass to accumulate translucency alpha (sorted back to front)
In case of cascaded shadow maps, generate translucency map for each cascade
Shadow terms from shadow map and translucency map are both combined during deferred shadow passes with max() operation

"

I interpret this to mean you render/accumulate the alpha into the render target from the lights view using the shadowmap depth to fail occluded parts of the translucent shadow caster. Is anything written into the shadowmap from the alpha occluders? Then last line is talking about when you read the shadowmap, I think, and says that the max should be taken, but I do not understand why that would be useful and what the result is used for?

If anyone could help me to understand this concept would be appreciated. I have already implement shadowmaps in OpenGL/GLSL in deferred renderer for context. Thanks.

Advertisement

It's like a regular shadowmap with an extra twist.

If a pixel is not in shadow, it's not in shadow.

If a pixel is in shadow, you can look up the "transparent texture" to tell whether it's in transparent shadow or in opaque shadow, and what the transparent value should be.

StarCraft2 use a similar approach

http://developer.amd.com/wordpress/media/2013/01/Chapter05-Filion-StarCraftII.pdf section 5.8

Thank you. It is an informative article.

The starcraft approach has double depth information, as I read it, as well as the translucency color buffer. This presents many issues to me. The correctness of the translucent shadows is dependant on the position of the shadow reciever. The blended translucency is correct only if the reciever sits behind both casters. If it is between the casters the color will be incorrect.

Applying this thinking to the crytek approach, which I think only uses a single shadow depth and the alpha texture, I still do not see how it could be correct under most circumstances. If you don't write the depth of the translucent shadow caster then it is never correct. If you do write the depth of the translucent shadow caster then if something is occluded by both the translucent and an opaque shadow casters it will have the transparency applied erroniously.

The starcraft dual shadowmap approach sounds okay for very flat scenes, like in starcraft. Applying it to something like crysis scene, I am not so sure. Is my thinking getting close?

Crytek's approach has only one drawback - transparent surfaces can't cast shadows onto other transparent surfaces.

It works as follows:
1. Draw opaque surfaces into shadowmap
2. Clear translucency map to white
3. Draw translucents into translucency map with opaque shadow map as depth buffer and depth writes disabled
4. In order to apply shadows sample shadow map and translucency map. Shadow = Min(ShadowMapDepthTest, TranslucencyMap).

So if translucent shadow caster is behind the opaque one it will be discarded by the depth test. In other case it will modify translucency map, but it won't matter as depth test result will override this value during shadow evaluation.

This topic is closed to new replies.

Advertisement