Jump to content
  • Advertisement
Sign in to follow this  
multisample

deferred shadows

This topic is 3985 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So, I've seen a lot of interesting info out that briefly discuss using deferred shadowing (Unreal, Crysis etc). But most of them stop short in discussing alpha blended objects. How do they handle them ? Are they just ignoring them and letting them sample the opaque shadow values ? Or are they writing special shadow versions (which means keeping the shadow maps around). Other ideas ? Any other descriptions (most of it online is quite vague).

Share this post


Link to post
Share on other sites
Advertisement
Hmm, thats a good question. Your right though, they dont talk about how they handle transparent objects anywhere (that I know of). My guess is that they either ignore shadowing transparent objects all together, or simple render transparent objects the "traditional" way. I cant think of any way that they coudl integrate deferred shadowing and transparent objects.

Edit:

I did a quick little test in sandbox2 (crysis editor) and it seems that for all the transparent objects I tried, they simply didn't get shadowed.

I guess I hadnt noticed it before since they dont use a whole lot of transparent objects in crysis; so I guess as long as you dont have too many, im guessing that most people wont notice that they arent shadowed. Though if you really need shadowing on them, you could do it the standard way

Share this post


Link to post
Share on other sites
I'm pretty sure that killzone2 does transparent objects in a quick'n'dirty (i.e. no shadowing) forward-shading pass after all of the deferred passes.

You can achieve a perfect deferred shading system with transparency by using order independent transparency, but I don't think anyone (games companies) has implemented it yet as it is way too slow...

Share this post


Link to post
Share on other sites


Yeah, I was guessing that they probably didn't shadow them. Most things I have read have either skipped the topic, or just said it doesn't quite work. I am still interested on what different solutions those that use it attempt. Anyone else using it, please chime in.

I just tested deferred CSM and found that in most cases using the computed opaque shadow value for the transparent objects works (particles not included, i don't usually shadow those directly anyways due to perf costs).

Of course this depends on how you create your transparent objects. If they are just a layer just above or in front of an opaque surface, it seems they will probably shadow correctly. If its not, then it will be wrong. I guess you could specify it per material to allow it to use the shadow value or not.

The traditional way for blended is still an option, but I think it defeats the main reasons for the technique (simplified main shaders, independent shadow sampling, reduced shadow buffer memory if buffer reuse is an option).

Share this post


Link to post
Share on other sites
so we are talking about deferred shadows or deferred rendering systems? One is independent from the other and when I used the term deferred shadows I meant a shadow system that renders into a shadow mask or a shadow collector (like in Crysis, Killzone 2, GTA etc.).
The this image is used to render all objects. You traditionally do not want transparent objects to cast shadows :-) ... otherwise they would not be transparent. If you want this, you have to do a lot more to make transparent shadow maps to work. Just google for the term.

Most AAA titles now use Cascaded Shadow Maps :-)

Share this post


Link to post
Share on other sites
Quote:
Original post by Hodgman
I'm pretty sure that killzone2 does transparent objects in a quick'n'dirty (i.e. no shadowing) forward-shading pass after all of the deferred passes.


Yeah, it does (or at least did, at the time the presentation was written).

Share this post


Link to post
Share on other sites
> so we are talking about deferred shadows or deferred rendering systems? One is independent from the other an

Sorry, I guess I wasn't clear enough.

Yes, I was talking about deferred shadows and NOT transparent shadow maps and the like. And obviously you don't want translucent objects to cast shadows in standard shadow mapping.

But I usually want them to receive shadows. In my forward rendering system, translucent objects receive shadows with the exception of particles. So if I have a glass window lit by the sun, it will get proper shadows from opaque shadow casters.

But what happens when I use a deferred shadow mask/collector. The mask can only contain the result for the opaque objects, as the zpass depth has only opaque depths.

So my question is, what do developers use in this case ?

1) No shadow received on translucent objects (ignore shadow mask, shadowAtten=1)

2) Use the shadow mask that was calculated for the opaque object behind it.

3) Mix of 1 and 2 (let the artist choose per material instance).

4) Use actual/original shadow map (defeats some of the purpose and benefits and couples shadow sampling back into shader for translucents).

5) Other... ???


I tested #2 and its generally pretty good based on the type of translucent object. ie if its just a layer above an opaque object, it works well. For other items, not so good. So I wonder if #3 is a reasonable option.



wolf: I assume a shadow collector is the same as a shadow mask ? As this terminology is not really documented, I would like to know for sure.



As per CSM:
Yeah, it seems its the way to go for large range lights. I am using it for directional light across a city. Only issue I had is not using an array index in the shader for calculating the right uv inside the atlas, because certain hardware turns indexing into gobs of cmp instructions.

Share this post


Link to post
Share on other sites
Quote:
As this terminology is not really documented, I would like to know for sure.
It is documented in a ShaderX5 article called "Cascaded Shadow Maps". Yes it is the same. For example, it is usually a 8:8:8:8 texture keeping a shadow term for the outdoor shadows in one channel, the cloud shadows in another channel and the indoor shadows in a third channel. Then you can give each of those different colors in your object shader or just do a multiply like this

dot(ShadowTexel, 0.25f);

1)

Share this post


Link to post
Share on other sites

Doh, I have ShaderX5 (I used it as a reference for CSM, good article btw), but I guess I missed the shadow mask/collector terminology. I thought I remembered the book discussing it, but not actually naming it. My bad.

BTW, thanks for the response. I probably owe you a beer by now.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!