Game Development Community

Light Level

by Howard Dortch · in · 02/15/2005 (7:37 am) · 4 replies

I would like to get some sense of how much light is striking an object like my player. Not sure if your sg code does the lighting on objects or you pass the values to TGE and it does it.
Reason is I would like my bots to not see me if I'm in the shadows or near shadow. Can you think of a quick level check from player pos, light pos, dist, dot3 something like that. I think it would be a nice addition to let a script call get the info. Simple normalized value like if lightOnShape > 0.25 return true.
Thoughts?

#1
02/15/2005 (7:54 am)
Hi Howard,

Check out 'SceneObject::mLightingInfo::mLastColor' this contains the last ambient value the object received from the surrounding interior or terrain. Although this value won't include dynamic lights, it's far more efficient and will still provide reasonably accurate results.

-John
#2
04/06/2006 (12:28 pm)
Probably should move this to private forum?

I added a routine ColorF getLastColor() {return mLightingInfo.mLastColor;} but it only returns the values it was set with

mLastColor.set(0.5f, 0.5f, 0.5f);
#3
04/07/2006 (12:04 pm)
Hi Howard,

That should only happen when the object is not over an interior or terrain. Are these in your game?

-John
#4
04/07/2006 (6:13 pm)
Actually what I did was this.

ColorF SceneObject::getLastColor(void)
{
return mLightingInfo.smAmbientLight.mColor;
}

then wrote a console method to get the value from script, seems to work ok. I go in shadows or under a light in interiors etc and get variations enough to use.

Thanks John