Game Development Community

Funky Light Colours

by Mark Dynna · in Torque Game Engine Advanced · 08/01/2007 (11:02 pm) · 9 replies

We're having a couple cases now where our player changes into strange colours when inside of interiors. In one model the character turns pink, but it's subtle and not so bad.
www.visionsdev.com/images/Mark/PinkShadow.jpg
However, in another model the character turns bright green (The Hulk!):
www.visionsdev.com/images/Mark/GreenShadow.jpg
The only unusual thing I can think of about these DIF's is that they have been scaled up significantly (about 5x in each dimension). This was done because of limitations in map2dif's brush sizes (so I'm told). Perhaps these problems will go away when we are able to export from Constructor directly into TGEA. Until we can test that case, this looks like a lighting problem to me.

#1
08/02/2007 (3:04 am)
I've also noticed this problem with DIFs as well. Especially the "Green Hulk".. and I've seen other character colors like "Purple" or "Pink". Searched everywhere for a fix but just don't see it.
#2
08/02/2007 (3:28 am)
And I thought I had placed some kind of phantom light somewhere in the scene when exporting from CS4 through TorquePipeline ... but seems like there is something else then.

What I found out is that it only seems to happen if you do not have a light placed which affects the player.
#3
08/02/2007 (4:00 am)
Well that's one of the main problems with TGEA. Outdoor lighting is useless and broke. Perhaps if there really was outdoor lighting that properly lit terrain and difs as TGE 1.5.2 (and earlier versions) do, then we wouldn't have some of these issues.

It is annoying that these problems happen because then people in the game think there's somekind of special effect or something "meaningful" in those green & purple light areas.

It's a headache for post production. TGEA has had this problem for quite awhile now. They need to fix their lighting but we all know that they have other products that they feel are more important to work on right now. TGEA has already been bumped out of QA a couple times to make time available for other products. Doesn't make sense when TGEA is truly the gem.
#4
08/12/2007 (2:08 pm)
Are you seeing the problem on interiors that are not scaled? Also make sure you're using the latest map2dif for exporting.

Andy, TGEA is using the same lighting and shadowing system as TGE 1.5.2 (not including Atlas).
#5
08/13/2007 (11:18 am)
We've seen these as well in another project we contracted on. There would be certain areas in a map where suddenly the player would go green or purple like the image above. It wasn't a priority at the time to fix it, so i never looked into it myself.

If i were gonna figure it out i would run the game thru Pix for Windows and capture a frame when the character gets colored weird. You can then sift thru the DX calls and figure out what weird junk got passed into the shader.

I suspect that its a case where no lights are being setup and there is junk in the shader registers.
#6
08/13/2007 (11:31 am)
One piece of the lighting code that may not be taking scaling into account correctly is this:

bool SceneObject::getLightingAmbientColor(ColorF * col)

I'd try stubbing it out like so:

bool SceneObject::getLightingAmbientColor(ColorF* col)
{
return false;
}

or like this:

bool SceneObject::getLightingAmbientColor(ColorF* col)
{
*col.set(1.0f, 1.0f, 1.0f, 1.0f);
return true;
}

Let me know if that changes the behavior or not. Thanks!
#7
08/16/2007 (8:43 pm)
John:
The lighting problems did not manifest when the DIF was placed unscaled. I scaled it up x2 and the "Hulk lighting" issue appeared.

Brian:
I put this at the top of that function:
col->set(1.0f, 1.0f, 1.0f, 1.0f);
return true;
The problem with the green lighting went away.

So, I think we may have this narrowed down?
#8
08/16/2007 (9:03 pm)
I also found this quite funny:
//#if YOU_ARE_INSANE
#9
08/17/2007 (9:04 am)
Cool, thanks for testing that.

Scaling things has always brought out more bugs, I think support for scaling has improved quite a bit, but there are still spots in the engine where it creates problems (like here!).

Find this block of code:
bool found = true;
		  AtlasInstance2 *atlas = dynamic_cast<AtlasInstance2 *>(collision.object);
		  InteriorInstance *interior = dynamic_cast<InteriorInstance *>(collision.object);
		  TerrainBlock *terrain = dynamic_cast<TerrainBlock *>(collision.object);

and slap this after it:
VectorF scale = collision.object->getScale();          
        collision.point.convolveInverse(collision.object->getScale());

This is pretty old code, this bug probably existed within TGE for quite a while as well.

That ifdef is pretty funny. What that block of code is basically doing is simulating hemispherical lighting. It doesn't have the huge CPU hit you'd think it would have. I disabled it and didn't notice any drastic framerate change.

**EDIT: Changed to fix that actually compiles! ;) I tested it and it seemed to work here, let me know how it goes for you. Thanks!