diff options
Diffstat (limited to '')
-rw-r--r-- | cwd/assets/altcraft/shaders/frag/blur.fs | 22 | ||||
-rw-r--r-- | cwd/assets/altcraft/shaders/frag/light.fs | 3 |
2 files changed, 24 insertions, 1 deletions
diff --git a/cwd/assets/altcraft/shaders/frag/blur.fs b/cwd/assets/altcraft/shaders/frag/blur.fs new file mode 100644 index 0000000..b49032f --- /dev/null +++ b/cwd/assets/altcraft/shaders/frag/blur.fs @@ -0,0 +1,22 @@ +#version 330 core + +out vec4 fragColor; + +in vec2 uv; + +uniform sampler2D blurInput; +uniform int blurScale; + +void main() { + vec2 texelSize = 1.0f / vec2(textureSize(blurInput, 0)); + vec4 result = vec4(0.0f); + for (int x = -blurScale; x < blurScale; x++) + { + for (int y = -blurScale; y < blurScale; y++) + { + vec2 offset = vec2(float(x), float(y)) * texelSize; + result += texture(blurInput, uv + offset); + } + } + fragColor = result / pow(blurScale, 3); +} diff --git a/cwd/assets/altcraft/shaders/frag/light.fs b/cwd/assets/altcraft/shaders/frag/light.fs index fd7aa4e..8556770 100644 --- a/cwd/assets/altcraft/shaders/frag/light.fs +++ b/cwd/assets/altcraft/shaders/frag/light.fs @@ -41,10 +41,11 @@ void main() { float skyLight = l.g; float lightLevel = clamp(faceLight + skyLight * dayTime, 0.01f, 1.0f); lightLevel = pow(lightLevel, 3); + lightLevel *= (1.0f - s.r); lightLevel = clamp(lightLevel, 0.005f, 1.0f); vec3 faceColor = mix(ac.rgb * lightLevel, vec3(1,1,1) * lightLevel, float(ac.rgb == vec3(0,0,0))); - vec4 finalColor = vec4(c.rgb * faceColor * (1.0f - s.r), 1.0f); + vec4 finalColor = vec4(c.rgb * faceColor, 1.0f); finalColor.rgb = pow(finalColor.rgb, vec3(1.0f / gamma)); |