Game Development Community

Shadows disappear when Object is offscreen...

by Clark Kromenaker · in Torque Game Engine · 02/02/2006 (5:27 pm) · 2 replies

Hi,

I've been doing some light work with the shadows to force shadows to come from point light sources and be dynamic for items and static objects and its come along quite nicely. The only problem I'm having now is that when an object casting a shadow is not in the camera's view, the shadow is not rendered.

Now, I realize that an extremely useful resource was just released fixing this very problem (with many others), and I will definitely use it later, but it is set up for 1.4 and my current project uses 1.3 with some customization that makes integration...difficult, so I'm sticking with 1.3. Also, I've already made changes to the shadow classes and light stuff, so I don't want to use ALL the changes included in the Shadow from Sceneobject resource, just the part about the shadows not disappearing. I've tried to integrate the right parts from the resource into my project with no success.

So, if possible, it would be great if someone could point me either to a solution for this, or the place in the code where it decides what shadows to render on-screen (if there is such a place).

#1
02/02/2006 (7:11 pm)
Normally, a shadow is rendered only when the object is rendered as well. However, dts objects are culled from the render tree when the center of their bounds is not on screen. You will need to somehow do an extended scan around the objects that should be rendered, and if they are offscreen, but their shadows would be on screen, have the appropriate portion of the shadow rendered.

Unfortunately, that's not really trivial, and off the top of my head I'm not sure how to do it myself. Let's see if anyone else has approached this problem before, and if not bump the thread in a day or two and I'll try to see what I can find out.
#2
02/03/2006 (11:56 am)
There's a resource regarding this. It is very recent, so it might still contain some bugs and glitches. Be prepared to hunt and kill bugs yourself, if needed:

www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=9643