A really easy way to do real-time shadows that is applicable for actual game use

Blitz3D Forums/Blitz3D Programming/A really easy way to do real-time shadows that is applicable for actual game use

It'll have to wait until I start exporting from CShop3. This is way easier to do when you are using brush geometry.

Think of a square-based pyramid with the apex at your light source, that is just wide enough to contain your object that is casting the shadow. You CAN calculate the change in height and width as a function of distance from the apex, pretty easily. For any distance from the camera, just consider a cross-section of the pyramid, and the edges represent UV values of 0 and 1. Then transform your 3D coordinate to 2D coordinates in that cross-section of space and assign UV coordinates based on its position relative to the 3D edges we designated as representing the extremes of the shadow area or UV area, 0 and 1.

What it will do:

Very fast pre-rendered (but moving) shadow maps on any CShop level, like a shadow of a rotating fan, being cast on a lot of surfaces at once.

Pretty fast dynamic shadows on level surfaces, like player shadows.

What it won't do:

Whole rooms cannot be dynamically lit. Only certain objects will cast shadows.

Although shadows can be cast on a polygonal model, it will be a bit slower, and should be used with care.

Objects cannot cast shadows on themselves.


This isn't hype or BS. This will definitely work. I'll put the source out once I have a good example.