Shadow angles different for AIPlayers?
by D Robinson · in Torque Game Engine · 10/18/2007 (3:15 pm) · 3 replies
I've been having a problem with shadows. Basically, all AIPlayers in the scene cast shadows correctly (i.e. the shadows cast from the sun seem to be cast into the correct position) but other DTS objects in the scene do NOT cast the shadows correctly. The incorrect shadows are acting as if the sun is much higher in the sky than it really is, thus making the shadows shorter than they should be.
This is using standard Torque 1.5.2 -- no source code modification at all. Check out a screenshot here:
http://technoforge.ca/images/TruckShadows.jpg
The truck on the left is a StaticShape, while the truck on the right is a Vehicle. They both use the same model, and there is only the sun as a lightsource in the scene (elevation 45, azumuth 45).
Any explanations?
This is using standard Torque 1.5.2 -- no source code modification at all. Check out a screenshot here:
http://technoforge.ca/images/TruckShadows.jpg
The truck on the left is a StaticShape, while the truck on the right is a Vehicle. They both use the same model, and there is only the sun as a lightsource in the scene (elevation 45, azumuth 45).
Any explanations?
About the author
#2
There's a shadow optimization that skips shadow recalculation on StaticShapes during the mission. If the problem only happens while editing the mission, you'll be in good shape when playing the game (after a fresh mission load). If the problem always occurs then try setting shadowCanMove to true in the StaticShape constructor (this allows regular recalculation of the object shadows, but at a performance cost).
11/01/2007 (2:35 am)
Does this occur when starting the mission or after changing the sun's properties?There's a shadow optimization that skips shadow recalculation on StaticShapes during the mission. If the problem only happens while editing the mission, you'll be in good shape when playing the game (after a fresh mission load). If the problem always occurs then try setting shadowCanMove to true in the StaticShape constructor (this allows regular recalculation of the object shadows, but at a performance cost).
#3
Fortunately, though, what you said CAN fix the problem. Thanks! Unfortunately, though, even if I set shadowCanMove = true in all of the constructors & ensure that it's not overridden somewhere in the datablocks, it doesn't work. It only seems to work if I hard-code the 'move' parameter to sgObjectShadows::sgRender().
At least this gives me some leads... Perhaps I can force a 'flush' of all shadow objects somehow and force them to re-calculate only when needed.
Thanks again!
--
David
11/01/2007 (3:49 pm)
Unfortunately this happens all of the time right from the start of the mission, and the sun or object positions are not updated at all since their creation.Fortunately, though, what you said CAN fix the problem. Thanks! Unfortunately, though, even if I set shadowCanMove = true in all of the constructors & ensure that it's not overridden somewhere in the datablocks, it doesn't work. It only seems to work if I hard-code the 'move' parameter to sgObjectShadows::sgRender().
At least this gives me some leads... Perhaps I can force a 'flush' of all shadow objects somehow and force them to re-calculate only when needed.
Thanks again!
--
David
D Robinson
Default Studio Name