16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 03:29:19 +02:00

Fog applied to line objects.

This commit is contained in:
stele
2018-12-24 23:50:17 +01:00
parent 141e812308
commit 8aca8bffe4
4 changed files with 16 additions and 11 deletions

9
shaders/apply_fog.glsl Normal file
View File

@@ -0,0 +1,9 @@
vec3 apply_fog(vec3 color)
{
float sun_amount = 0.0;
if (lights_count >= 1U && lights[0].type == LIGHT_DIR)
sun_amount = max(dot(normalize(f_pos.xyz), normalize(-lights[0].dir)), 0.0);
vec3 fog_color_v = mix(fog_color, lights[0].color, pow(sun_amount, 30.0));
float fog_amount_v = 1.0 - min(1.0, exp(-length(f_pos.xyz) * fog_density));
return mix(color, fog_color_v, fog_amount_v);
}