Game Development Community

Interiorlight vs terrainlight

by Billy L · in Torque Game Engine · 08/07/2004 (3:42 am) · 9 replies

Hi all !

I have many darklevels in my game and i notised when you step up on a interior the models lights up abit moore compared to the terrain.
I tried this in head and its the same ,i placed a flat platform
and walked up on it and get same thing.
When the world is sunny it doesnt matter but i loose some feeling on the darker levels !

Any hints ?

-Billy

#1
08/07/2004 (6:37 am)
I've been dealing with a problem somewhat related to this. The function getLightingAmbientColor (found in sceneObject.cc) controls how players are lit when standing on terrain and interiors.

I could be completely off but the problem seems to be that getLightingAmbientColor uses vertex colors for interiors versus the actual color of the lightmap for terrains. The result is inconcistant player lighting.

My problem with getLightingAmbientColor is that it doesn't recognize animated lights (light_pulse, etc.). As an example, I placed a pulsing red light in one of my interiors. A portal was setup with the 'Ambient Light does not pass through' option. Once the player was inside the model was completely black despite the the room being colored red every X number of seconds.

The solution to both problems could (possibly) be changing the way getLightingAmbientColor reads interior colors. Instead of looking for vertex colors perhaps it could read the actual pixel color of the interior lightmap? I've been looking over the interior lightmap code (and how InteriorLMManager fits into the picture) but I'm not making much headway. Hopefully someone more knowledgable could verify if the idea described above is possible and give some pointers on how to go about implementing it.
#2
08/07/2004 (7:38 am)
Ye i hope some of the super coders see this and give some paths to the right code.
I look around in the code and see if i can find anything.
#3
08/11/2004 (8:40 pm)
Really, getAmbientColor needs to be rewritten. You could try making it fade more slowly, or average adjacent positions, or some other stuff like that.
#4
08/11/2004 (9:08 pm)
I managed to make some progress towards solving my problem with getLightingAmbientColor(). At the moment animated lights affect player color appropriately, atleast in theory.

There are quite a few problems with my 'tacked on' solution, though. For one, only the first registered light in an interior is used as I've yet to find a way of iterating through all of the registered lights. I've also not yet found a way of getting at all of the light info (position, direction and radius mainly). The result is a light with a 10 unit radius affects players 100 units away.
#5
08/12/2004 (8:19 am)
There should be a vector or just a buffer with the LightInfo in it. Or you could just query for nearby lights.
#6
08/16/2004 (12:33 pm)
@Ben & Chris

I have notised a really strange thing,the player shadow reverses when you step up on a interior.
If the shadow reverse does this mean the light source comes from wrong direction.
maybe this differns make this light error !

I tried this in stable 1_2_2 and todays Head and get the same thing.
#7
08/16/2004 (12:35 pm)
Yeah, that showed up a while ago. Not sure what causes it, but it seems like the light is coming from a fixed direction on interiors and from the "sun" when on the terrain.

- Brett
#8
08/17/2004 (11:02 am)
I checked in a fix for that not too long ago - but after 1_2_2, I think. Have you tried with HEAD?
#9
08/17/2004 (11:55 am)
@Ben
In version 1_2_0 the shadow is ok, but in yesterdays Head and 1_2_2 the shadow reverses !