From 22ddbad3eb32bfa70f0932176022208fe67ded81 Mon Sep 17 00:00:00 2001 From: Joshua Yanovski Date: Sat, 2 May 2020 18:54:09 +0200 Subject: [PATCH] Minor shader fixes. --- assets/voxygen/shaders/fluid-vert.glsl | 4 ++-- assets/voxygen/shaders/include/srgb.glsl | 8 ++++---- assets/voxygen/shaders/terrain-frag.glsl | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/assets/voxygen/shaders/fluid-vert.glsl b/assets/voxygen/shaders/fluid-vert.glsl index 73ee026219..5c4bb3f758 100644 --- a/assets/voxygen/shaders/fluid-vert.glsl +++ b/assets/voxygen/shaders/fluid-vert.glsl @@ -21,8 +21,8 @@ const float EXTRA_NEG_Z = 65536.0; void main() { f_pos = vec3((uvec3(v_pos_norm) >> uvec3(0, 6, 12)) & uvec3(0x3Fu, 0x3Fu, 0x1FFFFu)) - vec3(0, 0, EXTRA_NEG_Z) + model_offs; - f_pos.z -= 250.0 * (1.0 - min(1.0001 - 0.02 / pow(tick.x - load_time, 10.0), 1.0)); - f_pos.z -= min(32.0, 25.0 * pow(distance(focus_pos.xy, f_pos.xy) / view_distance.x, 20.0)); + // f_pos.z -= 250.0 * (1.0 - min(1.0001 - 0.02 / pow(tick.x - load_time, 10.0), 1.0)); + // f_pos.z -= min(32.0, 25.0 * pow(distance(focus_pos.xy, f_pos.xy) / view_distance.x, 20.0)); // Small waves f_pos.xy += 0.01; // Avoid z-fighting diff --git a/assets/voxygen/shaders/include/srgb.glsl b/assets/voxygen/shaders/include/srgb.glsl index 8d85d0a701..360b5f4b3b 100644 --- a/assets/voxygen/shaders/include/srgb.glsl +++ b/assets/voxygen/shaders/include/srgb.glsl @@ -291,11 +291,11 @@ vec3 light_reflection_factor(vec3 norm, vec3 dir, vec3 light_dir, vec3 k_d, vec3 } vec3 light_reflection_factor(vec3 norm, vec3 dir, vec3 light_dir, vec3 k_d, vec3 k_s, float alpha, float voxel_lighting) { - if (voxel_lighting < 1.0) { + //if (voxel_lighting < 1.0) { return FresnelBlend_Voxel_f(norm, dir, light_dir, k_d/* * max(dot(norm, -light_dir), 0.0)*/, k_s, alpha, voxel_lighting); - } else { - return FresnelBlend_f(norm, dir, light_dir, k_d/* * max(dot(norm, -light_dir), 0.0)*/, k_s, alpha); - } + //} else { + // return FresnelBlend_f(norm, dir, light_dir, k_d/* * max(dot(norm, -light_dir), 0.0)*/, k_s, alpha); + //} } float rel_luminance(vec3 rgb) diff --git a/assets/voxygen/shaders/terrain-frag.glsl b/assets/voxygen/shaders/terrain-frag.glsl index 9ccefa8edb..914213af47 100644 --- a/assets/voxygen/shaders/terrain-frag.glsl +++ b/assets/voxygen/shaders/terrain-frag.glsl @@ -51,7 +51,7 @@ void main() { const float R_s2s1 = pow((1.0 - 1.3325) / (1.0 + 1.3325), 2); const float R_s1s2 = pow((1.3325 - 1.0) / (1.3325 + 1.0), 2); // float faces_fluid = faces_fluid && f_pos.z <= floor(f_alt); - float fluid_alt = max(ceil(f_pos.z), floor(f_alt)); + float fluid_alt = max(f_pos.z + 1, floor(f_alt)); float R_s = /*(f_pos.z < f_alt)*/faces_fluid /*&& f_pos.z <= fluid_alt*/ ? mix(R_s2s1 * R_s1s0, R_s1s0, medium.x) : mix(R_s2s0, R_s1s2 * R_s2s0, medium.x); // vec3 surf_color = /*srgb_to_linear*/(f_col);