Check for low z values in the gradient fog integral.

Also simplified the logic a bit.

might fix #1034
This commit is contained in:
IntegratedQuantum 2025-02-13 19:58:25 +01:00
parent 47adc1067d
commit 6f33963e8c
3 changed files with 6 additions and 18 deletions

View File

@ -35,13 +35,9 @@ float densityIntegral(float dist, float zStart, float zDist, float fogLower, flo
zStart += zDist;
zDist = -zDist;
}
if(zDist == 0) {
zDist = 0.1;
if(abs(zDist) < 0.001) {
zDist = 0.001;
}
zStart /= zDist;
fogLower /= zDist;
fogHigher /= zDist;
zDist = 1;
float beginLower = min(fogLower, zStart);
float endLower = min(fogLower, zStart + zDist);
float beginMid = max(fogLower, min(fogHigher, zStart));

View File

@ -77,13 +77,9 @@ float densityIntegral(float dist, float zStart, float zDist, float fogLower, flo
zStart += zDist;
zDist = -zDist;
}
if(zDist == 0) {
zDist = 0.1;
if(abs(zDist) < 0.001) {
zDist = 0.001;
}
zStart /= zDist;
fogLower /= zDist;
fogHigher /= zDist;
zDist = 1;
float beginLower = min(fogLower, zStart);
float endLower = min(fogLower, zStart + zDist);
float beginMid = max(fogLower, min(fogHigher, zStart));

View File

@ -34,13 +34,9 @@ float densityIntegral(float dist, float zStart, float zDist, float fogLower, flo
zStart += zDist;
zDist = -zDist;
}
if(zDist == 0) {
zDist = 0.1;
if(abs(zDist) < 0.001) {
zDist = 0.001;
}
zStart /= zDist;
fogLower /= zDist;
fogHigher /= zDist;
zDist = 1;
float beginLower = min(fogLower, zStart);
float endLower = min(fogLower, zStart + zDist);
float beginMid = max(fogLower, min(fogHigher, zStart));