Extreme fog after clouds
Opened this issue ยท 11 comments
For some reason when I get higher than the clouds on clouds fancy and fast, there is extreme amount of fog everywhere. If I close the clouds, the fog is everywhere.
Note that this was also a BetterFPS issue without CubicChunks. Which I would have known if I actually tested it myself.
...
ALWAYS give information about all other mod syou have installed and full client and/or server log when you report a bug.
This is most likely BetterFPS patching something in a strange way.
VanillaCubic is literally just vanilla generator filled with stone below y=0. FllatCubic is cubic chunks version of superflat. CustomCubic is customizable cubic chunks world, that actually does peoper cubic chunks terrain. Remove BetterFPS first. And test again.
Strange things are going to happen with non-vanilla fog algorithms because currently I use very confusing hack to make the fog disabled below y=0.
The relevant part in vanilla code looks like this:
double d1 = (entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks) * world.provider.getVoidFogYFactor();
if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(MobEffects.BLINDNESS)) {
int i = ((EntityLivingBase)entity).getActivePotionEffect(MobEffects.BLINDNESS).getDuration();
if (i < 20) {
d1 *= (double)(1.0F - (float)i / 20.0F);
}
else {
d1 = 0.0D;
}
}
if (d1 < 1.0D) {
if (d1 < 0.0D) {
d1 = 0.0D;
}
d1 = d1 * d1;
// this makes the fog appear
this.fogColorRed = (float)((double)this.fogColorRed * d1);
this.fogColorGreen = (float)((double)this.fogColorGreen * d1);
this.fogColorBlue = (float)((double)this.fogColorBlue * d1);
}
Below y=0 the value d1
will always be negative, no matter how large value I give for getVoidFogYFactor()
which is the only thing I directly control there. Unless I return value NaN
(not a number). Then d1
will also be NaN
. NaN
has the special property that if you compare it to anything including itself it will always be false except when comparing for not-equal). This means that the whole d1 < 1.0D
part will be skipped and no y-based fog distance decreasing will occur.
All it takes to break it is a slight change in the algorithm. I don't see any way for me to fix it. Even if I modify that part of code to do it peoperly, non-vanilla algrithms still won't work.
Even further, BetterFPS might assume that there is nothing above y=256 so the fog can be more dense there.
Anyway all of that is my speculation until I actually debug it. And I can't because BetterFPS doesn't work in dev environment.