How do shadows work

Blitz3D Forums/Blitz3D Programming/How do shadows work

Spy(Posted 2004) [#1]
hey..
i was wondering about the theory behind the shadows.. how do they work ? how do u make them and project them.. no code just the theory...


Beaker(Posted 2004) [#2]
Realtime or rendered?
Dynamic or pre-rendered (lightmaps) ?

There are many, many ways to do shadows, so you must be more specific.


N(Posted 2004) [#3]
I doubt this is useful, but here's a shortened theory from a conversation I had with one of the programmers on Bioscythe...


[ 11:57:19 pm ] <fenris> just load a projection * modelview matrix from the light's point of view in there*** and render the projective texture recievers as normal
[ 11:58:00 pm ] <fenris>fyou can do projective shadows that way :) providing you have some way of rendering to a texture
[ 11:58:13 pm ] <fenris>be it rendering to the framebuffer and copying the results to a texture



***The texture matrix.

As I said, I doubt this'll be useful, but I'm putting it here any way for the sake of trying to help.


Spy(Posted 2004) [#4]
hmm.. well realtime for games.. not those "blob" shadows.. which look like "circles" under the character ..
i wonder how do u make/produce them in a game..


Ross C(Posted 2004) [#5]
One way is to set the camera at the same position as the light source, and point the camera at the entity you want a shadow on.

Set the ambientlight to zero, and hide all lights and other entities (except the one you want a shadow on, then set the camera cls colour to white.

Then do a renderworld, and copy this to a texture. Unhide everything and set the ambient lighting back to normal, and the camera cls colour back to what it was, use the texture you just rendered for the shadow.

You need to use a certain texturefilter on it tho, so the white disappears, and the black remains as the shadow. Then simply renderworld again.

You might not want to do this every frame though, because it's slow copying frame VideoRam like this.


ChrML(Posted 2004) [#6]
There is one bad thing with doing it "not-every-frame". It gives the impression of "half-lagging".