questions for sswift about shadow system

Miscellaneous Forums/Content Creation Tools/questions for sswift about shadow system

I just got your email.

"If the answers to these questions are yes and no, respectively, how would you recommend I implement these optimizations in my game?"

What would I recoomend... hm... lemme see...

For the first one... disabling shadows outside the camera's view, you can't just disable the shadow if the object's bounding sphere is outside the camera view, because the shadow might be in the camera's view anyway.

But, based on how you know you will have lights set up in your game, you could fudge the radius of the object a bit. Pretend that a solider with a bounding sphere with a radius of 1 meter really has a bounding radius of say, 3 meters. Then dtermine if this 3 meter wide sphere centered on the solider is visible to the camera. I beleive that to do this you could use a pivot, set it's entityradius, and then use entityvisible. But if not, my clipping system in the code archives... which is also included with the shadow system will help you set up clipping planes for the camera view and has a function to determine if a sphere is in that. Of course if you do this, then a shadow cast onto a distant wall from an object behind the camera may not show up. But that probably wouldn't look good anyway.


As for the second, I already suggested a method to deal with that. If you want to fade the shadows out... well, that'd be kinda difficult, but if you want to do it, the secret would be to add to the vertex color when the shadow mesh is built at the end of the shadow update function. If you take that color, and add increasing shades of grey to it, the shadow will fade out. It's basically how ambient works but that affects all shadows.


And you didn't ask, but the best way to improve the speed of the system is to split your level up into rooms and turn off those rooms the player is not near and/or can't see as receivers. And make parts of rooms that don't need shadows seperate objects so you can keep those polygons fom being receivers. Like if you have a detailed thing hanging from the ceiling, make that a seprate object. Don't need shadows there probably. And railings. But if you do want things to receive shadows, at the very least try to find areas of high detail that fit in a cube and make that a seperate object. Like if you did have a detailed railing running all around a room, try to split it into smaller sections... each section can be culled with a simple sphere test and get rid of all those polygons in one fell swoop.