Shadows computed incorrectly
by Chris \"Hobbiticus\" Weiland · in Torque Game Engine · 03/27/2003 (12:21 pm) · 6 replies
Line 2495 of shapeBase.cc reads:
Point3F lightDir(0.57f,0.57f,-0.57f);
which is in the shadow generation function. So the shadow is NEVER computed correctly unless that is the real light direction. If you change the sun direction, the shadow never moves.
Just thought y'all would like to know
Point3F lightDir(0.57f,0.57f,-0.57f);
which is in the shadow generation function. So the shadow is NEVER computed correctly unless that is the real light direction. If you change the sun direction, the shadow never moves.
Just thought y'all would like to know
#2
04/07/2003 (3:18 pm)
change that to:LightManager * lManager = gClientSceneGraph->getLightManager(); LightInfoList mLights; mLights.clear(); lManager->getLights(mLights); AssertFatal(mLights.size(), "No lights available!"); VectorF lightDir = mLights[0]->mDirection;and you should be good to go.
#3
04/07/2003 (4:04 pm)
Well, you're assuming that light 0 is always the sunlight. It is currently, but only because nothing's registering a light before it when the scene graph is traversed. That could potentially change, so watch out!
#4
04/07/2003 (6:08 pm)
You could call getBestLights() with the shape's bounding box and use that instead.
#5
04/08/2003 (1:05 pm)
actually, that's exactly how sceneRender works - it assumes the sun is 0, so if something changes, the whole engine goes to hell :)
#6
It struck me as the proper thing to do to add to the API to grab the sunlight direction, and that's what I did when I needed it.
04/08/2003 (1:09 pm)
Hmm. I didn't notice any explicit assumptions of that sort, but then I didn't look exteremly hard. Do you remember where I might find an example of such?It struck me as the proper thing to do to add to the API to grab the sunlight direction, and that's what I did when I needed it.
Torque 3D Owner Daniel Eden