render: SSAO
This commit is contained in:
@@ -14,7 +14,7 @@ layout (location = 3) in float light;
|
||||
|
||||
out vec3 fragPosWorld;
|
||||
out float fragPosLightspaceZ;
|
||||
out float fragDepthNDC;
|
||||
out float fragDepthView;
|
||||
out vec2 fragTexCoord;
|
||||
out vec3 fragNormal;
|
||||
out float fragLight;
|
||||
@@ -25,14 +25,16 @@ void main() {
|
||||
fragNormal = normalize(normal);
|
||||
fragLight = light;
|
||||
|
||||
gl_Position = projection * view * model * vec4(vert, 1);
|
||||
fragDepthNDC = gl_Position.z / gl_Position.w;
|
||||
|
||||
vec4 pos4 = model * vec4(vert, 1);
|
||||
fragPosWorld = pos4.xyz / pos4.w;
|
||||
vec4 fragPosLightspace = lightspace * vec4(fragPosWorld, 1.0f);
|
||||
fragPosLightspaceZ = fragPosLightspace.z / fragPosLightspace.w *0.5f + 0.5f;
|
||||
|
||||
vec4 posView = view * pos4;
|
||||
fragDepthView = posView.z;
|
||||
|
||||
gl_Position = projection * posView;
|
||||
|
||||
fragPosWorld -= viewPos;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user