Skip to content

Commit

Permalink
Don't apply sky fog if fog mode is uniform and density is 0. (#1538)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThatRedox authored Jan 14, 2023
1 parent 3fd2d58 commit 7ced041
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions chunky/src/java/se/llbit/chunky/renderer/scene/Fog.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,19 @@ private static double clampDy(double dy) {

public void addSkyFog(Ray ray, Vector4 scatterLight) {
if (mode == FogMode.UNIFORM) {
double fog;
if (ray.d.y > 0) {
fog = 1 - ray.d.y;
fog *= fog;
} else {
fog = 1;
if (uniformDensity > 0.0) {
double fog;
if (ray.d.y > 0) {
fog = 1 - ray.d.y;
fog *= fog;
} else {
fog = 1;
}
fog *= skyFogDensity;
ray.color.x = (1 - fog) * ray.color.x + fog * fogColor.x;
ray.color.y = (1 - fog) * ray.color.y + fog * fogColor.y;
ray.color.z = (1 - fog) * ray.color.z + fog * fogColor.z;
}
fog *= skyFogDensity;
ray.color.x = (1 - fog) * ray.color.x + fog * fogColor.x;
ray.color.y = (1 - fog) * ray.color.y + fog * fogColor.y;
ray.color.z = (1 - fog) * ray.color.z + fog * fogColor.z;
} else if (mode == FogMode.LAYERED) {
double dy = ray.d.y;
double y1 = ray.o.y;
Expand Down

0 comments on commit 7ced041

Please sign in to comment.