mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Softer and faster clouds with more verticality
This commit is contained in:
parent
f3284b7d90
commit
19ef00085d
@ -179,7 +179,7 @@ void main() {
|
||||
// Squared to account for prior saturation.
|
||||
float f_light = 1.0;// pow(f_light, 1.5);
|
||||
vec3 reflect_color = get_sky_color(/*reflect_ray_dir*/beam_view_dir, time_of_day.x, f_pos, vec3(-100000), 0.125, true);
|
||||
reflect_color = get_cloud_color(reflect_color, reflect_ray_dir, cam_pos.xyz, time_of_day.x, 100000.0, 0.25);
|
||||
reflect_color = get_cloud_color(reflect_color, reflect_ray_dir, cam_pos.xyz, time_of_day.x, 100000.0, 0.1);
|
||||
reflect_color *= f_light;
|
||||
// /*const */vec3 water_color = srgb_to_linear(vec3(0.2, 0.5, 1.0));
|
||||
// /*const */vec3 water_color = srgb_to_linear(vec3(0.8, 0.9, 1.0));
|
||||
|
@ -1,37 +1,36 @@
|
||||
#include <random.glsl>
|
||||
#include <lod.glsl>
|
||||
|
||||
const float CLOUD_THRESHOLD = 0.27;
|
||||
const float CLOUD_SCALE = 5.0;
|
||||
const float CLOUD_DENSITY = 150.0;
|
||||
|
||||
vec2 get_cloud_heights(vec2 pos) {
|
||||
const float CLOUD_HALF_WIDTH = 300;
|
||||
const float CLOUD_HEIGHT_VARIATION = 1500.0;
|
||||
float cloud_alt = CLOUD_AVG_ALT + (texture(t_noise, pos.xy * 0.00005).x - 0.5) * CLOUD_HEIGHT_VARIATION;
|
||||
#if (CLOUD_MODE > CLOUD_MODE_MINIMAL)
|
||||
cloud_alt += (texture(t_noise, pos.xy * 0.001).x - 0.5) * 0.1 * CLOUD_HEIGHT_VARIATION;
|
||||
#endif
|
||||
return vec2(cloud_alt, CLOUD_HALF_WIDTH);
|
||||
float falloff(float x) {
|
||||
return pow(max(x > 0.577 ? (0.3849 / x - 0.1) : (0.9 - x * x), 0.0), 4);
|
||||
}
|
||||
|
||||
float emission_strength = clamp((sin(time_of_day.x / (3600 * 24)) - 0.8) / 0.1, 0, 1);
|
||||
|
||||
// Return the 'broad' density of the cloud at a position. This gets refined later with extra noise, but is important
|
||||
// for computing light access.
|
||||
float cloud_broad(vec3 pos) {
|
||||
return 0.0
|
||||
+ 2 * (noise_3d(pos / vec3(vec2(40000.0), 30000.0) / cloud_scale + 1000.0) - 0.5)
|
||||
;
|
||||
}
|
||||
|
||||
// Returns vec4(r, g, b, density)
|
||||
vec4 cloud_at(vec3 pos, float dist, out vec3 emission) {
|
||||
// Natural attenuation of air (air naturally attenuates light that passes through it)
|
||||
// Simulate the atmosphere thinning as you get higher. Not physically accurate, but then
|
||||
// it can't be since Veloren's world is flat, not spherical.
|
||||
float air = 0.00035 * clamp((10000.0 - pos.z) / 7000, 0, 1);
|
||||
float atmosphere_alt = CLOUD_AVG_ALT * 4.0;
|
||||
float air = 0.0000025 * clamp((atmosphere_alt - pos.z) / 7000, 0, 1);
|
||||
|
||||
// Mist sits close to the ground in valleys (TODO: use base_alt to put it closer to water)
|
||||
float mist_min_alt = 0.5;
|
||||
#if (CLOUD_MODE > CLOUD_MODE_LOW)
|
||||
mist_min_alt = (texture(t_noise, pos.xy * 0.00015).x - 0.5) * 1.25 + 0.5;
|
||||
#if (CLOUD_MODE >= CLOUD_MODE_MEDIUM)
|
||||
mist_min_alt = (texture(t_noise, pos.xy / 50000.0).x - 0.5) * 1.5 + 0.5;
|
||||
#endif
|
||||
mist_min_alt *= 250;
|
||||
mist_min_alt = view_distance.z * 1.5 * (1.0 + mist_min_alt * 0.5);
|
||||
const float MIST_FADE_HEIGHT = 500;
|
||||
float mist = 0.00125 * pow(clamp(1.0 - (pos.z - mist_min_alt) / MIST_FADE_HEIGHT, 0.0, 1), 4.0) / (1.0 + pow(1.0 + dist / 20000.0, 2.0));
|
||||
float mist = 0.00025 * pow(clamp(1.0 - (pos.z - mist_min_alt) / MIST_FADE_HEIGHT, 0.0, 1), 4.0) / (1.0 + pow(1.0 + dist / 20000.0, 2.0));
|
||||
|
||||
vec3 wind_pos = vec3(pos.xy + wind_offset, pos.z);
|
||||
|
||||
@ -39,54 +38,76 @@ vec4 cloud_at(vec3 pos, float dist, out vec3 emission) {
|
||||
float cloud_tendency = cloud_tendency_at(pos.xy);
|
||||
float cloud = 0;
|
||||
|
||||
vec2 cloud_attr = get_cloud_heights(wind_pos.xy);
|
||||
float cloud_factor = 0.0;
|
||||
float turb_noise = 0.0;
|
||||
//vec2 cloud_attr = get_cloud_heights(wind_pos.xy);
|
||||
float sun_access = 0.0;
|
||||
float moon_access = 0.0;
|
||||
float cloud_sun_access = 0.0;
|
||||
float cloud_moon_access = 0.0;
|
||||
float cloud_broad_a = 0.0;
|
||||
float cloud_broad_b = 0.0;
|
||||
// This is a silly optimisation but it actually nets us a fair few fps by skipping quite a few expensive calcs
|
||||
if (cloud_tendency > 0 || mist > 0.0) {
|
||||
if ((pos.z < CLOUD_AVG_ALT + 15000.0 && cloud_tendency > 0.0) || mist > 0.0) {
|
||||
// Turbulence (small variations in clouds/mist)
|
||||
const float turb_speed = -1.0; // Turbulence goes the opposite way
|
||||
vec3 turb_offset = vec3(1, 1, 0) * time_of_day.x * turb_speed;
|
||||
mist *= 0.5
|
||||
+ 4 * (noise_2d(wind_pos.xy / 20000) - 0.5)
|
||||
+ 1 * (noise_3d(wind_pos / 1000) - 0.5);
|
||||
|
||||
const float CLOUD_DEPTH = 4000.0;
|
||||
const float CLOUD_DENSITY = 5.0;
|
||||
const float CLOUD_ALT_VARI_WIDTH = 100000.0;
|
||||
const float CLOUD_ALT_VARI_SCALE = 5000.0;
|
||||
float cloud_alt = CLOUD_AVG_ALT + (noise_3d(wind_pos / CLOUD_ALT_VARI_WIDTH) - 0.5) * CLOUD_ALT_VARI_SCALE;
|
||||
|
||||
cloud_broad_a = cloud_broad(wind_pos + sun_dir.xyz * 250);
|
||||
cloud_broad_b = cloud_broad(wind_pos - sun_dir.xyz * 250);
|
||||
cloud = cloud_tendency + (0.0
|
||||
+ 24 * (cloud_broad_a + cloud_broad_b) * 0.5
|
||||
#if (CLOUD_MODE >= CLOUD_MODE_MINIMAL)
|
||||
turb_noise = noise_3d((wind_pos + turb_offset) * 0.001) - 0.5;
|
||||
+ 4 * (noise_3d(wind_pos / 2000.0 / cloud_scale) - 0.5)
|
||||
#endif
|
||||
#if (CLOUD_MODE >= CLOUD_MODE_MEDIUM)
|
||||
turb_noise += (noise_3d((wind_pos + turb_offset * 0.3) * 0.004) - 0.5) * 0.35;
|
||||
#if (CLOUD_MODE >= CLOUD_MODE_LOW)
|
||||
+ 1 * (noise_3d(wind_pos / 250.0 / cloud_scale) - 0.5)
|
||||
#endif
|
||||
#if (CLOUD_MODE >= CLOUD_MODE_HIGH)
|
||||
turb_noise += (noise_3d((wind_pos + turb_offset * 0.3) * 0.01) - 0.5) * 0.125;
|
||||
+ 1 * (noise_3d(wind_pos / 50.0 / cloud_scale) - 0.5)
|
||||
#endif
|
||||
mist *= 1.0 + turb_noise;
|
||||
|
||||
cloud_factor = 0.25 * (1.0 - pow(min(abs(pos.z - cloud_attr.x) / (cloud_attr.y * pow(max(cloud_tendency * 20.0, 0), 0.5)), 1.0), 1.0));
|
||||
float cloud_flat = min(cloud_tendency, 0.07) * 0.05;
|
||||
cloud_flat *= (1.0 + turb_noise * 7.0 * max(0, 1.0 - cloud_factor * 5));
|
||||
cloud = cloud_flat * pow(cloud_factor, 2) * 20;
|
||||
) * 0.01;
|
||||
cloud = pow(cloud, 2) * sign(cloud);
|
||||
cloud *= CLOUD_DENSITY * (cloud_tendency * 100) * falloff(abs(pos.z - cloud_alt) / CLOUD_DEPTH);
|
||||
|
||||
// What proportion of sunlight is *not* being blocked by nearby cloud? (approximation)
|
||||
cloud_sun_access = clamp((pos.z - cloud_attr.x + turb_noise * 250.0) * 0.002 + 0.35, 0, 1);
|
||||
// Since we're assuming the sun/moon is always above (not always correct) it's the same for the moon
|
||||
cloud_moon_access = sun_access;
|
||||
|
||||
// Basically, just throw together a few values that roughly approximate this term and come up with an average
|
||||
cloud_sun_access = (clamp((
|
||||
// Cloud density gradient
|
||||
0.25 * (cloud_broad_a - cloud_broad_b + (0.25 * (noise_3d(wind_pos / 4000 / cloud_scale) - 0.5) + 0.1 * (noise_3d(wind_pos / 1000 / cloud_scale) - 0.5)))
|
||||
#if (CLOUD_MODE >= CLOUD_MODE_HIGH)
|
||||
// Try to calculate a reasonable approximation of the cloud normal
|
||||
float cloud_tendency_x = cloud_tendency_at(pos.xy + vec2(100, 0));
|
||||
float cloud_tendency_y = cloud_tendency_at(pos.xy + vec2(0, 100));
|
||||
vec3 cloud_norm = vec3(
|
||||
(cloud_tendency - cloud_tendency_x) * 4,
|
||||
(cloud_tendency - cloud_tendency_y) * 4,
|
||||
(pos.z - cloud_attr.x) / 250 + turb_noise + 0.5
|
||||
);
|
||||
cloud_sun_access = mix(max(dot(-sun_dir.xyz, cloud_norm) + 0.0, 0.025), cloud_sun_access, 0.25);
|
||||
cloud_moon_access = mix(max(dot(-moon_dir.xyz, cloud_norm) + 0.35, 0.025), cloud_moon_access, 0.25);
|
||||
// More noise
|
||||
+ 0.01 * (noise_3d(wind_pos / 500) / cloud_scale - 0.5)
|
||||
#endif
|
||||
) * 6.0 - 0.7, -0.95, 1) + 1.0);
|
||||
// Since we're assuming the sun/moon is always above (not always correct) it's the same for the moon
|
||||
cloud_moon_access = 1.0 - cloud_sun_access;
|
||||
}
|
||||
|
||||
float mist_sun_access = 0.5 + turb_noise * 0.5;
|
||||
// Keeping this because it's something I'm likely to reenable later
|
||||
/*
|
||||
#if (CLOUD_MODE >= CLOUD_MODE_HIGH)
|
||||
// Try to calculate a reasonable approximation of the cloud normal
|
||||
float cloud_tendency_x = cloud_tendency_at(pos.xy + vec2(100, 0));
|
||||
float cloud_tendency_y = cloud_tendency_at(pos.xy + vec2(0, 100));
|
||||
vec3 cloud_norm = vec3(
|
||||
(cloud_tendency - cloud_tendency_x) * 4,
|
||||
(cloud_tendency - cloud_tendency_y) * 4,
|
||||
(pos.z - cloud_attr.x) / cloud_attr.y + 0.5
|
||||
);
|
||||
cloud_sun_access = mix(max(dot(-sun_dir.xyz, cloud_norm) - 1.0, 0.025), cloud_sun_access, 0.25);
|
||||
cloud_moon_access = mix(max(dot(-moon_dir.xyz, cloud_norm) - 0.6, 0.025), cloud_moon_access, 0.25);
|
||||
#endif
|
||||
*/
|
||||
|
||||
float mist_sun_access = noise_2d(wind_pos.xy / 10000);
|
||||
float mist_moon_access = mist_sun_access;
|
||||
sun_access = mix(cloud_sun_access, mist_sun_access, clamp(mist * 20000, 0, 1));
|
||||
moon_access = mix(cloud_moon_access, mist_moon_access, clamp(mist * 20000, 0, 1));
|
||||
@ -104,21 +125,15 @@ vec4 cloud_at(vec3 pos, float dist, out vec3 emission) {
|
||||
if (emission_strength <= 0.0) {
|
||||
emission = vec3(0);
|
||||
} else {
|
||||
float z = clamp(pos.z, 0, 10000);
|
||||
float emission_alt = 4000.0;
|
||||
#if (CLOUD_MODE >= CLOUD_MODE_LOW)
|
||||
emission_alt += (noise_3d(vec3(wind_pos.xy * 0.00003 + cloud_tendency * 0.2, time_of_day.x * 0.0001)) - 0.5) * 6000;
|
||||
#endif
|
||||
#if (CLOUD_MODE >= CLOUD_MODE_HIGH)
|
||||
emission_alt += (noise_3d(vec3(wind_pos.xy * 0.0005 + cloud_tendency * 0.2, emission_alt * 0.0001 + time_of_day.x * 0.0005)) - 0.5) * 1000;
|
||||
#endif
|
||||
float tail = (texture(t_noise, wind_pos.xy * 0.00005).x - 0.5) * 10 + (z - emission_alt) * 0.001;
|
||||
vec3 emission_col = vec3(0.6 + tail * 0.6, 1.0, 0.3 + tail * 0.2);
|
||||
float emission_nz = max(texture(t_noise, wind_pos.xy * 0.00003).x - 0.6, 0) / (10.0 + abs(z - emission_alt) / 40);
|
||||
float z = clamp(pos.z, 0, CLOUD_AVG_ALT * 2.0 + 5000.0);
|
||||
float emission_alt = CLOUD_AVG_ALT * 2.0 - 3000.0 + (noise_3d(vec3(wind_pos.xy * 0.0001 + cloud_tendency * 0.2, time_of_day.x * 0.0002)) - 0.5) * 6000;
|
||||
#if (CLOUD_MODE >= CLOUD_MODE_MEDIUM)
|
||||
emission_nz *= (1.0 + (noise_3d(vec3(wind_pos.xy * 0.05, time_of_day.x * 0.15) * 0.004) - 0.5) * 4.0);
|
||||
emission_alt += (noise_3d(vec3(wind_pos.xy * 0.0005 + cloud_tendency * 0.2, emission_alt * 0.0001 + time_of_day.x * 0.001)) - 0.5) * 1000;
|
||||
#endif
|
||||
emission = emission_col * emission_nz * emission_strength * max(sun_dir.z, 0) * 20;
|
||||
float tail = (texture(t_noise, wind_pos.xy * 0.00005).x - 0.5) * 5 + (z - emission_alt) * 0.001;
|
||||
vec3 emission_col = vec3(0.8 + tail * 1.5, 0.5 - tail * 0.2, 0.3 + tail * 0.2);
|
||||
float emission_nz = max(texture(t_noise, wind_pos.xy * 0.00003).x - 0.6, 0) / (10.0 + abs(z - emission_alt) / 80);
|
||||
emission = emission_col * emission_nz * emission_strength * max(sun_dir.z, 0) * 500000 / (1000.0 + abs(z - emission_alt));
|
||||
}
|
||||
|
||||
// We track vapor density and air density separately. Why? Because photons will ionize particles in air
|
||||
@ -138,11 +153,11 @@ const float DIST_CAP = 50000;
|
||||
#elif (CLOUD_MODE == CLOUD_MODE_HIGH)
|
||||
const uint QUALITY = 50u;
|
||||
#elif (CLOUD_MODE == CLOUD_MODE_MEDIUM)
|
||||
const uint QUALITY = 30u;
|
||||
const uint QUALITY = 24u;
|
||||
#elif (CLOUD_MODE == CLOUD_MODE_LOW)
|
||||
const uint QUALITY = 16u;
|
||||
const uint QUALITY = 12u;
|
||||
#elif (CLOUD_MODE == CLOUD_MODE_MINIMAL)
|
||||
const uint QUALITY = 5u;
|
||||
const uint QUALITY = 4u;
|
||||
#endif
|
||||
|
||||
const float STEP_SCALE = DIST_CAP / (10.0 * float(QUALITY));
|
||||
@ -175,11 +190,14 @@ vec3 get_cloud_color(vec3 surf_color, vec3 dir, vec3 origin, const float time_of
|
||||
splay += (texture(t_noise, vec2(atan2(dir.x, dir.y) * 2 / PI, dir.z) * 5.0 - time_of_day * 0.00005).x - 0.5) * 0.075 / (1.0 + pow(dir.z, 2) * 10);
|
||||
#endif
|
||||
|
||||
/* const float RAYLEIGH = 0.25; */
|
||||
const vec3 RAYLEIGH = vec3(0.001, 1.3, 5.0);
|
||||
|
||||
// Proportion of sunlight that get scattered back into the camera by clouds
|
||||
float sun_scatter = max(dot(-dir, sun_dir.xyz), 0.5);
|
||||
float moon_scatter = max(dot(-dir, moon_dir.xyz), 0.5);
|
||||
vec3 sky_color = get_sky_color();
|
||||
float sun_scatter = pow(dot(-dir, sun_dir.xyz) * 0.5 + 0.5, 2) + 0.25;
|
||||
float moon_scatter = pow(dot(-dir, moon_dir.xyz) * 0.5 + 0.5, 2) + 0.25;
|
||||
float net_light = get_sun_brightness() + get_moon_brightness();
|
||||
vec3 sky_color = RAYLEIGH * net_light;
|
||||
|
||||
float cdist = max_dist;
|
||||
float ldist = cdist;
|
||||
@ -196,22 +214,21 @@ vec3 get_cloud_color(vec3 surf_color, vec3 dir, vec3 origin, const float time_of
|
||||
|
||||
float sun_access = sample.x;
|
||||
float moon_access = sample.y;
|
||||
float scatter_factor = 1.0 - 1.0 / (1.0 + density_integrals.x);
|
||||
|
||||
const float RAYLEIGH = 0.25;
|
||||
float cloud_scatter_factor = 1.0 - 1.0 / (1.0 + clamp(density_integrals.x, 0, 1));
|
||||
float global_scatter_factor = 1.0 - 1.0 / (1.0 + clamp(density_integrals.y, 0, 1));
|
||||
|
||||
surf_color =
|
||||
// Attenuate light passing through the clouds
|
||||
surf_color * (1.0 - scatter_factor) +
|
||||
surf_color * (1.0 - cloud_scatter_factor - global_scatter_factor) +
|
||||
// This is not rayleigh scattering, but it's good enough for our purposes (only considers sun)
|
||||
(1.0 - surf_color) * net_light * sky_color * density_integrals.y * RAYLEIGH +
|
||||
(1.0 - surf_color) * net_light * sky_color * density_integrals.y +
|
||||
// Add the directed light light scattered into the camera by the clouds
|
||||
get_sun_color() * sun_scatter * sun_access * scatter_factor * get_sun_brightness() +
|
||||
get_moon_color() * moon_scatter * moon_access * scatter_factor * get_moon_brightness() +
|
||||
get_sun_color() * sun_scatter * (sun_access * cloud_scatter_factor + global_scatter_factor) * get_sun_brightness() +
|
||||
get_moon_color() * moon_scatter * moon_access * cloud_scatter_factor * get_moon_brightness() +
|
||||
emission * density_integrals.y +
|
||||
// Global illumination (uniform scatter from the sky)
|
||||
sky_color * sun_access * scatter_factor * get_sun_brightness() +
|
||||
sky_color * moon_access * scatter_factor * get_moon_brightness();
|
||||
(sun_access * cloud_scatter_factor + sky_color * global_scatter_factor) * get_sun_brightness() +
|
||||
(moon_access * cloud_scatter_factor + sky_color * global_scatter_factor) * get_moon_brightness();
|
||||
}
|
||||
|
||||
return surf_color;
|
||||
|
@ -76,17 +76,16 @@ vec3 glow_light(vec3 pos) {
|
||||
// return normalize(-vec3(sin(moon_angle_rad), 0.0, cos(moon_angle_rad) - 0.5));
|
||||
//}
|
||||
|
||||
float CLOUD_AVG_ALT = view_distance.z + 0.75 * view_distance.w;
|
||||
float CLOUD_AVG_ALT = view_distance.z + 1.25 * view_distance.w;
|
||||
|
||||
const float wind_speed = 0.25;
|
||||
vec2 wind_offset = vec2(time_of_day.x * wind_speed);
|
||||
|
||||
float cloud_scale = view_distance.z / 150.0;
|
||||
|
||||
float cloud_tendency_at(vec2 pos) {
|
||||
float nz = texture(t_noise, (pos + wind_offset) * 0.000075).x - 0.5;
|
||||
nz = clamp(nz, 0, 1);
|
||||
#if (CLOUD_MODE >= CLOUD_MODE_MEDIUM)
|
||||
nz += (texture(t_noise, (pos + wind_offset) * 0.00035).x - 0.5) * 0.15;
|
||||
#endif
|
||||
float nz = texture(t_noise, (pos + wind_offset) / 60000.0 / cloud_scale).x - 0.3;
|
||||
nz = pow(clamp(nz, 0, 1), 4);
|
||||
return nz;
|
||||
}
|
||||
|
||||
@ -101,7 +100,7 @@ float cloud_shadow(vec3 pos, vec3 light_dir) {
|
||||
float fade = 1.0 - clamp((length(xy_offset) - FADE_RANGE.x) / (FADE_RANGE.y - FADE_RANGE.x), 0, 1);
|
||||
float cloud = cloud_tendency_at(pos.xy + focus_off.xy - xy_offset);
|
||||
|
||||
cloud = cloud * 2.0;
|
||||
cloud = cloud * 15.0;
|
||||
|
||||
return clamp(1 - fade * cloud * 1.65, 0, 1);
|
||||
#endif
|
||||
@ -112,7 +111,7 @@ float get_sun_brightness(/*vec3 sun_dir*/) {
|
||||
}
|
||||
|
||||
float get_moon_brightness(/*vec3 moon_dir*/) {
|
||||
return max(-moon_dir.z + 0.6, 0.0) * 0.2;
|
||||
return max(-moon_dir.z + 0.6, 0.0) * 0.01;
|
||||
}
|
||||
|
||||
vec3 get_sun_color(/*vec3 sun_dir*/) {
|
||||
@ -142,7 +141,7 @@ vec3 get_sky_color(/*vec3 sun_dir*/) {
|
||||
}
|
||||
|
||||
vec3 get_moon_color(/*vec3 moon_dir*/) {
|
||||
return vec3(0.05, 0.05, 0.6);
|
||||
return vec3(0.05, 0.05, 1.6);
|
||||
}
|
||||
|
||||
DirectionalLight get_sun_info(vec4 _dir, float shade_frac/*, vec4 light_pos[2]*/, /*vec4 sun_pos*/vec3 f_pos) {
|
||||
@ -413,7 +412,7 @@ float is_star_at(vec3 dir) {
|
||||
|
||||
//return 0.0;
|
||||
|
||||
return 1.0 / (1.0 + pow(dist * 1000, 8));
|
||||
return 0.25 / (1.0 + pow(dist * 750, 8));
|
||||
}
|
||||
|
||||
vec3 get_sky_color(vec3 dir, float time_of_day, vec3 origin, vec3 f_pos, float quality, bool with_features, float refractionIndex) {
|
||||
@ -434,7 +433,7 @@ vec3 get_sky_color(vec3 dir, float time_of_day, vec3 origin, vec3 f_pos, float q
|
||||
}
|
||||
|
||||
// Sun
|
||||
const vec3 SUN_SURF_COLOR = vec3(1.5, 0.9, 0.35) * 3.0;
|
||||
const vec3 SUN_SURF_COLOR = vec3(1.5, 0.9, 0.35) * 4.0;
|
||||
|
||||
vec3 sun_halo_color = mix(
|
||||
SUN_HALO_DUSK,
|
||||
@ -442,7 +441,7 @@ vec3 get_sky_color(vec3 dir, float time_of_day, vec3 origin, vec3 f_pos, float q
|
||||
max(-sun_dir.z, 0.0)
|
||||
);
|
||||
|
||||
vec3 sun_halo = sun_halo_color * 16 * pow(max(dot(dir, -sun_dir), 0), 8.0);
|
||||
vec3 sun_halo = sun_halo_color * 16 * pow(max(dot(dir, -sun_dir), 0), 20.0);
|
||||
vec3 sun_surf = vec3(0);
|
||||
if (with_features) {
|
||||
float angle = 0.00035;
|
||||
@ -455,7 +454,7 @@ vec3 get_sky_color(vec3 dir, float time_of_day, vec3 origin, vec3 f_pos, float q
|
||||
const vec3 MOON_HALO_COLOR = vec3(0.015, 0.015, 0.05) * 25;
|
||||
|
||||
vec3 moon_halo_color = MOON_HALO_COLOR;
|
||||
vec3 moon_halo = moon_halo_color * pow(max(dot(dir, -moon_dir), 0), 500.0);
|
||||
vec3 moon_halo = moon_halo_color * 4 * pow(max(dot(dir, -moon_dir), 0), 4000.0);
|
||||
vec3 moon_surf = vec3(0);
|
||||
if (with_features) {
|
||||
float angle = 0.00035;
|
||||
@ -465,6 +464,7 @@ vec3 get_sky_color(vec3 dir, float time_of_day, vec3 origin, vec3 f_pos, float q
|
||||
|
||||
// Replaced all clamp(sun_dir, 0, 1) with max(sun_dir, 0) because sun_dir is calculated from sin and cos, which are never > 1
|
||||
|
||||
/*
|
||||
vec3 sky_top = mix(
|
||||
mix(
|
||||
SKY_DUSK_TOP + star / (1.0 + moon_surf * 100.0),
|
||||
@ -503,14 +503,9 @@ vec3 get_sky_color(vec3 dir, float time_of_day, vec3 origin, vec3 f_pos, float q
|
||||
sky_top,
|
||||
max(dir.z, 0)
|
||||
);
|
||||
*/
|
||||
|
||||
// Approximate distance to fragment
|
||||
float f_dist = distance(origin, f_pos);
|
||||
|
||||
if (f_dist > 5000.0) {
|
||||
sky_color += sun_light + moon_light;
|
||||
}
|
||||
return sky_color;
|
||||
return star + sun_light + moon_light;
|
||||
}
|
||||
|
||||
vec3 get_sky_color(vec3 dir, float time_of_day, vec3 origin, vec3 f_pos, float quality, bool with_stars) {
|
||||
|
@ -648,7 +648,7 @@ void main() {
|
||||
float passthrough = dot(faceforward(f_norm, f_norm, cam_to_frag), -cam_to_frag);
|
||||
|
||||
vec3 reflect_color = get_sky_color(reflect_ray, time_of_day.x, f_pos, vec3(-100000), 0.125, true);
|
||||
reflect_color = get_cloud_color(reflect_color, reflect_ray, cam_pos.xyz, time_of_day.x, 100000.0, 0.25);
|
||||
reflect_color = get_cloud_color(reflect_color, reflect_ray, cam_pos.xyz, time_of_day.x, 100000.0, 0.1);
|
||||
|
||||
const float REFLECTANCE = 0.5;
|
||||
surf_color = illuminate(max_light, view_dir, f_col * emitted_light, reflect_color * REFLECTANCE + water_color * reflected_light);
|
||||
|
@ -294,7 +294,7 @@ void main() {
|
||||
);
|
||||
} else if (inst_mode == SNOW) {
|
||||
float height = mix(-4, 60, pow(start_end(1, 0), 3));
|
||||
float wind_speed = (inst_pos.z - 250) * 0.025;
|
||||
float wind_speed = (inst_pos.z - 2000) * 0.025;
|
||||
vec3 offset = linear_motion(vec3(0), vec3(1, 1, 0) * wind_speed);
|
||||
float end_alt = alt_at(start_pos.xy + offset.xy);
|
||||
attr = Attr(
|
||||
|
BIN
assets/voxygen/texture/noise.png
(Stored with Git LFS)
BIN
assets/voxygen/texture/noise.png
(Stored with Git LFS)
Binary file not shown.
@ -568,7 +568,7 @@ fn trade_at_site(
|
||||
break;
|
||||
}
|
||||
}
|
||||
let mut paid_amount = allocated_amount - balance / *price;
|
||||
let mut paid_amount = (allocated_amount - balance / *price).min(economy.stocks[*g]);
|
||||
if paid_amount / allocated_amount < 0.95 {
|
||||
debug!(
|
||||
"Client {} is broke on {:?} : {} {} severity {}",
|
||||
|
Loading…
Reference in New Issue
Block a user