Game Development Community

Lights went down when moving to 1.3

by Adib Murad · in Torque Game Engine · 08/25/2005 (8:48 pm) · 16 replies

Sorry if it's been said before. I had the lighting pack 1.2 integrated and working fine. Then I downloaded and installed TGE 1.3, unzipped LP 1.3 on it and compiled the demo project.

What I did next was just drop the new .EXE on my game's demo folder. If I run the old EXE the lights are vivid as ever. If I run the new one, the lights look very dim.

What happened from 1.2 to 1.3? Any changes on light intensities? I searched for something in the docs folder, but it looks outdated (showing only changes to 1.2).

When I hit F12 I notice the intensity and color values are the same, so I can't lift them up back to their former looks.

Any help?

#1
08/26/2005 (9:38 pm)
Hi Adib,

You don't need to download the TGE 1.3 source - the Lighting Pack (versions 1.3 and up) include all of the TGE source code in them. Try unzipping the Lighting Pack into a new directory and building it, then copying the generated exe into your project's demo folder.


"I searched for something in the docs folder, but it looks outdated (showing only changes to 1.2)"

While updating the docs for the 1.3 release, I mistakenly labeled the docs 1.2.

-John
#2
08/27/2005 (9:30 am)
Hey John,

Thanks for the heads up about the source code. It's been a while since I last updated both TGE and the Lighting Pack, so I probably missed a lot of info about the changes.

Well, it didn't work out (this time I tried 1.3.5 too). These two pics where taken from the exactly same demo, just replacing the EXE files.

Lighting Pack 1.2:
i3.photobucket.com/albums/y80/amurad/SGLP12.jpg
Lighting Pack 1.3 and 1.3.5:
i3.photobucket.com/albums/y80/amurad/SGLP13.jpg
You see? Looks like I lost the contrast, like I lost that nice overexposure effect. The only way I can make it brighter again is to raise the radius value of the light, lighting things I don't want to.

What happened from 1.2 to 1.3?
#3
08/27/2005 (4:29 pm)
I've never seen anything like that before. The light is dynamic right? That code definitely didn't change...

Sorry if I'm misunderstanding, but this happens in a fresh Lighting Pack 1.3 and 1.3.5 with no code changes? If so can you download the current Lighting Pack demo and see if the exe in the demo is as bright as your old exe or the 1.3/1.3.5 exe's.

Also is it possible that you altered the exposure level of your previous Lighting Pack, there's a macro defined in 'sgLighting.h' that allows you to set the exposure back to TGE's level or to increase the exposure even higher than the stock Lighting Pack.
#4
08/27/2005 (4:31 pm)
Btw: awesome artwork! :)
#5
08/27/2005 (8:54 pm)
Hehe, thanks!

Well, I dropped de LP demo executable on my demo folder. No luck. Copied my "data" and "server/scripts/sgLights" folders to the LP demo. No luck. Deleted one of the old light entity and created another one. Nothing. Made up a new datablock from scratch. Wrong again.

This is the datablock:

datablock sgUniversalStaticLightData(posteAmarelo) {
   className = "sgUniversalStaticLightData";
   LightOn = "1";
   Radius = "7";
   Brightness = "1";
   Colour = "1.000000 0.898039 0.501961 1.000000";
   FlareOn = "0";
   FlareTP = "1";
   FlareColour = "1.000000 1.000000 1.000000 1.000000";
   ConstantSizeOn = "0";
   ConstantSize = "1";
   NearSize = "3";
   FarSize = "0.5";
   NearDistance = "10";
   FarDistance = "30";
   FadeTime = "0.1";
   BlendMode = "0";
   AnimColour = "0";
   AnimBrightness = "0";
   AnimRadius = "0";
   AnimOffsets = "0";
   AnimRotation = "0";
   LinkFlare = "1";
   LinkFlareSize = "0";
   MinColour = "0.000000 0.000000 0.000000 1.000000";
   MaxColour = "1.000000 1.000000 1.000000 1.000000";
   MinBrightness = "0";
   MaxBrightness = "1";
   MinRadius = "0.1";
   MaxRadius = "20";
   StartOffset = "-5 0 0";
   EndOffset = "5 0 0";
   MinRotation = "0";
   MaxRotation = "359";
   SingleColourKeys = "1";
   RedKeys = "AZA";
   GreenKeys = "AZA";
   BlueKeys = "AZA";
   BrightnessKeys = "AZA";
   RadiusKeys = "AZA";
   OffsetKeys = "AZA";
   RotationKeys = "AZA";
   ColourTime = "5";
   BrightnessTime = "5";
   RadiusTime = "5";
   OffsetTime = "5";
   RotationTime = "5";
   LerpColour = "1";
   LerpBrightness = "1";
   LerpRadius = "1";
   LerpOffset = "1";
   LerpRotation = "1";
   StaticLight = "0";
   SpotLight = "0";
   SpotAngle = "1";
   AdvancedLightingModel = "0";
   EffectsDTSObjects = "1";
      receiveSunLight = "1";
};

The macros in sgLighting.h are probably these, right?

/// how much glare do we want (must be 1.0, 2.0, or 4.0)...
#define SG_LIGHTING_OVERBRIGHT_AMOUNT			2.0

// do not change...
/// this value resets Torque to a normal lighting value...
#define SG_LIGHTING_NORMAL_AMOUNT				1.0

Well, I tried to set the second to 0, tried to set the first to 4, everything made it too much bright.

Don't know what to do. I was trying to start clean again, making my changes on a clean new version, but it's unacceptable. The lighting pack I got was the one on the first pic, not the second.

Do you have any other idea, John?

