Game Development Community

Shaows cast onto bounding box.

by Tod Frye · in Torque Game Engine · 07/23/2008 (3:54 pm) · 2 replies

I am having the hardest time figuring out the details of how shadows work.

my player is casting a shadow. it shows up on the terrain just fine.

but it doesn't cast a shadow on a .dts, but sometimes a shadow poly is drawn on the .dts's bounding box.

how does all this work?

thanks

#1
07/23/2008 (5:12 pm)
Alright, let me try and explain since I just worked all this out myself :P

The player casts a player shadow that is different from the shadows DTS shapes cast. To have DTS shapes cast shadows like the player you need to set

shadowEnable = true;
shadowCanMove = true;
shadowCanAnimate = true;

genericShadowLevel = Item_GenericShadowLevel;
noShadowLevel = Player_NoShadowLevel;


In the Shapebaseclass in the source

Then they'll have animated shadows like the player.

Enabling shadowing on other DTS objects is currently not very easy to do. There was a resource I had followed and it let the player cast shadows onto other DTS shapes. However, combined with the DTS shadowing I described above, odd results occured. The player would receive a shadow on its bounding box which looked funky. Objects would self-shadow resulting in dark spots everywhere...

All this info is for TGE since you didn't specify, so its possible TGEA has fixed some of the issues. Good luck with it all!
#2
07/23/2008 (7:28 pm)
One thing I forgot... there is a bug in the source you need to fix in order for the shadow casting to not get all messed up if you use collision meshes.

[code]

S32 TSShapeInstance::getCurrentDetail()
{
return 0;//mCurrentDetailLevel; //shadow collision mesh fix
}

[code]

You need to make that change otherwise you'll get odd shadowing of the DTS shapes.