Sign in to follow this  
b3rnd

Shadows and transparency

Recommended Posts

b3rnd    122
hi, i have been reading alot about shadowmapping/stencil shadows lately. There is still one thing that i dont understand. What are transparent shadows ? Where can i see transparent shadows in action ? How can i implement it ? b

Share this post


Link to post
Share on other sites
matches81    474
I might be wrong, but I always thought "transparent shadows" where the term used to describe when a shadowing technique supports casting shadows of transparent / semi-transparent objects, like dirty or even colored glass for example.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Quote:
Original post by matches81
I might be wrong, but I always thought "transparent shadows" where the term used to describe when a shadowing technique supports casting shadows of transparent / semi-transparent objects, like dirty or even colored glass for example.


that sounds good to me.. do you have any information about implementation details ?
i would like to add decent shadows to a little game engine. so far i have simple shadow maps, but i am not realy happy with it (aliasing). Now i think about implementing shadow volumes but im not sure if its possible to get "transparent shadows" with shadow volumes (stencil shadows).

b

Share this post


Link to post
Share on other sites
matches81    474
sry, I haven´t implemented any shadow technique yet personally. Only read theory (and loads of it) about it, so an answer from someone who already did transparent shadows (or any decent shadows at all) might be worth your time more than this one, but:
Getting transparent shadows with shadow volumes seems to be... rather unusual, at least I´ve never seen it done in a game. But I would think it should be possible to do so. You would most probably have to handle the shadow volume of transparent objects seperately and apply some sort of coloring to the shadows generated. Furthermore you would definitely get problems if you have something like church glass, with multiple colors or even a picture embedded. For that you would have to somehow project the texture of the transparent object onto the shadowed geometry.
For shadow maps: I´ve heard of something called "Deep Shadow Maps", which seems to be capable to realize transparent shadows, though I don´t know whether it´s efficient enough to be done in real-time. Furthermore I had read an article about doing transparent shadows with shadow maps, but that was quite a time ago and I don´t seem to remember where it was, sry.

Share this post


Link to post
Share on other sites
matches81    474
Yes, I think that was the one I saw, though I would have sworn that I read an article, not "only" watched a demo and looked through some source-code.
The only thing about the demo and the short description of the technique used that makes me wonder is: How does this work with multiple transparent objects?
According to the short description and the source I´ve seen, the application renders the color of a transparent object into the RGB channels of a texture, and the depth of opaque objects into the A channel. So after doing the depth pass it ends up with a texture containing the RGB lightcolor (white for opaque objects and the color of transparent objects) and an 8-bit depth buffer (containing only the depths of opaque objects) stored in the A channel.
Imagine a scene like that from the demo there, but with a second glass of that making. The second glass pane would receive shadows from the first one, and would again change the light color there, so no problem with that (at least it could work when multiplying the colors), the first opaque face receiving light through those 2 glass panes would receive the correct color.
But what light color would be used for the second glass pane itself, as it should be lit?
I assume that with the technique described at Humus3D the complete ray of light would be colored the same, from its source to the first opaque face it hits, as there is only one depth information stored, being that of the first opaque face hit by the ray. So my assumption is, that this only works correctly if there is only one transparent object intersecting the ray.

Share this post


Link to post
Share on other sites
Lopez    122
Transparent Shadows...

From lights point of view:
1. Calculate and store shadow matrix.
2. render depth of scene (excluding transparencies) to render target.
3. render depth and color of transparencies to render target.

From cameras point of view: PASS 02:

Dependant on how you render your shadows (i usually do it all in one pass);

after rendering your shadows with texture from (2),

render the color map dependant upon the transparencies depth value.

Share this post


Link to post
Share on other sites
matches81    474
Quote:
Original post by Lopez
Transparent Shadows...

From lights point of view:
1. Calculate and store shadow matrix.
2. render depth of scene (excluding transparencies) to render target.
3. render depth and color of transparencies to render target.

From cameras point of view: PASS 02:

Dependant on how you render your shadows (i usually do it all in one pass);

after rendering your shadows with texture from (2),

render the color map dependant upon the transparencies depth value.


So, how do you store color and depth for two transparent objects that occupy the same 'place' from the light´s point of view?

Share this post


Link to post
Share on other sites
JSoftware    318
Quote:
So, how do you store color and depth for two transparent objects that occupy the same 'place' from the light´s point of view?

I don't think that would be very possible while maintaining precision. Maybe deep shadow mapping is a solution but i haven't been able to find very much information on this

Personally i would just store color and depth information for the nearest transparent object and disconsider the second.

Share this post


Link to post
Share on other sites
matches81    474
This is the only paper about deep shadow maps that I´ve found so far, though I doubt that deep shadow maps are fast enough to compute in real-time:
http://graphics.stanford.edu/papers/deepshadows/

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this