debug: simple diffuse point light — test if light data reaches fragment

This commit is contained in:
emil28092005
2026-06-18 19:47:29 +03:00
parent b162d681aa
commit 7ed81040ed
2 changed files with 13 additions and 2 deletions
@@ -14,6 +14,17 @@ layout(set = 0, binding = 0) uniform CameraUBO {
void main()
{
// Just output albedo — tests if vp matrix in 128B UBO works
outColor = vec4(fragAlbedo, 1.0);
vec3 N = normalize(fragNormal);
vec3 toLight = pointLightPos.xyz - fragWorldPos;
float dist = length(toLight);
vec3 L = normalize(toLight);
float NdotL = max(dot(N, L), 0.0);
float atten = 1.0 / (1.0 + dist * dist * 0.05);
float intensity = pointLightPos.w;
vec3 color = fragAlbedo * pointLightColor.xyz * NdotL * intensity * atten;
color += fragAlbedo * 0.02;
outColor = vec4(color, 1.0);
}
Binary file not shown.