多重采样时,如何在OpenGL纹理中解析深度值?

时间:2023-02-05 19:35:37

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?

我正在使用FBO将场景渲染到深度纹理(GL_DEPTH_COMPONENT)。当我在我的应用程序中启用多重采样时,这些样本将被解析为单个纹素,但它们是如何组合的?是否将最近样本的深度存储到纹理或样本的平均值?这种行为依赖于供应商吗?

1 个解决方案

#1


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."

“如果深度测试通过,则所有多重采样缓冲区深度样本值都设置为片段最中心样本深度值的深度,并且所有多重采样缓冲区颜色样本值都设置为传入片段的颜色值。”

#1


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."

“如果深度测试通过,则所有多重采样缓冲区深度样本值都设置为片段最中心样本深度值的深度,并且所有多重采样缓冲区颜色样本值都设置为传入片段的颜色值。”