Special Aircraft Service

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Landing and nav light tidbits  (Read 1329 times)

0 Members and 1 Guest are viewing this topic.

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6050
Landing and nav light tidbits
« on: May 16, 2021, 07:43:07 AM »

Boosting landing light range, altering its color, and reducing the illuminating power of the nav/landing lights upon the plane. The stock game wouldn't let me light up the field from as far away as shown here. Worth considering as the new standard in BAT?




The stock landing light range is a mere 1000m. Maybe fine for the Storch  ;) , but awfully short for planes that have hotter landing speeds. Real lights were useful over a rather farther range than that. I've boosted this to 3000m. And I've made the illumination color on the ground a warm white, instead of the notably bluish hue. These two aspects are controlled in Aircraft.class, in the method updateLLights:

Code: [Select]
    public void updateLLights()
    {
        pos.getRender(_tmpLoc);
        if(lLight == null)
        {
            if(_tmpLoc.getX() < 1.0D)
                return;
            lLight = (new LightPointWorld[] {
                null, null, null, null
            });
            for(int i = 0; i < 4; i++)
            {
                lLight[i] = new LightPointWorld();
                lLight[i].setColor(0.96F, 0.98F, 0.8F);    //(0.49411765F, 0.9098039F, 0.9607843F);
                lLight[i].setEmit(0.0F, 0.0F);
                try
                {
                    lLightHook[i] = new HookNamed(this, "_LandingLight0" + i);
                }
                catch(Exception exception) { }
            }

            return;
        }
        for(int j = 0; j < 4; j++)
        {
            if(FM.AS.astateLandingLightEffects[j] != null)
            {
                lLightLoc1.set(0.0D, 0.0D, 0.0D, 0.0F, 0.0F, 0.0F);
                lLightHook[j].computePos(this, _tmpLoc, lLightLoc1);
                lLightLoc1.get(lLightP1);
/*              lLightLoc1.set(1000D, 0.0D, 0.0D, 0.0F, 0.0F, 0.0F);  */
                lLightLoc1.set(3000D, 0.0D, 0.0D, 0.0F, 0.0F, 0.0F);
                lLightHook[j].computePos(this, _tmpLoc, lLightLoc1);
                lLightLoc1.get(lLightP2);
                Engine.land();
                if(Landscape.rayHitHQ(lLightP1, lLightP2, lLightPL))
                {
                    lLightPL.z++;
                    lLightP2.interpolate(lLightP1, lLightPL, 0.95F);
                    lLight[j].setPos(lLightP2);
                    float f = (float)lLightP1.distance(lLightPL);
                    float f1 = f * 0.5F + 30F;
/*                  float f2 = 0.5F - (0.5F * f) / 1000F;  */
                    float f2 = 0.5F - (0.5F * f) / 3000F;
                    lLight[j].setEmit(f2, f1);
                } else
                {
                    lLight[j].setEmit(0.0F, 0.0F);
                }
                continue;
            }
            if(lLight[j].getR() != 0.0F)
                lLight[j].setEmit(0.0F, 0.0F);
        }

    }


Also of note in this screenie is the huge reduction in intensity of illumination from the nav lights. The stock lights bathe the plane in an obvious glow. But real nav lights are far subtler than that. This is fixable in AircraftState.class. First, in the method set(Actor actor, boolean bool) we can alter the color of the the nav lights and the landing light upon the plane. For the red and green nav lights I've made the hue very slightly less pure. For the landing light, I've given it the same color as for the spot it makes upon the ground, a warm white.

