From 46dc49bc0a19675d11d7a11f5fe84cfec75e5734 Mon Sep 17 00:00:00 2001 From: Joshua Barretto Date: Tue, 24 Nov 2020 18:44:41 +0000 Subject: [PATCH] Fixed bit-twiddling colour bug --- assets/voxygen/shaders/include/srgb.glsl | 4 ++-- voxygen/src/render/pipelines/terrain.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/assets/voxygen/shaders/include/srgb.glsl b/assets/voxygen/shaders/include/srgb.glsl index 96aa0d0ec7..4ba6ddf5f9 100644 --- a/assets/voxygen/shaders/include/srgb.glsl +++ b/assets/voxygen/shaders/include/srgb.glsl @@ -621,9 +621,9 @@ vec3 compute_attenuation_point(vec3 wpos, vec3 ray_dir, vec3 mu, float surface_a vec3 greedy_extract_col_light_glow(sampler2D t_col_light, vec2 f_uv_pos, out float f_light, out float f_glow) { uvec4 f_col_light = uvec4(texelFetch(t_col_light, ivec2(f_uv_pos), 0) * 255); vec3 f_col = vec3( - float(((f_col_light.r << 1u) & 0xFu) | (((f_col_light.b >> 4u) & 0xFu) << 4u)), + float(((f_col_light.r & 0x7u) << 1u) | (f_col_light.b & 0xF0u)), float(f_col_light.a), - float(((f_col_light.g << 1u) & 0xFu) | (((f_col_light.b >> 0u) & 0xFu) << 4u)) + float(((f_col_light.g & 0x7u) << 1u) | ((f_col_light.b & 0x0Fu) << 4u)) ) / 255.0; // TODO: Figure out how to use `texture` and modulation to avoid needing to do manual filtering diff --git a/voxygen/src/render/pipelines/terrain.rs b/voxygen/src/render/pipelines/terrain.rs index 0dbf62f43f..9f9290aa49 100644 --- a/voxygen/src/render/pipelines/terrain.rs +++ b/voxygen/src/render/pipelines/terrain.rs @@ -127,8 +127,8 @@ impl Vertex { // TODO: This isn't currently working (no idea why). See `srgb.glsl` for current // impl that intead does manual bit-twiddling and filtering. [ - (light.min(31) << 3) | ((col.r & 0b1110) >> 1), - (glow.min(31) << 3) | ((col.r & 0b1110) >> 1), + (light.min(31) << 3) | ((col.r >> 1) & 0b111), + (glow.min(31) << 3) | ((col.b >> 1) & 0b111), (col.r & 0b11110000) | (col.b >> 4), col.g, // Green is lucky, it remains unscathed ]