Shadows of billboards

Started by
6 comments, last by Zipster 16 years, 10 months ago
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.
Advertisement
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

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

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.
You can make two textures. One normal, and one that is fully black (shadow).
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.
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.
clb: At the end of 2012, the positions of jupiter, saturn, mercury, and deimos are aligned so as to cause a denormalized flush-to-zero bug when computing earth's gravitational force, slinging it to the sun.
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!
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.

This topic is closed to new replies.

Advertisement