Code: [Select]
for (int i = 0; i < astateNavLightsEffects.length; i++) {
    try {
astateEffectChunks[i + 18] = this.actor.findHook("_NavLight" + i).chunkName();
astateEffectChunks[i + 18] = astateEffectChunks[i + 18].substring(0, astateEffectChunks[i + 18].length() - 1);
Aircraft.debugprintln(aircraft, ("AS: Nav. Lamp #" + i + " attached to '" + astateEffectChunks[i + 18] + "' substring.."));
HookNamed hooknamed = new HookNamed(aircraft, "_NavLight" + i);
loc_2_.set(1.0, 0.0, 0.0, 0.0F, 0.0F, 0.0F);
hooknamed.computePos(this.actor, loc, loc_2_);
Point3d point3d = loc_2_.getPoint();
astateNavLightsLights[i] = new LightPointActor(new LightPoint(), point3d);
if (i < 2)
    astateNavLightsLights[i].light.setColor(1.0F, 0.2F, 0.0F); //RED (1.0F, 0.1F, 0.0F)
else if (i < 4)
    astateNavLightsLights[i].light.setColor(0.1F, 0.8F, 0.0F); //GREEN (0.1F, 1.0F, 0.0F)
else
    astateNavLightsLights[i].light.setColor(0.85F, 0.8F, 0.75F); //WHITE (0.85F, 0.8F, 0.75F)
astateNavLightsLights[i].light.setEmit(0.0F, 0.0F);
this.actor.draw.lightMap().put("_NavLight" + i, astateNavLightsLights[i]);
    } catch (Exception exception) {
/* empty */
    } finally {
/* empty */
    }
}
for (int i = 0; i < 4; i++) {
    try {
astateEffectChunks[i + 24] = this.actor.findHook("_LandingLight0" + i).chunkName();
astateEffectChunks[i + 24] = astateEffectChunks[i + 24].substring(0, astateEffectChunks[i + 24].length() - 1);
Aircraft.debugprintln(aircraft, ("AS: Landing Lamp #" + i + " attached to '" + astateEffectChunks[i + 24] + "' substring.."));
HookNamed hooknamed = new HookNamed(aircraft, "_LandingLight0" + i);
loc_2_.set(1.0, 0.0, 0.0, 0.0F, 0.0F, 0.0F);
hooknamed.computePos(this.actor, loc, loc_2_);
Point3d point3d = loc_2_.getPoint();
astateLandingLightLights[i] = new LightPointActor(new LightPoint(), point3d);
/* astateLandingLightLights[i].light.setColor(0.4941176F, 0.9098039F, 0.9607843F); */
astateLandingLightLights[i].light.setColor(0.96F, 0.91F, 0.84F);
astateLandingLightLights[i].light.setEmit(0.0F, 0.0F);
this.actor.draw.lightMap().put("_LandingLight0" + i, astateLandingLightLights[i]);
    } catch (Exception exception) {
/* empty */
    } finally {
/* empty */
    }
}


To alter the intensity of the nav lights upon the plane, we look to this method (in AircraftState.class), where I've reduced both the intensity (from 0.35 down to 0.09) and range (from * down to 6):

Code: [Select]
    private void doSetNavLightsState(boolean flag)
    {
        for(int i = 0; i < astateNavLightsEffects.length; i++)
        {
            if(astateNavLightsEffects[i] != null)
            {
                Eff3DActor.finish(astateNavLightsEffects[i]);
                astateNavLightsLights[i].light.setEmit(0.0F, 0.0F);
            }
            astateNavLightsEffects[i] = null;
        }

        if(flag)
        {
            new Loc(0.0D, 0.0D, 0.0D, 0.0F, 0.0F, 0.0F);
            new Loc();
            for(int j = 0; j < astateNavLightsEffects.length; j++)
            {
                Aircraft.debugprintln(aircraft, "AS: Checking '" + astateEffectChunks[j + 18] + "' visibility..");
                boolean flag1 = aircraft.isChunkAnyDamageVisible(astateEffectChunks[j + 18]);
                Aircraft.debugprintln(aircraft, "AS: '" + astateEffectChunks[j + 18] + "' is " + (flag1 ? "visible" : "invisible") + "..");
                if(flag1)
                {
                    bNavLightsOn = flag;
                    String s = "3DO/Effects/Fireworks/Flare" + (j > 1 ? j > 3 ? "White" : "Green" : "Red") + ".eff";
                    astateNavLightsEffects[j] = Eff3DActor.New(actor, actor.findHook("_NavLight" + j), null, 1.0F, s, -1F, false);
/*                    astateNavLightsLights[j].light.setEmit(0.35F, 8F); */
                    astateNavLightsLights[j].light.setEmit(0.09F, 6F);
                }
            }

        } else
        {
            bNavLightsOn = flag;
        }
    }


