Jarvis, Optimise my shit

This commit is contained in:
Halbear 2026-09-25 23:37:22 +01:00
parent d1abde919d
commit 9424b29d0a
50 changed files with 1469 additions and 1232 deletions

View file

@ -10,9 +10,7 @@ layout(set = 0, binding = 3) uniform sampler2D pbrSampler;
layout(set = 1, binding = 0) uniform CameraProperties {
mat4 projection;
mat4 invProjection;
mat4 view;
mat4 invView;
float ssrStepSize;
float ssrMaxDistance;
int maxSteps;
@ -30,13 +28,12 @@ float edgeFade(vec2 uv) {
}
void main() {
vec4 sceneColor = texture(albedoSampler, fragTexCoord);
outColor = vec4(0.0);
vec4 posSample = texture(worldPosSampler, fragTexCoord);
vec4 normalSample = texture(normalSampler, fragTexCoord);
vec4 pbrSample = texture(pbrSampler, fragTexCoord);
if (posSample.a == 0.0 || length(posSample.xyz) == 0.0 || length(normalSample.xyz) < 0.001) {
outColor = sceneColor;
return;
}
@ -54,11 +51,10 @@ void main() {
float materialReflection = reflectiveness + (refractiveness - 1.05);
materialReflection *= mix(0.75, 1.0, metallic);
materialReflection *= smoothstep(0.7, 0.05, roughness);
materialReflection *= 1.0 - smoothstep(0.05, 0.7, roughness);
materialReflection *= mix(0.45, 1.0, fresnel);
if (materialReflection <= MIN_REFLECTION) {
outColor = sceneColor;
return;
}
@ -66,7 +62,6 @@ void main() {
vec3 reflectDir = normalize(reflect(viewDir, worldNormal));
if (dot(reflectDir, worldNormal) <= 0.0) {
outColor = sceneColor;
return;
}
@ -115,7 +110,6 @@ void main() {
}
if (!hitFound) {
outColor = sceneColor;
return;
}
@ -124,5 +118,5 @@ void main() {
float fade = edgeFade(hitUV);
float weight = clamp(materialReflection * fade, 0.0, 0.85);
outColor = vec4(mix(sceneColor.rgb, reflectedColor, weight), sceneColor.a);
outColor = vec4(reflectedColor * weight, weight);
}