commit c68a109c97eeb361e6346739398d85b8a799b5a9 Author: Cametendo Date: Wed May 27 14:43:13 2026 +0200 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b13ebc3 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.claude/ \ No newline at end of file diff --git a/final.fsh.settings b/final.fsh.settings new file mode 100644 index 0000000..f4b12e6 --- /dev/null +++ b/final.fsh.settings @@ -0,0 +1 @@ +shadowmap=false \ No newline at end of file diff --git a/shaders.properties b/shaders.properties new file mode 100644 index 0000000..cd64bca --- /dev/null +++ b/shaders.properties @@ -0,0 +1,3 @@ +separateAo=true +shadowMapResolution=0 +generateShadowMap=false \ No newline at end of file diff --git a/shaders/final.fsh b/shaders/final.fsh new file mode 100644 index 0000000..b50f8f2 --- /dev/null +++ b/shaders/final.fsh @@ -0,0 +1,64 @@ +#version 150 + +uniform sampler2D colortex0; +in vec2 texCoord; +out vec4 fragColor; + +void main() { + ivec2 pixelSizeInt = textureSize(colortex0, 0); + vec2 pixelSizeFloat = vec2(pixelSizeInt); + vec2 texelSize = vec2(1.0) / vec2(textureSize(colortex0, 0)); + + + + // Following is made by Claude, that works (27.5.26) + /* + vec3 scene = texture(colortex0, texCoord).rgb; + float gray = dot(scene, vec3(2.5000, 0.5000, 0.5000)); // Farbkontrolle (Auch genannt, luma weiter oben) + fragColor = vec4(vec3(gray), 1.0); + */ +} + +squareBottomRight() { + float lumaSum_br = 0.0; + float lumaSquaredSum_br = 0.0; + vec3 colorSum_br = vec3(0.0); + vec3 mean_br = vec3(0.0); + vec3 mean_luma_br = vec3(0.0); + float variance_br = 0.0; + for (int i = 0; i <= 2; i++) { + for (int j = -2; j <= 0; j++) { + vec2 offset_br = vec2(float(i), float(j)) * texelSize_br; + vec3 neighborColor_br = texture(colortex0, texCoord + offset_br).rgb; + float luma_br = dot(neighborColor_br, vec3(0.299, 0.587, 0.114)); // Basically dasselbe wie float gray weiter unten + colorSum_br += neighborColor_br; + lumaSum_br += luma_br; + lumaSquaredSum_br += (luma_br * luma_br); + } + } + mean_br = (colorSum_br / 9.0); + mean_luma_br = (lumaSum_br / 9.0); + variance_br = (lumaSquaredSum_br / 9.0 - (mean_luma_br * mean_luma_br)); +} + +squareBottomLeft() { + float lumaSum_bl = 0.0; + float lumaSquaredSum_bl = 0.0; + vec3 colorSum_bl = vec3(0.0); + vec3 mean_bl = vec3(0.0); + vec3 mean_luma_bl = vec3(0.0); + float variance_bl = 0.0; + for (int i = -2; i <= 0; i++) { + for (int j = -2; j <= 0; j++) { + vec2 offset_bl = vec2(float(i), float(j)) * texelSize_bl; + vec3 neighborColor_bl = texture(colortex0, texCoord + offset_bl).rgb; + float luma_bl = dot(neighborColor_bl, vec3(0.299, 0.587, 0.114)); // Basically dasselbe wie float gray weiter unten + colorSum_bl += neighborColor_bl; + lumaSum_bl += luma_bl; + lumaSquaredSum_bl += (luma_bl * luma_bl); + } + } + mean_bl = (colorSum_bl / 9.0); + mean_luma_bl = (lumaSum_bl / 9.0); + variance_bl = (lumaSquaredSum_bl / 9.0 - (mean_luma_bl * mean_luma_bl)); +} \ No newline at end of file diff --git a/shaders/final.vsh b/shaders/final.vsh new file mode 100644 index 0000000..54df053 --- /dev/null +++ b/shaders/final.vsh @@ -0,0 +1,11 @@ +#version 150 + +in vec3 vaPosition; +in vec2 vaUV0; + +out vec2 texCoord; + +void main() { + gl_Position = vec4(vaPosition.xy * 2.0 - 1.0, 0.0, 1.0); + texCoord = vaUV0; +} diff --git a/shaders/gbuffers_terrain.fsh b/shaders/gbuffers_terrain.fsh new file mode 100644 index 0000000..5d08a26 --- /dev/null +++ b/shaders/gbuffers_terrain.fsh @@ -0,0 +1,20 @@ +#version 150 + +/* DRAWBUFFERS:0 */ + +uniform sampler2D gtexture; +uniform sampler2D lightmap; + +in vec2 texCoord; +in vec4 tintColor; +in vec2 lightCoord; + +out vec4 fragColor; + +void main() { + vec4 color = texture(gtexture, texCoord); + if (color.a < 0.1) discard; + color *= tintColor; + color.rgb *= texture(lightmap, lightCoord).rgb; + fragColor = color; +} diff --git a/shaders/gbuffers_terrain.vsh b/shaders/gbuffers_terrain.vsh new file mode 100644 index 0000000..bbfd05b --- /dev/null +++ b/shaders/gbuffers_terrain.vsh @@ -0,0 +1,21 @@ +#version 150 + +uniform mat4 modelViewMatrix; +uniform mat4 projectionMatrix; +uniform vec3 chunkOffset; + +in vec3 vaPosition; +in vec4 vaColor; +in vec2 vaUV0; +in ivec2 vaUV2; + +out vec2 texCoord; +out vec4 tintColor; +out vec2 lightCoord; + +void main() { + gl_Position = projectionMatrix * modelViewMatrix * vec4(vaPosition + chunkOffset, 1.0); + texCoord = vaUV0; + tintColor = vaColor; + lightCoord = vaUV2 / 256.0; +}