debug: fragment shader outputs light position as color — test UBO

- If objects are colored (not black/artifacts), UBO data reaches fragment shader
- Also: manual float-by-float UBO packing instead of MemoryCopy
- vp matrix packed as M11..M44 (row-major, no row_major in GLSL = transpose)
This commit is contained in:
emil28092005
2026-06-18 19:36:57 +03:00
parent ff8bec00f6
commit e37e7a4eed
3 changed files with 13 additions and 26 deletions
@@ -14,16 +14,11 @@ layout(set = 0, binding = 0) uniform CameraUBO {
void main()
{
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.1);
// Debug: just output the light position as color
vec3 lp = pointLightPos.xyz;
float intensity = pointLightPos.w;
vec3 color = fragAlbedo * pointLightColor.xyz * NdotL * intensity * atten;
outColor = vec4(color, 1.0);
// Map position to visible range
vec3 debugColor = lp * 0.1 + vec3(0.5);
outColor = vec4(debugColor * fragAlbedo, 1.0);
}