Skip to content
Snippets Groups Projects
Commit 8942217a authored by David Parks's avatar David Parks Committed by RobotRoss
Browse files

#731 Fix for divide by zero when haze density set to zero (#1085)

parent 9729af56
No related branches found
No related tags found
No related merge requests found
......@@ -98,7 +98,7 @@ void main()
vec3 light_atten = (blue_density + vec3(haze_density * 0.25)) * (density_multiplier * max_y);
// Calculate relative weights
vec3 combined_haze = abs(blue_density) + vec3(abs(haze_density));
vec3 combined_haze = max(abs(blue_density) + vec3(abs(haze_density)), vec3(1e-6));
vec3 blue_weight = blue_density / combined_haze;
vec3 haze_weight = haze_density / combined_haze;
......
......@@ -66,7 +66,7 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou
// I had thought blue_density and haze_density should have equal weighting,
// but attenuation due to haze_density tends to seem too strong
vec3 combined_haze = blue_density + vec3(haze_density);
vec3 combined_haze = max(blue_density + vec3(haze_density), vec3(1e-6));
vec3 blue_weight = blue_density / combined_haze;
vec3 haze_weight = vec3(haze_density) / combined_haze;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment