]> git.lizzy.rs Git - dragonblocks_alpha.git/blobdiff - shaders/3d/fragment.glsl
Fragment shader optimizations
[dragonblocks_alpha.git] / shaders / 3d / fragment.glsl
index dcfb212810f05672a9005d0669c2e79e31934538..653d579d3c372aa9ac3b322d2d6d2ce38fad5ae8 100755 (executable)
@@ -6,25 +6,14 @@ in vec3 fragmentColor;
 
 out vec4 outColor;
 
-uniform float daylight;
-uniform vec3 lightDir;
+uniform vec3 fogColor;
 uniform vec3 cameraPos;
 uniform sampler2D textures[MAX_TEXTURE_UNITS];
 
 void main()
 {
-       vec3 lightColor = vec3(1.0);
-       vec3 fogColor = mix(vec3(0x03, 0x0A, 0x1A), vec3(0x87, 0xCE, 0xEB), daylight) / vec3(0xFF);
-
-       float ambientStrength = mix(0.3, 0.7, daylight);
-
-       vec3 ambient = ambientStrength * lightColor;
-       vec3 diffuse = 0.3 * daylight * clamp(dot(normalize(fragmentNormal), normalize(lightDir)), 0.0, 1.0) * lightColor;
-
-       vec3 light = ambient + diffuse;
-
-       outColor = texture(textures[int(fragmentTextureIndex + 0.5)], fragmentTextureCoords) * vec4(fragmentColor, 1.0) * vec4(light, 1.0);
-       outColor.rgb = mix(outColor.rgb, ambientStrength * fogColor, clamp(length(fragmentPosition - cameraPos) / 255.0, 0.0, 1.0));
+       outColor = texture(textures[int(fragmentTextureIndex + 0.5)], fragmentTextureCoords) * vec4(fragmentColor, 1.0);
+       outColor.rgb = mix(outColor.rgb, fogColor, clamp(length(fragmentPosition - cameraPos) / 255.0, 0.0, 1.0));
 
        if (outColor.a == 0.0)
                discard;