Alternatives for terrain lighting.
by Jason Gossiaux · in Torque Game Engine · 11/21/2007 (8:42 pm) · 4 replies
In some of the day/night videos I see the terrain dynamically lighting (not shadowing) to reflect the sun/sky color. Is there flag somewhere to enable this?
My goal is to continue using lightmaps for buildings, but use dynamic lighting (not shadow generation) for the terrain. I wrote a scheduler to relight each interior object (and not the terrain) spaced over time so the player doesn't notice. I was hoping to do the same thing for the terrain, but it is eluding me thus far. I'd rather just settle for something good enough for now, and I'll come back to it later.
Thanks for any help you can give me with this. I'm hoping its something simple like the glLighting flag for interiors.
My goal is to continue using lightmaps for buildings, but use dynamic lighting (not shadow generation) for the terrain. I wrote a scheduler to relight each interior object (and not the terrain) spaced over time so the player doesn't notice. I was hoping to do the same thing for the terrain, but it is eluding me thus far. I'd rather just settle for something good enough for now, and I'll come back to it later.
Thanks for any help you can give me with this. I'm hoping its something simple like the glLighting flag for interiors.
About the author
#2
I'd seen it before on the TDN but it never occured to me that was with regards to the sun lightmap system... I thought it was just for user placed static lights :P
Since I am still digging through the engine code, maybe someone could answer this question for me. I noticed on the light editor there are different lighting models (torque old, torque advanced, inverse squared), and those models are also explained on the TDN. Why don't they appear to affect the sun shadowmap generation? I am assuming the sun object picks up a default lighting model and cannot have one easily applied to it?
I'll let you know what I find out.
11/24/2007 (1:06 pm)
I figured it out.. there was a flag though I am still trying to expose it via a script. It was hidden in the lighting toolbox on the mission editor. You can adjust the lighting quality (production, design and draft) as well as they inclusion of shadows, or not. I'd seen it before on the TDN but it never occured to me that was with regards to the sun lightmap system... I thought it was just for user placed static lights :P
Since I am still digging through the engine code, maybe someone could answer this question for me. I noticed on the light editor there are different lighting models (torque old, torque advanced, inverse squared), and those models are also explained on the TDN. Why don't they appear to affect the sun shadowmap generation? I am assuming the sun object picks up a default lighting model and cannot have one easily applied to it?
I'll let you know what I find out.
#3
11/27/2007 (11:15 pm)
The lighting models affect the currently selected light datablock (the one active in the datablock drop-down box). The sun uses a default lighting model, but isn't affected by it much - the models mainly differ in how distance attenuation falls off, but the sun is a constant intensity at all distances and doesn't falloff.
#4
In any case I think my new code will fix the problem. I save off the terrain lightmap and generate it in 8 partial runs. The 9th run blends the TGE and SG lightmaps. The 10th run applies the lightmap to the terrain. Then it starts all over.
So, you get a terrain lightmap update every minute with no perceivable hiccups or delays. The downside is time must be relatively slow ie. 1 RL minute = 1 hour IG time. Seeing as how this took over a week of engine rewriting, and how the existing Day/Night resources don't even appear to even touch this code - I assumed there was a much simpler way of doing it. Maybe the videos are fake?
11/28/2007 (9:27 am)
Yeah I was mostly confused with how the day/night packs were all causing the terrain (without shadows) to light up and darken and change color without doing an actual relight. Turning off shadows and using the lowest quality render still takes .5 seconds to relight the terrain - so I know they aren't doing that.In any case I think my new code will fix the problem. I save off the terrain lightmap and generate it in 8 partial runs. The 9th run blends the TGE and SG lightmaps. The 10th run applies the lightmap to the terrain. Then it starts all over.
So, you get a terrain lightmap update every minute with no perceivable hiccups or delays. The downside is time must be relatively slow ie. 1 RL minute = 1 hour IG time. Seeing as how this took over a week of engine rewriting, and how the existing Day/Night resources don't even appear to even touch this code - I assumed there was a much simpler way of doing it. Maybe the videos are fake?
Associate David Montgomery-Blake
David MontgomeryBlake