shadows?

Blitz3D Forums/Blitz3D Programming/shadows?

SSS(Posted 2003) [#1]
i have implimented v. simple shadows in my game, just a sprite facing up towards my character, the problem is that my game revolves on blox and when you get to near an edge it floats over the edge, does anyone know anyway to deal with this


Madcap13(Posted 2003) [#2]
If by blox you mean a blocks in a 3d grid then theres a few
ways to handle that.
One weird way that comes to mind is this.
You have a white texture with a grey bit in the middle for
your shadow. And the texture is applied to a sprite that is
aligned to the box you are currently on. To make the shadow
move around on the box, you simply scroll the texture along
to fit the current position of the character on the box.
The main drawback with that would be the shadow only works
on one block at a time but with a bit of tinkering you
could set up two such shadows so it works on two boxes at a
time.... however that would still run into problems when
the character moves diagonally. but you could always just
have 4 shadows. That would solve everything.

Alternatively, there probably some sourcecode around for a
deformable shadow mesh that hugs the environment. I actually
remember running such a thing on my computer. I think it
was made by Norc. It was pretty cool actually. It was
probably on blitzcoder.


SSS(Posted 2003) [#3]
thanks, il try the first thing :)


cyberseth(Posted 2003) [#4]
If your "blox" are pickable then you can use LinePick. Extend a line downwards from the vertices of your player in the direction of the light, and use PickedX(),PickedY(),PickedZ() to find the coordinates where the line touches the floor or blox. Then use VertexCoords on your shadow mesh to position it at these coordinates.