After recently installing this mod into my Modact 4.12.2 game, I noticed that the smaller calibre AA rounds (20mm and 25mm) which have a timed terminal burst would awfully strongly light up the scenery. Indeed, the bigger flak would do so as well. My first task was to tone this down.
Now, having just *one* calculation of the light intensity and range apply to
both the small and big AA is ill advised, in my opinion. And so I differentiated between them, as will be seen below.
But one odd thing always bothered me. Even with the lighting values set
extremely low for the small AA, bursts in cloud continued to light up the cloud way too much. At this juncture I've effectively disabled light emission from the small stuff, in order to fix its too-strong cloud lighting.
Below is my java code for the AirFlak class, inside Explosions.class...
1) I suspect it would be more elegant to define the lightPointIntensity and lightPointRange variables outside this class instead of here.
2) I very considerably lowered the original Intensity and Range values that are possible. This keeps the flak from lighting the ground below to what I consider to be much too strong a degree.
3) For the big flak, the lightPointIntensity varies randomly between 2.0 and 3.0. The lightPointRange is 75 times the Intensity, or 150 to 225. This is the dark night baseline. As twilight brightens, the Range is adjusted down from this to 1/10 at lowest.
4) I kept decrementing the small AA values for these two variables, hoping to get to a point where the cloud would not be obviously lit up. No joy, even with the
tiny 0.001 values here. Hence the test for the Intensity < 0.01, to
disable the creation of a lightpointactor for these bursts. In the end, I find this to be just fine. After all, these bursts occur at a fixed range from the guns, and rarely is one hanging about in this narrow zone for the lighting to be appreciated anyway.
5) I'm certain more elegant code than this ham-fisted effort could be constructed. But it works. Further tweaking is virtually certainly in order. The main thing I want to get across is the means of treating the different calibres separately.
public static void AirFlak(Point3d point3d, int i) {
float lightPointIntensity;
float lightPointRange;
if (Config.isUSE_RENDER()) {
o.set(0.0F, 90.0F, 0.0F);
l.set(point3d, o);
String string = "effects/Explodes/Air/Zenitka/";
switch (i) {
case 0:
string += "USSR_85mm/";
lightPointIntensity = 2.0F + World.rnd().nextFloat();
lightPointRange = lightPointIntensity * 75.0F;
break;
case 1:
string += "Germ_88mm/";
lightPointIntensity = 2.0F + World.rnd().nextFloat();
lightPointRange = lightPointIntensity * 75.0F;
break;
case 2:
string += "USSR_25mm/";
lightPointIntensity = 0.001F;
lightPointRange = 0.001F;
break;
default:
string += "Germ_20mm/";
lightPointIntensity = 0.001F;
lightPointRange = 0.001F;
}
SfxExplosion.zenitka(point3d, i);
float f = -1.0F;
Eff3DActor.New(l, 1.0F, string + "SmokeBoiling.eff", f);
Eff3DActor.New(l, 1.0F, string + "Sparks.eff", f);
Eff3DActor.New(l, 1.0F, string + "SparksP.eff", f);
if (World.Sun().ToSun.z > 0.1F)
Eff3DActor.New(l, 1.0F, string + "Burn.eff", f);
else {
float burnSize = MiscEffects.cvt(World.Sun().ToSun.z, -0.3F, 0.1F, 10.0F, 1.0F);
lightPointRange *= MiscEffects.cvt(World.Sun().ToSun.z, -0.3F, 0.1F, 1.0F, 0.1F);
Eff3DActor eff3dactor = Eff3DActor.New(l, burnSize, string + "Burn_night.eff", f);
if (lightPointIntensity < 0.01)
return;
LightPointActor lightpointactor = new LightPointActor(new LightPointWorld(), new Point3d());
lightpointactor.light.setColor(0.6F, 0.4F, 0.2F);
lightpointactor.light.setEmit(lightPointIntensity, lightPointRange);
eff3dactor.draw.lightMap().put("light", lightpointactor);
}
}
}