OpenGL works again, Vulkan can be switched to, fixed most of the vulkan validation errors, better shadows, soft shadows, emissive lighting, and multiple different opacity rendering methods

This commit is contained in:
Halbear 2026-08-31 14:13:59 +01:00
parent 0d41f3e15b
commit 5b231d6920
54 changed files with 1102 additions and 268 deletions

View file

@ -23,6 +23,9 @@ layout(set = 0, binding = 0) uniform sampler2D posSampler;
layout(set = 0, binding = 1) uniform sampler2D albedoSampler;
layout(set = 0, binding = 2) uniform sampler2D normalsSampler;
layout(set = 0, binding = 3) uniform sampler2D pbrSampler;
layout(set = 0, binding = 4) uniform sampler2D emissiveSampler;
layout(set = 0, binding = 5) uniform sampler2D TranslucencySampler;
layout(set = 0, binding = 6) uniform sampler2D OpacitySampler;
layout(scalar, set = 1, binding = 0) readonly buffer Lights {
Light lights[];
@ -32,6 +35,7 @@ layout(scalar, set = 2, binding = 0) uniform SceneInfo {
float ambientLightIntensity;
vec3 ambientLightColor;
uint numLights;
mat4 viewMatrix;
} sceneInfo;
float distributionGGX(vec3 N, vec3 H, float roughness) {
@ -126,6 +130,10 @@ void main() {
vec3 normal = texture(normalsSampler, inTextCoord).rgb;
vec3 worldPos = texture(posSampler, inTextCoord).rgb;
vec3 pbr = texture(pbrSampler, inTextCoord).rgb;
vec3 emissive = texture(emissiveSampler, inTextCoord).rgb;
vec3 translucency = texture(TranslucencySampler, inTextCoord).rgb;
float emissiveness = emissive.r;
float roughness = pbr.g;
float metallic = pbr.b;
@ -146,9 +154,9 @@ void main() {
}
}
vec3 ambient = sceneInfo.ambientLightColor * albedo * sceneInfo.ambientLightIntensity;
vec3 color = ambient + Lo;
outFragColor = vec4(Lo + ambient + vec3(emissiveness), 1.0f);
outFragColor = vec4(color, 1.0f);
// outFragColor = vec4(color, 1.0f);
if (length(normal) < 0.001) {
outFragColor = vec4(albedo,1.0f);
return;