Учет SSAO при расчетах освещения

This commit is contained in:
parent 3594f2e4b1
commit 7735037ef7
1 changed files with 4 additions and 2 deletions

View File

@ -39,6 +39,7 @@ uniform sampler2D gDiffuseP;
uniform sampler2D gAmbientSpecular;
uniform sampler2DArray sunShadowDepth;
uniform samplerCubeArray pointShadowDepth;
uniform sampler2D ssao;
out vec4 color;
@ -51,6 +52,7 @@ void main()
vec3 ka = texture(gAmbientSpecular, texCoord).rgb;
float ks = texture(gAmbientSpecular, texCoord).a;
float p = texture(gDiffuseP, texCoord).a;
float ssao_value = texture(ssao, texCoord).r;
// Переменные используемые в цикле:
vec3 L_vertex; // Данные об источнике относительно фрагмента
@ -79,8 +81,8 @@ void main()
break;
// Фоновая освещенность
color = vec4(ka, 1);
color = vec4(ka, 1) * ssao_value;
// Расчет солнца, если его цвет не черный
if (length(sun.color) > 0)
{