From ef03137c658e0300d8c28ba57d0893856d9a018f Mon Sep 17 00:00:00 2001 From: Joshua Barretto Date: Tue, 17 Nov 2020 03:00:05 +0000 Subject: [PATCH] Better water, shadows, clouds --- assets/voxygen/shaders/fluid-frag/shiny.glsl | 2 +- assets/voxygen/shaders/include/cloud/regular.glsl | 10 +++++----- assets/voxygen/shaders/include/sky.glsl | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/assets/voxygen/shaders/fluid-frag/shiny.glsl b/assets/voxygen/shaders/fluid-frag/shiny.glsl index b3f0dfae89..f9e0a34e29 100644 --- a/assets/voxygen/shaders/fluid-frag/shiny.glsl +++ b/assets/voxygen/shaders/fluid-frag/shiny.glsl @@ -289,7 +289,7 @@ void main() { // diffuse_light += point_light; // reflected_light += point_light; // vec3 surf_color = srgb_to_linear(vec3(0.2, 0.5, 1.0)) * light * diffuse_light * ambient_light; - vec3 surf_color = illuminate(max_light, view_dir, water_color * emitted_light/* * log(1.0 - MU_WATER)*/, /*cam_attenuation * *//*water_color * */reflect_color * reflected_light/* * log(1.0 - MU_WATER)*/); + vec3 surf_color = illuminate(max_light, view_dir, water_color * emitted_light/* * log(1.0 - MU_WATER)*/, /*cam_attenuation * *//*water_color * */reflect_color /** reflected_light*//* * log(1.0 - MU_WATER)*/); // passthrough = pow(passthrough, 1.0 / (1.0 + water_depth_to_camera)); /* surf_color = cam_attenuation.g < 0.5 ? diff --git a/assets/voxygen/shaders/include/cloud/regular.glsl b/assets/voxygen/shaders/include/cloud/regular.glsl index 9e4998be49..415e87380f 100644 --- a/assets/voxygen/shaders/include/cloud/regular.glsl +++ b/assets/voxygen/shaders/include/cloud/regular.glsl @@ -53,7 +53,7 @@ vec4 cloud_at(vec3 pos, float dist, out vec3 emission) { #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), 2.0)); + cloud_factor = 0.5 * (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 / (1 + pow(1.0 + dist / 10000.0, 2.0)); @@ -71,10 +71,10 @@ vec4 cloud_at(vec3 pos, float dist, out vec3 emission) { vec3 cloud_norm = vec3( (cloud_tendency - cloud_tendency_x) * 6, (cloud_tendency - cloud_tendency_y) * 6, - (pos.z - cloud_attr.x) / 250 + turb_noise - ); - sun_access = mix(clamp(dot(-sun_dir.xyz, cloud_norm), 0.025, 1), sun_access, 0.25); - moon_access = mix(clamp(dot(-moon_dir.xyz, cloud_norm), 0.025, 1), moon_access, 0.25); + (pos.z - cloud_attr.x) / 450 + turb_noise + ) * 0.5; + sun_access = mix(max(dot(-sun_dir.xyz, cloud_norm), 0.025), sun_access, 0.25); + moon_access = mix(max(dot(-moon_dir.xyz, cloud_norm), 0.025), moon_access, 0.25); #endif // Prevent mist (i.e: vapour beneath clouds) being accessible to the sun to avoid visual problems diff --git a/assets/voxygen/shaders/include/sky.glsl b/assets/voxygen/shaders/include/sky.glsl index da9cd220d1..285f5c963f 100644 --- a/assets/voxygen/shaders/include/sky.glsl +++ b/assets/voxygen/shaders/include/sky.glsl @@ -91,7 +91,7 @@ float cloud_shadow(vec3 pos, vec3 light_dir) { cloud = cloud * 2.0; - return clamp(1 - fade * cloud * 3.0, 0, 1); + return clamp(1 - fade * cloud * 1.65, 0, 1); #endif }