Projected shadow on mesh ("old school" shadow like GTA III series)

Started by
3 comments, last by Krypt0n 14 years ago
Hi everyone! I'm wondering, for some time now, how is the best way to display projected shadow on top of mesh, like it was done in GTA III (also vice city and san andreas, and a lots of other game too). I know that for static geometry, shadows are just alpha masked textures drawn like any other object, but for dynamic object? For character, or car (or any other object), it seems to use an alpha masked texture, which is draw over the static mesh. What is the best way to compute this "planar" shadow mesh? I know how to project those fake shadow on a plane, but how to "cut" them so they fit just on top of triangle mesh? (I mean, how to do it "fast"). For example in GTA, if a car or a character, is on pavement/road edge, the shadow planes are cut along this edge. I think it needs some kind of spatial containers, to know which shadow receiver faces are where. But is it just to draw "enough" of those faces, whith computed UV coord to match the projected shadow texture (which can be a quad, or a circle, blur at edges)? Thank you! Pilo.
Advertisement
could you maybe provide a screenshot of the exact effect you want to achieve?
Here are 2 screenshots :

first screen
second screen

as you can see, the vertical face of the pavement are not shadowed. The texture used for those fake "shadows" can be found in game ressources file.

There are not stencil shadow, I think, as I can't see how to generate proper UV coord (and this way all face would be shadowed, which is not the case).

If you look close to the first screenshot, you can also that the shadow is drawn a little over the static geometry.

Thanks,

Pilo.

It looks almost billboarded to me with some approximation for height differences with the pavement.
That looks like blob shadows to me.
1.
Usually you use the bounding-box of the geometry that cast shadows to figure out what geometry it affects.
2. you pick the front-faces within the BB in respect to the light-source (in case of GTA3 it's probably always top-down) of the previous geometry to figure out on that faces to cast the blob. this way you avoid to see shadows on the backsides AND (and this is kind of the more important reason) you don't cast on objects on the wrong side of the player.
3. you move those faces slightly in the lightsource or player direction to avoid z-fighting artefacts (this leads to some artefacts like in the 1st screenshot)
4. you render that geometry with the blob projected and with alphablending (depending on your hardware, e.g. substractive)

This topic is closed to new replies.

Advertisement