And finally, for the landing light illumination intensity upon the plane, we go here:

Code: [Select]
    private void doSetLandingLightState(boolean flag)
    {
        bLandingLightOn = flag;
        for(int i = 0; i < astateLandingLightEffects.length; i++)
        {
            if(astateLandingLightEffects[i] != null)
            {
                Eff3DActor.finish(astateLandingLightEffects[i]);
                astateLandingLightLights[i].light.setEmit(0.0F, 0.0F);
            }
            astateLandingLightEffects[i] = null;
        }

        if(flag)
        {
            for(int j = 0; j < astateLandingLightEffects.length; j++)
            {
                Aircraft.debugprintln(aircraft, "AS: Checking '" + astateEffectChunks[j + 24] + "' visibility..");
                boolean flag1 = aircraft.isChunkAnyDamageVisible(astateEffectChunks[j + 24]);
                Aircraft.debugprintln(aircraft, "AS: '" + astateEffectChunks[j + 24] + "' is " + (flag1 ? "visible" : "invisible") + "..");
                if(flag1)
                {
                    String s = "3DO/Effects/Fireworks/FlareWhiteWide.eff";
                    astateLandingLightEffects[j] = Eff3DActor.New(actor, actor.findHook("_LandingLight0" + j), null, 1.0F, s, -1F);
/*                    astateLandingLightLights[j].light.setEmit(1.2F, 8F); */
                    astateLandingLightLights[j].light.setEmit(0.3F, 9F);
                }
            }

        }
    }

I've reduced the intensity by about the same four-fold ratio as for the nav lights.


Now, I don't know if boosting the landing light range might have any untoward consequences. This would warrant some testing and careful observation. But the light color and illumination power aspects should be completely safe. Especially when decreasing values.
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

Mick

  • Modder
  • member
  • Offline Offline
  • Posts: 5480
Re: Landing and nav light tidbits
« Reply #1 on: May 16, 2021, 08:35:48 AM »

... sorry but the Nav lights seen on your screen are of the flash type, that saw ... the light from the sixties onwards ...  :-X

I fiddled with the Nav lights effect a long time ago (in 2014 : https://www.sas1946.com/main/index.php/topic,38714.0.html), here is the result ...  ;)

https://www.mediafire.com/file/j8e6u0ebw3vudkc/%2521_Realistic_NavLights.7z/file



... there's also a mod somewhere (sorry can't remember where) that drastically reduces the nav lights reflection on the fuselage and other parts of an AC ...  ;)


You can also mod this nav lights yourselves, very easy to do ... ;)

For instance if you think they are too small/big in diameter, just open the 3 Flare.eff files (Green, Red, White) in the Fireworks folder, and change the Radius0 and Radius1 values (currently 0.12)

here the Green Nav light:

[General]
MatName ../Tracers/TEXTURES/flaregreen.mat
Radius0 0.12
Radius1 0.12

RadiusPeriod 0.0
Angle 0.0
AngleSpeed 0.0
Color0 0.75 0.75 0.75 0.80
Color1 0.75 0.75 0.75 0.80
ColorPeriod 1.0
PerspCompensDist 100.0 < can't remember what this value is for ...
PerspCompensScale 2.0 < can't remember what this value is for ...


You can also tweak the VisibleDistanceFar (currently 3500 meters) in the tracers folder ... ;)


[ClassInfo]
ClassName TMaterial
[General]
tfDoubleSide 1
tfShouldSort 1
tfDropShadow 0
tfGameTimer 1
[LightParams]
Ambient 0.0
Diffuse 0.0
Specular 0.0
SpecularPow 0
Shine 0.35
[Layer0]
TextureName flaregreen.tga
PaletteName
Frame 0.0
VisibleDistanceNear 0.0
VisibleDistanceFar 3500.0
Logged

Epervier

  • 4.09 Guardian Angel !
  • SAS Team
  • member
  • Offline Offline
  • Posts: 9544
  • I'm French and Rebel_409! Nobody is perfect!
    • Some tinkering here
Re: Landing and nav light tidbits
« Reply #2 on: May 16, 2021, 09:07:20 AM »

I love your topics like this.  8)
You had already given these modifications with the added sound of rain.
https://www.sas1946.com/main/index.php/topic,62759.0.html

