Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add horizon fadeout for fog effects #25

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions shaders/clouds.omwfx
Original file line number Diff line number Diff line change
Expand Up @@ -669,16 +669,22 @@ fragment main {
col.rgb = mix(mix(omw.sunColor.rgb, normalize(omw.sunColor.rgb), 0.75) * 0.4, col.rgb, 1.0 / (1.0 + max_dist * 0.005 * pow(interior_mist, 2)));
}
} else {
if (max_dist >= HORIZON * 0.9) {
if (replace_skybox) {
// Darken the sky above
col.rgb = sky_color * mix(vec3(0.5, 0.7, 0.9), vec3(1.0), vec3(1.0 - dir.z));
}
if (better_sun) {
col.rgb += sun_light(dir);
}
if (max_dist >= HORIZON * 0.9) {
if (replace_skybox) {
// Darken the sky above
col.rgb = sky_color * mix(vec3(0.5, 0.7, 0.9), vec3(1.0), vec3(1.0 - dir.z));
}
col = apply_fog(col, wpos, dir, max_dist, dyn_clouds, dyn_mist);
if (better_sun) {
col.rgb += sun_light(dir);
}
}

if (max_dist < HORIZON * 0.9){
col = apply_fog(col, wpos, dir, max_dist, dyn_clouds, dyn_mist);
} else if (dir.z > 0){
float fogFadeIn = clamp(dir.z * 5.0, 0, 1);
col = apply_fog(col, wpos, dir, max_dist, dyn_clouds, dyn_mist) * fogFadeIn + (col * (1-fogFadeIn));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW I think this would be clearer as

col = mix(col, apply_fog(...), fogFadeIn);

}
}

if (point_glow_enabled && point_glow_intensity > 0.0) {
Expand Down