Thanks
#6
08/27/2005 (10:51 pm)
I'll pull up the old code and take a look at it - is the building in the screen shots a DTS or DIF?
#7
08/28/2005 (1:23 am)
It's all a single DIF, the building and the street. Hope you can figure this out.

Take care.
#8
08/28/2005 (4:21 pm)
John, I just downloaded TGE 1.2.2 from GG CVS server. Do you have a link for the Lighting Pack 1.2? I can't find it here in my backups.

I'll rebuild 1.2 stuff and see if it works like before.
#9
08/28/2005 (5:07 pm)
Sure do - if you go to the GG Lighting Pack download page, right click on the link and select 'Copy link'. Past the link into the browser address bar and change the '1.3.5' to '1.1.5' (that's the TGE 1.2 Lighting Pack release).

I think Rick keeps all of the old product releases available on the GG site, which is very handy.

I'll let you know if I find anything different in the code.
#10
08/29/2005 (11:46 am)
There is a difference in version 1.1.5's (the version designed for TGE 1.2.x) rendering code for interior dynamic lights, but the difference is actually a bug that was in 1.1.5. The following changes should revert the code back to the 1.1.5 rendering style:

In the file "sgNewMethods.cc" line 604

Change:

Quote:
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, mLightFalloff->getGLName());

glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE);

glActiveTextureARB(GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_2D);
glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_COMBINE_EXT);

To:

Quote:
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, mLightFalloff->getGLName());

glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_COMBINE_EXT);

glTexEnvi(GL_TEXTURE_ENV,GL_COMBINE_RGB_EXT,GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV,GL_SOURCE0_RGB_EXT,GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV,GL_OPERAND0_RGB_EXT,GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV,GL_SOURCE1_RGB_EXT,GL_PREVIOUS_EXT);
glTexEnvi(GL_TEXTURE_ENV,GL_OPERAND1_RGB_EXT,GL_SRC_COLOR);

glTexEnvi(GL_TEXTURE_ENV,GL_COMBINE_ALPHA_EXT,GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV,GL_SOURCE0_ALPHA_EXT,GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV,GL_OPERAND0_ALPHA_EXT,GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV,GL_SOURCE1_ALPHA_EXT,GL_PREVIOUS_EXT);
glTexEnvi(GL_TEXTURE_ENV,GL_OPERAND1_ALPHA_EXT,GL_SRC_COLOR);


glActiveTextureARB(GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_2D);
glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_COMBINE_EXT);


I've placed the problem code in bold; basically what's happening is that the alpha operands are being set to illegal targets (alpha operands can only accept alpha targets) causing undefined results. On my machine both of the rendering modes look identical, however the results will vary from machine to machine, so even if this restores the previous lighting to your missions it won't work the same on every system.

Also this code was likely changed for compatibility with the DirectX driver (meaning that I don't remember fixing this bug so I could have accidentally fixed it while working on DX compatibility), and changing it back will break the DX compatibility.

Let me know if this helps at all,

-John
#11
08/29/2005 (12:05 pm)
Mmm, all right.

When I get home I'll build the 1.2 version first, just to see if things get back the way they were. Then I'll try these changes on 1.3. If this is the cause of the problem, I'll just leave it and stick to the standard 1.3. The wise choice here is to work with a correct version and redesign my lights.

Thanks for the attention, John. I'll keep you posted about this.
#12
08/29/2005 (12:47 pm)
Sure thing - I was curious to see what was causing the difference between the versions. I mean they're very different in implementation, but the rendering code is fundamentally the same and I couldn't think of anything that changed, especially in that rendering path.

Speaking of the old implementation... wow - talk about a stroll down memory lane. :) It's interesting to go back and look at the evolution of the product.

Let me know how it goes!
#13
08/30/2005 (7:11 am)
Now things are getting really crazy. I downloaded TGE 1.2.2 (at least the branch tagged as Revision_1_2_2 at CVS) and Lighting Pack 1.1.5. Then sucessfully patched Torque and compiled the demo.

Guess what? Weak lights. Then I compiled map2dif and made the DIF again. No luck.

The crazy thing here is that all I do is drop the new EXE and DIF on the old demo. The old EXE is still there, working as before! I can run the old and the lights look like the first pic. Then I run the new one and the lights look like the second one.

I tried to update DirectX, but already have the 9c version.

I don't get it.

Tonight I'll copy the DIF to a brand new downloaded LP demo and make a new light entity from scratch. John, I'm sending you my old EXE (the vivid contrast one) by yousendit (just a temp link to download), just in case you're curious.

Wait for the next chapter of the novel.
#14
09/05/2005 (7:58 pm)
Well, just to close the subject:

I really don't know what happened. I redone the lights, they look slightly different but acceptable.

Weird.
#15
09/06/2005 (3:11 am)
I downloaded the exe you sent over, but it's almost impossible to tell from the binary what's going on.

Do you still have the old source in your source control system (cvs, svn, ...)? If so you could pull that older version and compare it to the 1.1.5 test you performed a few weeks ago to see what code is different.

The one thing I have been thinking of is that the dynamic lighting charicteristics are dependent on the dynamic lighting texture located at 'common/lighting/lightFalloffMono.png' - if at one point that file was updated to change the fall off that would definitely result in the same effective radius, but with higher or lower average illumination (similar to what you're seeing). Also that would explain why only the dynamic lighting was affected by the code update.
#16
09/14/2005 (7:39 am)
Later on, when I finish the lighting of this mission, I'll play with the lightFallofMono bitmap. I bet it's the answer. When it's finished I'll post screens here (they will be better than these).

John, thanks for the attention.