Cheap shadows

Posts: 184
Joined: 2004.07
Post: #1
Hi all,
I have been working on my uDG project, and I've been playing around a bit with jumping in 3d- though I've been playing video games a lot time, it's become a lot more obvious to me that it really helps to have a shadow to see where you are.

Now, I'm a graphics person myself, so I know a bunch of expensive ways to do shadows (shadow volumes, shadow buffers, shadow maps) though what I would like to do for uDG is a really simple, cheap way to do shadows that is mainly functional, but doesn't look too bad.

What comes most obviously to mind is just using a black circular texture, and just running a multiple pass on the geometry (or use multi-texturing.) The slowest way to do this would just render the entire visible part of the scenery (not going to bother with object->object shadows) again for each object I want to shadow. You could then speed this up by making some more geometry-ish trees so that you only draw the polys that the shadow will appear on and so forth, though again I am trying to do something simple so I get done in time.

You could do some tricks with the stencil buffer as well I think, though I would like to avoid using it, as I'm not sure how wide the hardware support for it is.

Anyone have any thoughts/ideas about doing cheap shadows that don't look too bad?
Quote this message in a reply
Posts: 72
Joined: 2006.10
Post: #2
If the number of planes the shadow is going to be projected on is limited, you can setup a projection matrix ( in the mathematical sense ) and simply draw the object casting the shadow another time in black. IIRC, the Red Book even has the complete equation for that matrix in one of the later chapters.

- Sohta
Quote this message in a reply
Posts: 328
Joined: 2002.04
Post: #3
Well, it is easiest to play when you have the shadow directly underneath you, as opposed to casting it at some angle. And when it is underneath you it doesn't need to be much more than a darkened circle. But that probably doesn't help you at all :-)
Quote this message in a reply
Post: #4
No time for more than a bit of code I wrote a while ago; probably has various dependencies on other files, and is Obj-C++, but should be reasonably helpful. IIRC it loads a heightmap from a TIFF and lets you add shadows and splatters which get drawn over the land. Probably not dreadfully efficient, and I'd certainly do some things differently if I was writing it now, but it might be helpful:
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Window drop shadows NelsonMandella 9 5,674 Mar 21, 2010 02:34 PM
Last Post: NelsonMandella
  Making 2D Stencil Shadows Soft metacollin 16 15,637 Jul 22, 2009 01:59 PM
Last Post: NelsonMandella
  softening 2d shadows NelsonMandella 5 4,646 May 19, 2009 04:19 AM
Last Post: Najdorf
  Real-Time Soft Shadows MarkJ 6 5,193 Feb 17, 2007 03:10 PM
Last Post: MarkJ
  Rendering 2D Shadows for Convex Shapes Nick 16 9,829 Nov 28, 2006 11:50 AM
Last Post: memon