render: SSAO
This commit is contained in:
@@ -6,6 +6,8 @@ uniform vec3 viewPos;
|
||||
uniform vec3 sun;
|
||||
uniform vec4 fogColor;
|
||||
|
||||
uniform sampler2D ssaoAmbient; // Ambient strength from SSAO pass
|
||||
|
||||
// G-Buffers
|
||||
uniform sampler2D gPos;
|
||||
uniform sampler2D gNorm;
|
||||
@@ -40,12 +42,12 @@ void loadGBuffer() {
|
||||
fragNormal = fragGNormal.xyz;
|
||||
if (fragNormal == vec3(0.0f, 0.0f, 0.0f))
|
||||
discard;
|
||||
fragPosLightspaceZ = fragGNormal.w;
|
||||
|
||||
gl_FragDepth = fragGNormal.w * 0.5 + 0.5;
|
||||
|
||||
vec4 fragGPos = texture(gPos, fragPosScreen);
|
||||
fragPos = vec4(fragGPos.xyz + viewPos, 1.0f);
|
||||
fragPosLightspaceZ = fragGPos.w;
|
||||
|
||||
fragColor = texture(gColor, fragPosScreen);
|
||||
|
||||
fragPosLightspace = lightspace * fragPos;
|
||||
@@ -56,7 +58,7 @@ void main() {
|
||||
|
||||
loadGBuffer();
|
||||
|
||||
light = ambient;
|
||||
light = ambient * texture(ssaoAmbient, fragPosScreen).r;
|
||||
|
||||
lightSun();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user