]> git.lizzy.rs Git - minetest.git/blobdiff - client/shaders/nodes_shader/opengl_vertex.glsl
Make faces shading correct for all possible modes.
[minetest.git] / client / shaders / nodes_shader / opengl_vertex.glsl
index 88e489e6ca6e0dacd6e13045125fb60ce22f1e07..28d3e8ed828be998616e3451d1c61da6d043350b 100644 (file)
@@ -63,35 +63,28 @@ void main(void)
 \r
        vec3 normal, tangent, binormal;\r
        normal = normalize(gl_NormalMatrix * gl_Normal);\r
-       float tileContrast = 1.0;\r
        if (gl_Normal.x > 0.5) {\r
                //  1.0,  0.0,  0.0\r
-               tileContrast = 0.8;\r
                tangent  = normalize(gl_NormalMatrix * vec3( 0.0,  0.0, -1.0));\r
                binormal = normalize(gl_NormalMatrix * vec3( 0.0, -1.0,  0.0));\r
        } else if (gl_Normal.x < -0.5) {\r
                // -1.0,  0.0,  0.0\r
-               tileContrast = 0.8;\r
                tangent  = normalize(gl_NormalMatrix * vec3( 0.0,  0.0,  1.0));\r
                binormal = normalize(gl_NormalMatrix * vec3( 0.0, -1.0,  0.0));\r
        } else if (gl_Normal.y > 0.5) {\r
                //  0.0,  1.0,  0.0\r
-               tileContrast = 1.2;\r
                tangent  = normalize(gl_NormalMatrix * vec3( 1.0,  0.0,  0.0));\r
                binormal = normalize(gl_NormalMatrix * vec3( 0.0,  0.0,  1.0));\r
        } else if (gl_Normal.y < -0.5) {\r
                //  0.0, -1.0,  0.0\r
-               tileContrast = 0.3;\r
                tangent  = normalize(gl_NormalMatrix * vec3( 1.0,  0.0,  0.0));\r
                binormal = normalize(gl_NormalMatrix * vec3( 0.0,  0.0,  1.0));\r
        } else if (gl_Normal.z > 0.5) {\r
                //  0.0,  0.0,  1.0\r
-               tileContrast = 0.5;\r
                tangent  = normalize(gl_NormalMatrix * vec3( 1.0,  0.0,  0.0));\r
                binormal = normalize(gl_NormalMatrix * vec3( 0.0, -1.0,  0.0));\r
        } else if (gl_Normal.z < -0.5) {\r
                //  0.0,  0.0, -1.0\r
-               tileContrast = 0.5;\r
                tangent  = normalize(gl_NormalMatrix * vec3(-1.0,  0.0,  0.0));\r
                binormal = normalize(gl_NormalMatrix * vec3( 0.0, -1.0,  0.0));\r
        }\r
@@ -115,7 +108,7 @@ void main(void)
 \r
        // Moonlight is blue\r
        b += (day - night) / 13.0;\r
-       rg -= (day - night) / 13.0;\r
+       rg -= (day - night) / 23.0;\r
 \r
        // Emphase blue a bit in darker places\r
        // See C++ implementation in mapblock_mesh.cpp finalColorBlend()\r
@@ -129,13 +122,6 @@ void main(void)
        color.g = rg;\r
        color.b = b;\r
 \r
-#if !(MATERIAL_TYPE == TILE_MATERIAL_LIQUID_TRANSPARENT || MATERIAL_TYPE == TILE_MATERIAL_LIQUID_OPAQUE)\r
-       // Make sides and bottom darker than the top\r
-       color = color * color; // SRGB -> Linear\r
-       color *= tileContrast;\r
-       color = sqrt(color); // Linear -> SRGB\r
-#endif\r
-\r
        color.a = gl_Color.a;\r
        gl_FrontColor = gl_BackColor = clamp(color,0.0,1.0);\r
 }\r