I had adopted your corrections.
I see one or two small changes here.
Thank you very much !

Even though the flashing lights are from the 1960s, I adopted them for WWII!  ;D
As they only come on when you land, it's not annoying!  ;)
Logged
If your results do not live up to your expectations, tell yourself that the great oak was once an acorn too. - Lao Zi -

Mick

  • Modder
  • member
  • Offline Offline
  • Posts: 5480
Re: Landing and nav light tidbits
« Reply #3 on: May 16, 2021, 09:39:45 AM »

Even though the flashing lights are from the 1960s, I adopted them for WWII!  ;D
As they only come on when you land, it's not annoying!  ;)

... cheater ...!  :P

... well, Nav lights, like their name suggests, were also used in bad weather conditions and/or at night, to avoid air collisions, especially in big bombers boxes ...  ;)
Logged

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6050
Re: Landing and nav light tidbits
« Reply #4 on: May 16, 2021, 10:11:46 AM »

Mick,
The nav lights I showed are continuous, not strobing. The texture just happens to have the 'spiky' aspect to suggest some degree of brightness.

The topic here was not so much about the appearance of the light textures themselves, but rather about the illumination associated with them, and how they light up their surroundings. In the stock game from way back, the red and green lighting would be pretty bright on the wings and fuselage, and inside the cockpit would be lit up to a certain degree as well.

I've not ever encountered any mod that dealt with the illumination issues; only light texture appearances.
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

Mick

  • Modder
  • member
  • Offline Offline
  • Posts: 5480
Re: Landing and nav light tidbits
« Reply #5 on: May 16, 2021, 10:41:52 AM »

Mick,
The nav lights I showed are continuous, not strobing. The texture just happens to have the 'spiky' aspect to suggest some degree of brightness.

The topic here was not so much about the appearance of the light textures themselves, but rather about the illumination associated with them, and how they light up their surroundings. In the stock game from way back, the red and green lighting would be pretty bright on the wings and fuselage, and inside the cockpit would be lit up to a certain degree as well.

I've not ever encountered any mod that dealt with the illumination issues; only light texture appearances.


... I am absolutely sure there is one, and a recent one that is ...  ;)

... I'll ask Epervier, I remember him posting a THX message too ...  ;)
Logged

Mick

  • Modder
  • member
  • Offline Offline
  • Posts: 5480
Re: Landing and nav light tidbits
« Reply #6 on: May 16, 2021, 12:15:15 PM »

... Epervier doesn't remember either ...  ::(

Here is the proof, absolutely no Nav lights reflection (bright moon night) on wings or fuselage ...  ;)





I only remember the fix was a modification to make somewhere, but can't remember where ...  :-[
Logged

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6050
Re: Landing and nav light tidbits
« Reply #7 on: May 16, 2021, 01:06:26 PM »

Mick,
No need to scrape your brainpan for dim or lost memories.  ;)  As I pointed out in my first post, I've made the changes that bring down the nav light illumination level on the plane (and in the cockpit), and provided the relevant code. This is quite independent of how prominent or not the light textures are. For instance, one could make the light textures black, yet set the illumination level in code high enough to light up a whole airfield, or a town, in red, green and white light.
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

tomoose

  • Modder
  • member
  • Offline Offline
  • Posts: 1722
  • Iiiiiiiit's ME! Hurrah!!
    • 71 "Eagle" Squadron
Re: Landing and nav light tidbits
« Reply #8 on: May 16, 2021, 04:38:23 PM »

On a similar subject,...runway lights and visibility distance.  I'm still new to BAT so perhaps this has already been addressed, namely, the distance in which you are able to see the runway lights.  For HSFX (which we use for online coop), one has to be relatively close to the airfield before the runway lights become visible which is sort of defeating the purpose particularly in poor weather conditions.  Additionally, the length of time the runway lights remain on is a bit frustrating, they should remain on when requested (i.e. why not a toggle...the first request turns them on, and the next request turns them off). Just curious if any of the mod experts have looked at this.
thanks,
Tomoose
Logged
Pages: [1]   Go Up
 

Page created in 0.038 seconds with 24 queries.