Screen-Space Ambient Occlusion

If you have multisampling activated in your application, you will not be able to use the depth buffer directly. You will have to copy the depth buffer to a texture and then use that as input for your shader.

I don’t know that much about non-square textures or non power of two textures. You could certainly use a square texture and only fill part of it (a rectangular region) with the depth buffer’s contents but I don’t know if this is the best approach.

No I don’t have multisampling in my application…I have it turned on in my nvidia drivers, can this somehow interact ? I hope not.

OK, Iam using GL_TEXTURE_RECTANGLE_ARB only for blur pass in my engine, I think it can be changed to GL_TEXTURE_2D, but I don’t want to mess with that now. I will create a new fbo which will be using GL_TEXTURE and use it only for SSAO

So what I’ll do to pass depth buffer into my shader is following:
1.) Create a new FBO
2.) Create and associate a GL_TEXTURE_2D with it
3.) Create and associate a Depth texture with it
4.) Then I bind FBO, render scene, unbind FBO
5.) Bind/Load fragment program
6.) Bind depth texture onto a full screen quad
7.) Draw the full screen quad
8.) Read the depth buffer in fragment shader and compute SSAO

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.