PDA

View Full Version : Shadows.



MrShoe
05-31-2001, 09:21 PM
I would like to know how shadows are done in games. Surely it is not through the use of the stencil buffer, that yould be FAR too slow for multiple shadows. By looking at Half-Life, I am guessing simple LightMaps? Am I right? What other ways are there of doing efficient shadows?

Tim Stirling
06-01-2001, 12:36 AM
Do you mean dynamic or static shadows, static shadows are usualy just lightmaps and depening on the lighting equations the shadows should automaticly be made.
As for dynamic shadows, that is a whole different bucket of fish:
Using the stencil buffer is fast compared to most solutions.

Other solutions include shadow volumes which are slow

Or there is fake shadowing, i.e put a dark 'blob' lightmap under the player or whatever.

Just do a search you will find loads, check out flipcode for some good shadow tutorials

06-01-2001, 04:22 PM
If you are in 32 bit color depth do you get a 24 bit depth buffer and an 8 bit stencil buffer. In other words are the stencil for free.

It can be slow to compute the shadow volumes but the problem is not the stencil buffer.

Tim Stirling
06-01-2001, 11:44 PM
No the stencil buffer is seperate I think, 32bit color, 32 depth, 8 bit stencil * screen res = a lot of memory thats why 64 MB on a new gfx board is standard and at high res can leave little room for a large number of textures.

zed
06-02-2001, 01:03 PM
normally in 32bit colour u get 24bit depth + 8 bit stencil.
taken from the nv_packed_depth_stencil extension spec
>>Many OpenGL implementations have chosen to interleave the depth and
stencil buffers into one buffer, often with 24 bits of depth
precision and 8 bits of stencil data. 32 bits is more than is needed
for the depth buffer much of the time; a 24-bit depth buffer, on the
other hand, requires that reads and writes of depth data be unaligned
with respect to power-of-two boundaries. On the other hand, 8 bits
of stencil data is more than sufficient for most applications, so it
is only natural to pack the two buffers into a single buffer with
both depth and stencil data. OpenGL never provides direct access to
the buffers, so the OpenGL implementation can provide an interface to
applications where it appears the one merged buffer is composed of
two logical buffers.<<