diff options
author | LaG1924 <lag1924@gmail.com> | 2022-12-15 11:53:56 +0100 |
---|---|---|
committer | LaG1924 <lag1924@gmail.com> | 2022-12-15 11:53:56 +0100 |
commit | 12923669214ba73a809f4e221a634244888b0146 (patch) | |
tree | 9fe8a85f8fc9a5e3fa9f4e6a9418144090595730 /cwd/assets/altcraft/shaders/frag | |
parent | Fixed OpenSans font downloading (diff) | |
download | AltCraft-12923669214ba73a809f4e221a634244888b0146.tar AltCraft-12923669214ba73a809f4e221a634244888b0146.tar.gz AltCraft-12923669214ba73a809f4e221a634244888b0146.tar.bz2 AltCraft-12923669214ba73a809f4e221a634244888b0146.tar.lz AltCraft-12923669214ba73a809f4e221a634244888b0146.tar.xz AltCraft-12923669214ba73a809f4e221a634244888b0146.tar.zst AltCraft-12923669214ba73a809f4e221a634244888b0146.zip |
Diffstat (limited to 'cwd/assets/altcraft/shaders/frag')
-rw-r--r-- | cwd/assets/altcraft/shaders/frag/fwd_liquid_face.fs | 38 | ||||
-rw-r--r-- | cwd/assets/altcraft/shaders/frag/liquid_face.fs | 22 |
2 files changed, 60 insertions, 0 deletions
diff --git a/cwd/assets/altcraft/shaders/frag/fwd_liquid_face.fs b/cwd/assets/altcraft/shaders/frag/fwd_liquid_face.fs new file mode 100644 index 0000000..f8d9376 --- /dev/null +++ b/cwd/assets/altcraft/shaders/frag/fwd_liquid_face.fs @@ -0,0 +1,38 @@ +#version 330 core + +in vec4 faceWorldPos; +in vec3 faceTextureUv; +in vec3 faceAddColor; +in vec3 faceNormal; +in vec2 faceLight; + +out vec4 fragColor; + +uniform sampler2DArray textureAtlas; + +layout (std140) uniform Globals { + mat4 projView; + mat4 proj; + mat4 invProj; + mat4 view; + uvec2 viewportSize; + vec4 ssaoKernels[64]; + float globalTime; + float dayTime; + float gamma; +}; + +void main() { + vec4 col = texture(textureAtlas, faceTextureUv); + + float localLight = faceLight.r / 15.0f; + float skyLight = faceLight.g / 15.0f; + float lightLevel = clamp(localLight + skyLight * dayTime, 0.01f, 1.0f); + lightLevel = pow(lightLevel, 3); + lightLevel = clamp(lightLevel, 0.005f, 1.0f); + + fragColor = vec4(col.rgb * faceAddColor.rgb * lightLevel, 1.0f); + + fragColor.rgb = pow(fragColor.rgb, vec3(1.0f / gamma)); + fragColor.a = col.a; +} diff --git a/cwd/assets/altcraft/shaders/frag/liquid_face.fs b/cwd/assets/altcraft/shaders/frag/liquid_face.fs new file mode 100644 index 0000000..3e5c0d4 --- /dev/null +++ b/cwd/assets/altcraft/shaders/frag/liquid_face.fs @@ -0,0 +1,22 @@ +#version 330 core + +in vec3 faceTextureUv; +in vec3 faceAddColor; +in vec3 faceNormal; +in vec2 faceLight; +in float faceAmbientOcclusion; + +layout (location = 0) out vec4 color; +layout (location = 1) out vec4 normal; +layout (location = 2) out vec4 light; + +uniform sampler2DArray textureAtlas; + +void main() { + vec4 col = texture(textureAtlas, faceTextureUv); + + color = vec4(col.rgb * faceAddColor.rgb, 1.0f); + normal = vec4(faceNormal, 1.0f); + light = vec4(faceLight / 15.0f, faceAmbientOcclusion, 1.0f); + color.a = col.a; +} |