]> git.lizzy.rs Git - dragonfireclient.git/commitdiff
Remove "generate normal maps" feature (#10313)
authorhecks <42101236+hecktest@users.noreply.github.com>
Mon, 14 Sep 2020 17:27:25 +0000 (19:27 +0200)
committerGitHub <noreply@github.com>
Mon, 14 Sep 2020 17:27:25 +0000 (19:27 +0200)
Erase all traces of normal "generation" from fragment shaders
Remove the "feature" from the engine and default config
Remove any leftover documentation of it

builtin/mainmenu/tab_settings.lua
builtin/settingtypes.txt
client/shaders/nodes_shader/opengl_fragment.glsl
client/shaders/object_shader/opengl_fragment.glsl
minetest.conf.example
src/client/shader.cpp
src/defaultsettings.cpp
src/settings_translation_file.cpp

index 02b15c81b7e1264821c1e486bf9af8ac745b111a..510346f8d2ec0f95a84df12929d43eefed20fd89 100644 (file)
@@ -191,15 +191,13 @@ local function formspec(tabview, name, tabdata)
                                        .. dump(core.settings:get_bool("enable_bumpmapping")) .. "]" ..
                        "checkbox[8.25,1;cb_tonemapping;" .. fgettext("Tone Mapping") .. ";"
                                        .. dump(core.settings:get_bool("tone_mapping")) .. "]" ..
-                       "checkbox[8.25,1.5;cb_generate_normalmaps;" .. fgettext("Generate Normal Maps") .. ";"
-                                       .. dump(core.settings:get_bool("generate_normalmaps")) .. "]" ..
-                       "checkbox[8.25,2;cb_parallax;" .. fgettext("Parallax Occlusion") .. ";"
+                       "checkbox[8.25,1.5;cb_parallax;" .. fgettext("Parallax Occlusion") .. ";"
                                        .. dump(core.settings:get_bool("enable_parallax_occlusion")) .. "]" ..
-                       "checkbox[8.25,2.5;cb_waving_water;" .. fgettext("Waving Liquids") .. ";"
+                       "checkbox[8.25,2;cb_waving_water;" .. fgettext("Waving Liquids") .. ";"
                                        .. dump(core.settings:get_bool("enable_waving_water")) .. "]" ..
-                       "checkbox[8.25,3;cb_waving_leaves;" .. fgettext("Waving Leaves") .. ";"
+                       "checkbox[8.25,2.5;cb_waving_leaves;" .. fgettext("Waving Leaves") .. ";"
                                        .. dump(core.settings:get_bool("enable_waving_leaves")) .. "]" ..
-                       "checkbox[8.25,3.5;cb_waving_plants;" .. fgettext("Waving Plants") .. ";"
+                       "checkbox[8.25,3;cb_waving_plants;" .. fgettext("Waving Plants") .. ";"
                                        .. dump(core.settings:get_bool("enable_waving_plants")) .. "]"
        else
                tab_string = tab_string ..
@@ -208,14 +206,12 @@ local function formspec(tabview, name, tabdata)
                        "label[8.38,1.2;" .. core.colorize("#888888",
                                        fgettext("Tone Mapping")) .. "]" ..
                        "label[8.38,1.7;" .. core.colorize("#888888",
-                                       fgettext("Generate Normal Maps")) .. "]" ..
-                       "label[8.38,2.2;" .. core.colorize("#888888",
                                        fgettext("Parallax Occlusion")) .. "]" ..
-                       "label[8.38,2.7;" .. core.colorize("#888888",
+                       "label[8.38,2.2;" .. core.colorize("#888888",
                                        fgettext("Waving Liquids")) .. "]" ..
-                       "label[8.38,3.2;" .. core.colorize("#888888",
+                       "label[8.38,2.7;" .. core.colorize("#888888",
                                        fgettext("Waving Leaves")) .. "]" ..
-                       "label[8.38,3.7;" .. core.colorize("#888888",
+                       "label[8.38,3.2;" .. core.colorize("#888888",
                                        fgettext("Waving Plants")) .. "]"
        end
 
@@ -275,10 +271,6 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
                core.settings:set("tone_mapping", fields["cb_tonemapping"])
                return true
        end
-       if fields["cb_generate_normalmaps"] then
-               core.settings:set("generate_normalmaps", fields["cb_generate_normalmaps"])
-               return true
-       end
        if fields["cb_parallax"] then
                core.settings:set("enable_parallax_occlusion", fields["cb_parallax"])
                return true
index 39cc22d62362cb99b62bef042a6d89ea1503ddbb..6d9c6f573a24383df4da2cdc513f62e4e15648b6 100644 (file)
@@ -543,22 +543,10 @@ tone_mapping (Filmic tone mapping) bool false
 
 [***Bumpmapping]
 
-#    Enables bumpmapping for textures. Normalmaps need to be supplied by the texture pack
-#    or need to be auto-generated.
+#    Enables bumpmapping for textures. Normalmaps need to be supplied by the texture pack.
 #    Requires shaders to be enabled.
 enable_bumpmapping (Bumpmapping) bool false
 
-#    Enables on the fly normalmap generation (Emboss effect).
-#    Requires bumpmapping to be enabled.
-generate_normalmaps (Generate normalmaps) bool false
-
-#    Strength of generated normalmaps.
-normalmaps_strength (Normalmaps strength) float 0.6
-
-#    Defines sampling step of texture.
-#    A higher value results in smoother normal maps.
-normalmaps_smooth (Normalmaps sampling) int 0 0 2
-
 [***Parallax Occlusion]
 
 #    Enables parallax occlusion mapping.
index 7213612bd25d21c3dc30fcb3269f78c96d6da8a0..437b325d3f831e35afe9b7190edcc909ca91b5fa 100644 (file)
@@ -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
index 2d33ca4392ddd15fbd71aecb771a1568e80ec78a..a8a43e1e25af307e69fcc5efcd078354c616e264 100644 (file)
@@ -74,20 +74,6 @@ void get_texture_flags()
        }
 }
 
-float intensity(vec3 color)
-{
-       return (color.r + color.g + color.b) / 3.0;
-}
-
-float get_rgb_height(vec2 uv)
-{
-       if (texSeamless) {
-               return intensity(texture2D(baseTexture, uv).rgb);
-       } else {
-               return intensity(texture2D(baseTexture, clamp(uv, 0.0, 0.999)).rgb);
-       }
-}
-
 vec4 get_normal_map(vec2 uv)
 {
        vec4 bump = texture2D(normalTexture, uv).rgba;
@@ -110,23 +96,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
index 5201257130cfdbea1f86ec5447d4f1f41034da77..6b315b6eac3a4d4f5e4d25a3e8df5b5cbddf3ba7 100644 (file)
 
 #### Bumpmapping
 
-#    Enables bumpmapping for textures. Normalmaps need to be supplied by the texture pack
-#    or need to be auto-generated.
+#    Enables bumpmapping for textures. Normalmaps need to be supplied by the texture pack.
 #    Requires shaders to be enabled.
 #    type: bool
 # enable_bumpmapping = false
 
-#    Enables on the fly normalmap generation (Emboss effect).
-#    Requires bumpmapping to be enabled.
-#    type: bool
-# generate_normalmaps = false
-
-#    Strength of generated normalmaps.
-#    type: float
-# normalmaps_strength = 0.6
-
-#    Defines sampling step of texture.
-#    A higher value results in smoother normal maps.
-#    type: int min: 0 max: 2
-# normalmaps_smooth = 0
-
 #### Parallax Occlusion
 
 #    Enables parallax occlusion mapping.
index fc0a72319827c2880eb3d50093a1a5672e6e9372..c5fe5dfe00bc28b5fcaa1cfcc25eb1a24eda6cde 100644 (file)
@@ -688,34 +688,6 @@ ShaderInfo generate_shader(const std::string &name, u8 material_type, u8 drawtyp
        shaders_header += itos(drawtype);
        shaders_header += "\n";
 
-       if (g_settings->getBool("generate_normalmaps")) {
-               shaders_header += "#define GENERATE_NORMALMAPS 1\n";
-       } else {
-               shaders_header += "#define GENERATE_NORMALMAPS 0\n";
-       }
-       shaders_header += "#define NORMALMAPS_STRENGTH ";
-       shaders_header += ftos(g_settings->getFloat("normalmaps_strength"));
-       shaders_header += "\n";
-       float sample_step;
-       int smooth = (int)g_settings->getFloat("normalmaps_smooth");
-       switch (smooth){
-       case 0:
-               sample_step = 0.0078125; // 1.0 / 128.0
-               break;
-       case 1:
-               sample_step = 0.00390625; // 1.0 / 256.0
-               break;
-       case 2:
-               sample_step = 0.001953125; // 1.0 / 512.0
-               break;
-       default:
-               sample_step = 0.0078125;
-               break;
-       }
-       shaders_header += "#define SAMPLE_STEP ";
-       shaders_header += ftos(sample_step);
-       shaders_header += "\n";
-
        if (g_settings->getBool("enable_bumpmapping"))
                shaders_header += "#define ENABLE_BUMPMAPPING\n";
 
index d2115c959b7e0a16a1615a19e30c63e57030593f..3a0b88dc21b51e3099deaa7f8ce711571b650fec 100644 (file)
@@ -253,9 +253,6 @@ void set_default_settings(Settings *settings)
        settings->setDefault("tone_mapping", "false");
        settings->setDefault("enable_bumpmapping", "false");
        settings->setDefault("enable_parallax_occlusion", "false");
-       settings->setDefault("generate_normalmaps", "false");
-       settings->setDefault("normalmaps_strength", "0.6");
-       settings->setDefault("normalmaps_smooth", "1");
        settings->setDefault("parallax_occlusion_mode", "1");
        settings->setDefault("parallax_occlusion_iterations", "4");
        settings->setDefault("parallax_occlusion_scale", "0.08");
index febfbb9d3ad975da963a1bbfd33bbd50b15f2064..0cd772337fc160391443ba329ec6e541851a83b8 100644 (file)
@@ -242,13 +242,7 @@ fake_function() {
        gettext("Enables Hable's 'Uncharted 2' filmic tone mapping.\nSimulates the tone curve of photographic film and how this approximates the\nappearance of high dynamic range images. Mid-range contrast is slightly\nenhanced, highlights and shadows are gradually compressed.");
        gettext("Bumpmapping");
        gettext("Bumpmapping");
-       gettext("Enables bumpmapping for textures. Normalmaps need to be supplied by the texture pack\nor need to be auto-generated.\nRequires shaders to be enabled.");
-       gettext("Generate normalmaps");
-       gettext("Enables on the fly normalmap generation (Emboss effect).\nRequires bumpmapping to be enabled.");
-       gettext("Normalmaps strength");
-       gettext("Strength of generated normalmaps.");
-       gettext("Normalmaps sampling");
-       gettext("Defines sampling step of texture.\nA higher value results in smoother normal maps.");
+       gettext("Enables bumpmapping for textures. Normalmaps need to be supplied by the texture pack.\nRequires shaders to be enabled.");
        gettext("Parallax Occlusion");
        gettext("Parallax occlusion");
        gettext("Enables parallax occlusion mapping.\nRequires shaders to be enabled.");