From c12e6426fa507d84feb0bfc67527c216191f6a32 Mon Sep 17 00:00:00 2001 From: Joshua Barretto Date: Sun, 15 Jan 2023 19:13:18 +0000 Subject: [PATCH] Fixed rain drop normals and wind direction for sprites --- assets/voxygen/shaders/clouds-frag.glsl | 6 ++++-- assets/voxygen/shaders/sprite-vert.glsl | 12 ++++++------ assets/voxygen/shaders/terrain-frag.glsl | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/assets/voxygen/shaders/clouds-frag.glsl b/assets/voxygen/shaders/clouds-frag.glsl index f912375bdb..e152de2cda 100644 --- a/assets/voxygen/shaders/clouds-frag.glsl +++ b/assets/voxygen/shaders/clouds-frag.glsl @@ -153,9 +153,11 @@ void main() { vec3 refl_dir = reflect(dir, surf_norm); // Don't reflect back into the surface by snapping the reflection to the *actual* (i.e: not normal-mapped) surface plane - if (dot(refl_dir, round(surf_norm)) <= 0.0) { + // TODO: Find a good way to know the *actual* surface normal, minus normal mapping + vec3 flat_norm = vec3(0, 0, 1);//round(surf_norm); + if (dot(refl_dir, flat_norm) <= 0.0) { // TODO: This assumes that the surface is axis-aligned! - refl_dir = normalize(refl_dir.xyz * (1.0 - abs(round(surf_norm)))); + refl_dir = normalize(refl_dir.xyz * (1.0 - abs(flat_norm))); } vec4 clip = (all_mat * vec4(cam_pos.xyz + refl_dir, 1.0)); diff --git a/assets/voxygen/shaders/sprite-vert.glsl b/assets/voxygen/shaders/sprite-vert.glsl index 45d3f27fe7..94ea351f11 100644 --- a/assets/voxygen/shaders/sprite-vert.glsl +++ b/assets/voxygen/shaders/sprite-vert.glsl @@ -80,11 +80,11 @@ float wind_wave(float off, float scaling, float speed, float strength) { // TODO: Right now, the wind model is pretty simplistic. This means that there is frequently no wind at all, which // looks bad. For now, we add a lower bound on the wind speed to keep things looking nice. - strength = max(strength, 3.0); - aspeed = max(aspeed, 3.0); + strength = max(strength, 6.0); + aspeed = max(aspeed, 5.0); - return (sin(tick.x * 0.75 * scaling * floor(aspeed) + off) * (1.0 - fract(aspeed)) - + sin(tick.x * 0.75 * scaling * ceil(aspeed) + off) * fract(aspeed)) * abs(strength) * 0.5; + return (sin(tick.x * 0.35 * scaling * floor(aspeed) + off) * (1.0 - fract(aspeed)) + + sin(tick.x * 0.35 * scaling * ceil(aspeed) + off) * fract(aspeed)) * abs(strength) * 0.25; //return sin(tick.x * 1.5 * scaling + off) + sin(tick.x * 0.35 * scaling + off); } @@ -161,13 +161,13 @@ void main() { #ifndef EXPERIMENTAL_BAREMINIMUM // Wind sway effect - f_pos.xy += (wind_vel * 0.1 + vec2( + f_pos.xy += (wind_vel * 0.35 + vec2( wind_wave(f_pos.y * 0.1, 0.9, wind_vel.x, wind_vel.y), wind_wave(f_pos.x * 0.1, 1.1, wind_vel.y, wind_vel.x) )) * model_wind_sway //* mix(10.0, abs(v_pos.z), 1.0 / (1.0 + abs(v_pos.z) * 0.1)) - * v_pos.z + * abs(v_pos.z) * model_z_scale * SCALE_FACTOR; diff --git a/assets/voxygen/shaders/terrain-frag.glsl b/assets/voxygen/shaders/terrain-frag.glsl index aa0c51e910..5e92ca2c10 100644 --- a/assets/voxygen/shaders/terrain-frag.glsl +++ b/assets/voxygen/shaders/terrain-frag.glsl @@ -281,7 +281,7 @@ void main() { vec3 off = vec3(hash_fast(uvec3(cell * 13)), hash_fast(uvec3(cell * 5)), 0); vec3 near_cell = (cell + 0.5 + (off - 0.5) * 0.5) / drop_density; - float dist = length((drop_pos - near_cell) / vec3(1, 1, 2)); + float dist = length((drop_pos - near_cell) * vec3(1, 1, 0.5)); float drop_rad = 0.075 + puddle * 0.05; float distort = max(1.0 - abs(dist - drop_rad) * 100, 0) * 1.5 * max(drop_pos.z - near_cell.z, 0); k_a += distort;