debug: simple diffuse point light — test if light data reaches fragment
This commit is contained in:
@@ -14,6 +14,17 @@ layout(set = 0, binding = 0) uniform CameraUBO {
|
|||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
// Just output albedo — tests if vp matrix in 128B UBO works
|
vec3 N = normalize(fragNormal);
|
||||||
outColor = vec4(fragAlbedo, 1.0);
|
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.
Reference in New Issue
Block a user