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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

View file

@ -0,0 +1,2 @@
Sky texture:
kaori669 on deviant art

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 KiB

View file

@ -149,4 +149,9 @@ void main() {
vec3 color = ambient + Lo;
outFragColor = vec4(color, 1.0f);
if (length(normal) < 0.001) {
outFragColor = vec4(albedo,1.0f);
return;
}
}

View file

@ -2,7 +2,7 @@
layout(constant_id = 0) const int USE_AA = 0;
const float GAMMA_CONST = 0.8545;
const float GAMMA_CONST = 0.6545;
const float SPAN_MAX = 8.0;
const float REDUCE_MIN = 1.0/128.0;
const float REDUCE_MUL = 1.0/32.0;

View file

@ -2,7 +2,7 @@
layout(constant_id = 0) const int USE_AA = 0;
const float GAMMA_CONST = 0.8545;
const float GAMMA_CONST = 0.4545;
const float SPAN_MAX = 8.0;
const float REDUCE_MIN = 1.0/128.0;
const float REDUCE_MUL = 1.0/32.0;

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;

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;

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;

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);
}

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;
@ -37,7 +37,7 @@ void main()
Material material = matUniform.materials[push_constants.materialIdx];
if(material.hasTexture == 1){
vec4 texColor = texture(textSampler[material.textureIdx],inTextCoords);
if(texColor.a < 0.05 || texColor.a >= 0.9){discard;}
if(texColor.a >= 0.9){discard;}
outAlbedo = texColor;
} else{
outAlbedo = material.diffuseColor;

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,14 @@ 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;
@ -57,7 +65,7 @@ void main()
}
if(outAlbedo.a < 0.05 || outAlbedo.a >= 0.75) discard;
if(outAlbedo.a >= 0.75 || outAlbedo.a < 0.05f) discard;
mat3 TBN = mat3(inTangent, inBitangent, inNormal);
vec3 newNormal = calcNormal(material, inNormal, inTextCoords, TBN);

View file

@ -0,0 +1,5 @@
#version 450
void main() {
}

View file

@ -0,0 +1,5 @@
#version 450
void main() {
}

View file

@ -0,0 +1,5 @@
#version 450
void main() {
}

View file

@ -0,0 +1,11 @@
#version 450
layout(location = 0) in vec3 outTexCoords;
layout(location = 1) out vec4 outColor;
layout(set = 2, binding = 0) uniform samplerCube skyboxSampler;
void main() {
outColor = vec4(texture(skyboxSampler, outTexCoords).rgb, 1.0);
}

View file

@ -0,0 +1,18 @@
#version 450
layout(location = 0) in vec3 inPosition;
layout(location = 0) out vec3 outTexCoords;
layout(set = 0, binding = 0) uniform ProjectionBuffer {
mat4 proj;
} uboProj;
layout(set = 1, binding = 0) uniform ViewBuffer {
mat4 view;
} uboView;
void main() {
outTexCoords = inPosition;
mat4 skyView = mat4(mat3(uboView.view));
vec4 pos = uboProj.proj * skyView * vec4(inPosition, 1.0);
gl_Position = vec4(pos.xy, 0.0, pos.w);
}