mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
better rainbows
This commit is contained in:
parent
27ec6d7469
commit
72a0f56788
@ -247,6 +247,7 @@ vec3 get_cloud_color(vec3 surf_color, vec3 dir, vec3 origin, const float time_of
|
||||
float rainbow_t = (0.7 - dot(sun_dir.xyz, dir)) * 8 / 0.05;
|
||||
int rainbow_c = int(floor(rainbow_t));
|
||||
rainbow_t = fract(rainbow_t);
|
||||
rainbow_t = rainbow_t * rainbow_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -286,7 +287,6 @@ vec3 get_cloud_color(vec3 surf_color, vec3 dir, vec3 origin, const float time_of
|
||||
#if (CLOUD_MODE >= CLOUD_MODE_MEDIUM)
|
||||
#ifdef EXPERIMENTAL_RAINBOWS
|
||||
if (rainbow_c >= 0 && rainbow_c < 8) {
|
||||
float rain = rain_density_at(pos.xy);
|
||||
vec3 colors[9] = {
|
||||
surf_color,
|
||||
vec3(0.9, 0.5, 0.9),
|
||||
@ -298,10 +298,16 @@ vec3 get_cloud_color(vec3 surf_color, vec3 dir, vec3 origin, const float time_of
|
||||
vec3(1.0, 0.0, 0.0),
|
||||
surf_color,
|
||||
};
|
||||
float h = max(0.0, min(pos.z, 900.0 - pos.z) / 450.0);
|
||||
float rain = rain_density_at(pos.xy) * pow(h, 0.1);
|
||||
|
||||
float sun = sun_access * get_sun_brightness();
|
||||
float energy = pow(rain * sun * min(cdist / 500.0, 1.0), 2.0) * 0.4;
|
||||
|
||||
surf_color = mix(
|
||||
surf_color,
|
||||
mix(colors[rainbow_c], colors[rainbow_c + 1], rainbow_t),
|
||||
rain * sun_access * sun_access * get_sun_brightness() * pow(min(cdist / 500.0, 1.0), 2.0)
|
||||
energy
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user