Game Development Community

Lighting changes for L_SPOT between 1.0 and 1.2??

by Steve Meinel · in General Game Discussion · 09/28/2003 (2:45 pm) · 9 replies

The following code does not light the scene the same way between the 2 versions:
Light1      = new G3D_Light;
    Light1->SetType                     (G3D_Light::L_POINT);
    Light1->SetColorAmbient             (Color(.8,0,0));
    Light1->SetColorDiffuse             (Color(.8));
    Light1->SetColorSpecular            (Color(.8));
    Light1->SetAttenuationLinear(0.004);
    Light1->SetPosition                 (Vec3(-300,0,250));
    Light1->SetRotation                 (Vec3(0,0,-1));
    Device_GFX->Insert                  (Light1);

    Light2      = new G3D_Light;
    Light2->SetType                     (G3D_Light::L_POINT);
    Light2->SetColorAmbient             (Color(0,.8,0));
    Light2->SetColorDiffuse             (Color(.8));
    Light2->SetColorSpecular            (Color(.8));
    Light2->SetAttenuationLinear(0.004);
    Light2->SetPosition                 (Vec3(0,500,250));
    Light2->SetRotation                 (Vec3(0,0,-1));
    Device_GFX->Insert                  (Light2);

    Light3      = new G3D_Light;
    Light3->SetType                     (G3D_Light::L_POINT);
    Light3->SetColorAmbient             (Color(0,0,.8));
    Light3->SetColorDiffuse             (Color(.8));
    Light3->SetColorSpecular            (Color(.8));
    Light3->SetAttenuationLinear(0.004);
    Light3->SetPosition                 (Vec3(300,0,250));
    Light3->SetRotation                 (Vec3(0,0,-1));
    Device_GFX->Insert                  (Light3);

Here's a 1.0 vs 1.2 screencap:
www.darkmattergames.com/steve/lighting_change.jpg
1.0 is on top, 1.2 is on bottom. Did something break in 1.2?

Thanks,
Steve

{edit: removed dumb comments}

#1
10/02/2003 (9:42 am)
Interesting? I'll look into this more closely. Thanks for the heads up.
#2
10/02/2003 (10:47 pm)
Just as a possible pointer into what can be going wrong: calls to SetColorDiffuse() that use only a primary color (I.E. pure red, pure green, etc.) give colored lights, but they tend to be way over-saturated. Adding any other color at all (say, Color(0.8,0.01,0.0)) instantly flips it to pure white light. Thanks for looking into this!
#3
10/04/2003 (9:42 am)
Thanks for the tip. I'll try to get to it ASAP.

Chris
#4
11/10/2003 (9:36 pm)
Hey, just touching bases... Made any headway here?

If you can tell me relavant files to check, I can diff them vs. the 1.0 codebase. Thanks!
#5
12/06/2003 (12:39 am)
Any luck?
#6
12/06/2003 (3:24 pm)
Chris = missing in action
#7
12/06/2003 (11:16 pm)
I was starting to suspect as much... :(
#8
01/17/2004 (10:31 pm)
Well, since there's no support for this engine, I did what any semi-sane programmer would do. I rolled back to 1.0, and patched in the Corona Image Library, so I've got a solution to the stupid lighting bug, AND access to image formats other than TGA nd BMP.

:P
#9
01/26/2004 (4:00 pm)
OK, I've managed to roll forward to 1.2 and integrate the fix. For this and for the issue of non-working alpha on 3D objects.

The fixes have been uploaded as a resource here.