Game Development Community

1.7.1/1.8-b1 ambient lighting bug

by Kirk Longendyke · in Torque Game Engine Advanced · 11/15/2008 (4:34 pm) · 1 replies

Another oddball case, though quite noticeable when you've tweaked with the sun color a bit: when outside, changing the ambient color of the sun inconsistently modulates light and shadow coloration(as seen when say, setting ambient to "0.0 0.0 0.0 0.0" for stark lighting contrasts/light debugging) . the fix for this one is:

sgLightManager.cpp:
void sgLightManager::setupLights(SceneObject *obj)
{
			if(outside)
			{
				light->mType = LightInfo::Vector;
				light->mDirection = sun->mDirection;
			}
			//else
			//{
				light->mColor = ambientColor * directionalFactor;
				light->mAmbient = ambientColor * ambientFactor;
			//}
}
to
void sgLightManager::setupLights(SceneObject *obj)
{
			if(outside)
			{
				light->mType = LightInfo::Vector;
				light->mDirection = sun->mDirection;
				light->mColor = sun->mColor;
				light->mAmbient = sun->mAmbient;
			}
			else
			{
				light->mColor = ambientColor * directionalFactor;
				light->mAmbient = ambientColor * ambientFactor;
			}
}