Use scene albedo in final scene composition

This commit is contained in:
saschawillems 2016-07-16 11:54:54 +02:00
parent 0112aa034d
commit 3339279825
2 changed files with 4 additions and 22 deletions

View file

@ -114,32 +114,14 @@ void main()
// Diffuse lighting. // Diffuse lighting.
float NdotL = max(0.0, dot(N, L)); float NdotL = max(0.0, dot(N, L));
vec3 diff = /*ubo.lights[i].color.rgb * albedo.rgb */ vec3(NdotL); vec3 diff = vec3(NdotL);
// Specular lighting. // Specular lighting.
vec3 R = reflect(-L, N); vec3 R = reflect(-L, N);
float NdotR = max(0.0, dot(R, V)); float NdotR = max(0.0, dot(R, V));
vec3 spec = /*ubo.lights[i].color.rgb * albedo.a */ vec3(pow(NdotR, 16.0)); vec3 spec = vec3(pow(NdotR, 16.0));
vec4 shadowClip = ubo.lights[i].viewMatrix * vec4(fragPos, 1.0); fragcolor += vec3((diff + spec) * spotEffect * heightAttenuation) * ubo.lights[i].color.rgb * albedo.rgb ;
float shadowFactor;
#ifdef USE_PCFA
shadowFactor= filterPCF(shadowClip, i);
#else
shadowFactor = textureProj(shadowClip, i, vec2(0.0));
#endif
//fragcolor += vec3(diff * spotEffect * heightAttenuation);
//fragcolor += vec3(diff * spotEffect * heightAttenuation) * shadowFactor * ubo.lights[i].color.rgb;
fragcolor += vec3(diff * spotEffect * heightAttenuation) * ubo.lights[i].color.rgb;
shadow += shadowFactor;
//if (shadowFactor > 0.5)
// fragcolor += vec3(0.25);
//else
// fragcolor += vec3(1.0-shadowFactor);
//fragcolor += (diff + spec) * spotEffect * heightAttenuation * shadowFactor;
} }
for(int i = 0; i < LIGHT_COUNT; ++i) for(int i = 0; i < LIGHT_COUNT; ++i)
@ -156,5 +138,5 @@ void main()
fragcolor *= shadowFactor; fragcolor *= shadowFactor;
} }
outFragColor.rgb = fragcolor;// * shadow; outFragColor.rgb = fragcolor;
} }