Sign in to follow this  

Shadows of billboards

This topic is 3830 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

In my scene I have a tree object, I used a mesh for the trunk, and billboards with textures that have an alpha channel for the leaves. I have implmented code to do shadow volumns, which works fine for the trunk, but I'm not sure how to do the leaves. Since the leaves in reality are on a quad, I'm thinking the shadow will just show up as a square. Any ideas on how to get the complexity of the leaf texture to translate to the shadow? Thanks.

Share this post


Link to post
Share on other sites
I'm going to move this to GP&T where it's more suitable [smile]

As far as I'm aware, your exact scenario is one of the primary motivations in favour of shadow maps and away from shadow volumes.

The very nature of billboarding is moving a geometry-space "effect" to a texture-space "effect." You're still trying to use a geometry-space algorithm on a texture-space data source...

Maybe one of the GP&T crowd can suggest a work-around but I'd imagine the only hacks to get SV's working with billboards will defeat most of the advantages of using billboards in the first place [lol]

Maybe you could consider switching to SM's or look into some sort of hybrid approach?

hth
Jack

Share this post


Link to post
Share on other sites
I think you want to look into shadow maps for this... with standard shadow maps you can use alpha *testing*, and with variance shadow maps you can use alpha *blending*. Otherwise you just render your scene normally from the light's point of view.

Share this post


Link to post
Share on other sites
Well, if you don't need the shadow to be sharp, and if you are implementing DOT3 bumpmapping, you could try the following.

Make another quad which sits (or decals) "on the ground" under your tree, the "shadow quad". Compute the Ambient Occlusion for your (fully 3d, or just alpha tested) tree model for the quad beneath the tree. Save the ambient occlusion info as a DOT3 texture map, to be mapped on the "shadow quad". When you render that quad with your regular light source it will create a faux-shadow on the shadow quad (you will probably have to play with blending modes).

Just an idea, not tested.

Share this post


Link to post
Share on other sites
If you're feeling really adventurous and have an extreme desire to use shadow volumes (pulling a Carmack XD) I believe you could modify some of the components of your alg to return an shadow volume intersection polygon. Using this, you can then cull the polygon and then apply (via a projection/stencil of some sort) your alpha map. Should work visually, performance-wise I can't really vouch much. Speaking of Carmack, he did actually get this working in Doom 3 (caco teeth are what I'm thinking of in particular) so it is possible. Not that that's saying much or anything.

Share this post


Link to post
Share on other sites
The game Armed Assault uses stencil shadows but also has a way to handle the alpha'd textures on trees.

see:
armed assualt

I'm not sure how they do it, but it works a treat. Sorry not much help!

I imagine they're just using a projected texture for the trees, as self shadowing is not too important for the trees. As there's no magic bullet when it comes to shadow rendering, your best bet is to mix different shadow techniques which work best for the given situation.

ps. Armed Assault is an awesome game!

Share this post


Link to post
Share on other sites
You solve this problem by using alpha tested/blended shadow maps, like AndyTX said [smile] You can probably also switch to shadow maps for the rest of the geometry as well to get a uniform solution, depending on your exact needs.

Share this post


Link to post
Share on other sites

This topic is 3830 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.

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