Jump to content
  • Advertisement
Sign in to follow this  

OpenGL Multisampled FBO-depth-textures

This topic is 2524 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi there,

I'm currently trying to implement MJP's deferred "MSAA" in OpenGL, where I need a multisampled depth-only geometry-prepass and use the results in a post-processing CFAA-shader.
For that I've created a FBO with a multisampled texture.
My problem is, that all the depth-samples seems to be equal if I query them in the post-processing shader.
The strange thing is, if I profile the time needed for a 8x multisampled and a non-multisampled depth-only pass they both need the same time.
I don't know how efficient hardware-MSAA is, but it I can't really believe that my ATI HD 5700 is that parallel on MSAA.
I use the proprietary-ati-drivers on linux and glxinfo says I have OpenGL 4.2.

This is how I create the FBO and texture:

glGenTextures(1, &m_msaaDepthTexId);
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, m_msaaDepthTexId);
glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, m_msaaSamples, GL_DEPTH_COMPONENT32, width, height, GL_TRUE);

glGenFramebuffers(1, &m_msaaFboId);
glBindFramebuffer(GL_FRAMEBUFFER, m_msaaFboId);

In the prepass-shader I don't explicitly assign a depthvalue.
In the postprocessing-shader I access the multisampled depth-texture like this:

uniform sampler2DMS texDepthMS;
void main()
ivec2 sampleLocation = ivec2(texCoords * frameSize);
for (int i = 0; i < 4; i++)
float msDepth = texelFetch(texDepthMS, sampleLocation, i).x;

But the msDepth-values are all independent from i and equal to the non-ms-depth-value.

I set the texture uniform like that:

glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, m_msaaDepthTexId);
glUniform1i(m_msaaShader->getUniformLocation("texDepthMS"), 1);

Someone had different problems or knows what might be wrong?

Greets and thanks for your time!

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!