aboutsummaryrefslogtreecommitdiff
path: root/client/shaders/nodes_shader/opengl_fragment.glsl
diff options
context:
space:
mode:
authorhecks <42101236+hecktest@users.noreply.github.com>2020-09-14 19:27:25 +0200
committerGitHub <noreply@github.com>2020-09-14 19:27:25 +0200
commitfcff9f291103411af6d8f946fbb275b6fa0583b9 (patch)
tree60e33f8decb59a4a04265a2563b5bf56a5c1aad5 /client/shaders/nodes_shader/opengl_fragment.glsl
parent3fb1f45301880a3aa901b752af1ecc912efe5915 (diff)
downloadminetest-fcff9f291103411af6d8f946fbb275b6fa0583b9.tar.gz
minetest-fcff9f291103411af6d8f946fbb275b6fa0583b9.tar.bz2
minetest-fcff9f291103411af6d8f946fbb275b6fa0583b9.zip
Remove "generate normal maps" feature (#10313)
Erase all traces of normal "generation" from fragment shaders Remove the "feature" from the engine and default config Remove any leftover documentation of it
Diffstat (limited to 'client/shaders/nodes_shader/opengl_fragment.glsl')
-rw-r--r--client/shaders/nodes_shader/opengl_fragment.glsl47
1 files changed, 2 insertions, 45 deletions
diff --git a/client/shaders/nodes_shader/opengl_fragment.glsl b/client/shaders/nodes_shader/opengl_fragment.glsl
index 7213612bd..437b325d3 100644
--- a/client/shaders/nodes_shader/opengl_fragment.glsl
+++ b/client/shaders/nodes_shader/opengl_fragment.glsl
@@ -71,16 +71,6 @@ void get_texture_flags()
}
}
-float intensity(vec3 color)
-{
- return (color.r + color.g + color.b) / 3.0;
-}
-
-float get_rgb_height(vec2 uv)
-{
- return intensity(texture2D(baseTexture, uv).rgb);
-}
-
vec4 get_normal_map(vec2 uv)
{
vec4 bump = texture2D(normalTexture, uv).rgba;
@@ -115,19 +105,6 @@ float find_intersection(vec2 dp, vec2 ds)
return best_depth;
}
-float find_intersectionRGB(vec2 dp, vec2 ds)
-{
- const float depth_step = 1.0 / 24.0;
- float depth = 1.0;
- for (int i = 0 ; i < 24 ; i++) {
- float h = get_rgb_height(dp + ds * depth);
- if (h >= depth)
- break;
- depth -= depth_step;
- }
- return depth;
-}
-
void main(void)
{
vec3 color;
@@ -149,21 +126,17 @@ void main(void)
float h = normal.a * scale - bias;
uv += h * normal.z * eyeRay;
}
+ }
#endif
-
#if PARALLAX_OCCLUSION_MODE == 1
// Relief mapping
if (normalTexturePresent && area_enable_parallax > 0.0) {
vec2 ds = eyeRay * PARALLAX_OCCLUSION_SCALE;
float dist = find_intersection(uv, ds);
uv += dist * ds;
-#endif
- } else if (GENERATE_NORMALMAPS == 1 && area_enable_parallax > 0.0) {
- vec2 ds = eyeRay * PARALLAX_OCCLUSION_SCALE;
- float dist = find_intersectionRGB(uv, ds);
- uv += dist * ds;
}
#endif
+#endif
#if USE_NORMALMAPS == 1
if (normalTexturePresent) {
@@ -172,22 +145,6 @@ void main(void)
}
#endif
-#if GENERATE_NORMALMAPS == 1
- if (normalTexturePresent == false) {
- float tl = get_rgb_height(vec2(uv.x - SAMPLE_STEP, uv.y + SAMPLE_STEP));
- float t = get_rgb_height(vec2(uv.x - SAMPLE_STEP, uv.y - SAMPLE_STEP));
- float tr = get_rgb_height(vec2(uv.x + SAMPLE_STEP, uv.y + SAMPLE_STEP));
- float r = get_rgb_height(vec2(uv.x + SAMPLE_STEP, uv.y));
- float br = get_rgb_height(vec2(uv.x + SAMPLE_STEP, uv.y - SAMPLE_STEP));
- float b = get_rgb_height(vec2(uv.x, uv.y - SAMPLE_STEP));
- float bl = get_rgb_height(vec2(uv.x -SAMPLE_STEP, uv.y - SAMPLE_STEP));
- float l = get_rgb_height(vec2(uv.x - SAMPLE_STEP, uv.y));
- float dX = (tr + 2.0 * r + br) - (tl + 2.0 * l + bl);
- float dY = (bl + 2.0 * b + br) - (tl + 2.0 * t + tr);
- bump = vec4(normalize(vec3 (dX, dY, NORMALMAPS_STRENGTH)), 1.0);
- use_normalmap = true;
- }
-#endif
vec4 base = texture2D(baseTexture, uv).rgba;
#ifdef USE_DISCARD