This commit is contained in:
Harrison Corlett 2026-06-23 13:20:43 +01:00
parent eb01ec4877
commit f135d99d74
60 changed files with 924 additions and 90 deletions

View file

@ -1,6 +1,6 @@
#version 450
const int MAX_TEXTURES = 512;
const int MAX_TEXTURES = 128;
layout(location = 0) in vec4 inPos;
layout(location = 1) in vec3 inNormal;
@ -13,6 +13,13 @@ layout(location = 0) out vec4 outPos;
layout(location = 2) out vec4 outNormal;
layout(location = 3) out vec4 outPBR;
const float bayerMatrix[16] = float[](
0.0 / 16.0, 8.0 / 16.0, 2.0 / 16.0, 10.0 / 16.0,
12.0 / 16.0, 4.0 / 16.0, 14.0 / 16.0, 6.0 / 16.0,
3.0 / 16.0, 11.0 / 16.0, 1.0 / 16.0, 9.0 / 16.0,
15.0 / 16.0, 7.0 / 16.0, 13.0 / 16.0, 5.0 / 16.0
);
struct Material {
vec4 diffuseColor;
uint hasTexture;
@ -55,13 +62,17 @@ void main()
} else {
outAlbedo = material.diffuseColor;
}
/*int Intensity = 4;
int x = int(gl_FragCoord.x) % Intensity;
int y = int(gl_FragCoord.y) % Intensity;
float threshold = bayerMatrix[y * Intensity + x];
if(outAlbedo.a < threshold || outAlbedo.a < 0.05f) discard;*/
if(outAlbedo.a < 0.75) discard;
mat3 TBN = mat3(inTangent, inBitangent, inNormal);
vec3 newNormal = calcNormal(material, inNormal, inTextCoords, TBN);
outNormal = vec4(newNormal, 1.0f);
outNormal = vec4(newNormal, outAlbedo.a);
float ao = 0.5f;
float roughnessFactor = 0.0f;
@ -75,6 +86,6 @@ void main()
metallicFactor = material.metallicFactor;
}
outPBR = vec4(ao, roughnessFactor, metallicFactor, 1.0f);
outPBR = vec4(ao, roughnessFactor, metallicFactor, outAlbedo.a);
}