I'm using an FBO to render my scene to a depth texture (GL_DEPTH_COMPONENT
). When I enable multisampling in my application, those samples are resolved to a single texel, but how are they combined? Is the depth of the nearest sample stored to the texture, or the average of the samples? Is this behavior vendor-dependent?
How are depth values resolved in OpenGL textures when multisampling?
Asked Answered
See the multisample specification document:
"If the depth test passes, all multisample buffer depth sample values are set to the depth of the fragment's centermost sample's depth value, and all multisample buffer color sample values are set to the color value of the incoming fragment."
It seems what you quote specifically deals with the case "If MULTISAMPLE_ARB is disabled, and SAMPLE_BUFFERS_ARB is one". While in the later section Reading Pixels, "It is recommended that the depth value of the centermost sample be used, though implementations may choose any function of the depth sample values at each pixel". –
Iddo
© 2022 - 2024 — McMap. All rights reserved.