为什么在使用 FBO 进行多重采样时 OpenGL 会照亮我的场景?
我刚刚将 OpenGL 绘图代码从直接绘图到显示切换为使用附加渲染缓冲区的离屏 FBO。当我分配正常的渲染缓冲区存储时,离屏 FBO 会正确地传输到屏幕。
但是,当我在渲染缓冲区上启用多重采样(通过glRenderbufferStorageMultisample)时,场景中的每种颜色似乎都被增亮了(因此给出了与非多重采样部分不同的颜色)。
我怀疑我需要设置一些 glEnable
选项来保持相同的颜色,但我似乎在其他地方找不到任何提及此问题的信息。
有什么想法吗?
I just switched my OpenGL drawing code from drawing to the display directly to using an off-screen FBO with render buffers attached. The off-screen FBO is blitted to the screen correctly when I allocate normal render buffer storage.
However, when I enable multisampling on the render buffers (via glRenderbufferStorageMultisample
), every color in the scene seems like it has been brightened (thus giving different colors than the non-multisampled part).
I suspect there's some glEnable
option that I need to set to maintain the same colors, but I can't seem to find any mention of this problem elsewhere.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
由于样本位置不匹配而缺乏适当的下采样,我偶然发现了同样的问题。对我有用的是:
多重采样使事情变得非常慢。尽管 CSAA 的性能比 MSAA 更好,但当性能成为问题或所需的相当新的扩展(例如 ARB_texture_multisample)不可用时,我建议查看用于后处理的 FXAA 着色器,作为一个相当好的替代方案。
访问 GLSL 中的示例:
http://developer.download.nvidia。 com/opengl/specs/GL_EXT_framebuffer_multisample.txt
http://developer.download.nvidia.com/opengl/specs/GL_EXT_framebuffer_blit.txt< /a>
11) 不同位大小的缓冲区之间是否应该允许位块传送?
13)BlitFramebuffer颜色空间转换应该如何进行
指定的?我们是否允许上下文钳位状态影响
位块传送?
http://www.opengl.org/registry/specs/ARB /sample_shading.txt
位块传输OpenGL 中具有多个颜色附件的多重采样 FBO
I stumbled upon the same problem, due to the lack of proper downsampling because of mismatching sample locations. What worked for me was:
texelFetch()
.Things got really slow with multisampling. Although CSAA performed better than MSAA, I recommend to take a look at FXAA shaders for postprocessing as a considerable alternative, when performance is an issue or those rather new extensions required, such as ARB_texture_multisample, are not available.
Accessing samples in GLSL:
http://developer.download.nvidia.com/opengl/specs/GL_EXT_framebuffer_multisample.txt
http://developer.download.nvidia.com/opengl/specs/GL_EXT_framebuffer_blit.txt
11) Should blits be allowed between buffers of different bit sizes?
13) How should BlitFramebuffer color space conversion be
specified? Do we allow context clamp state to affect the
blit?
http://www.opengl.org/registry/specs/ARB/sample_shading.txt
Blitting multisampled FBO with multiple color attachments in OpenGL
对我有用的解决方案是更改渲染缓冲区颜色格式。我选择了 GL_RGBA32F 和 GL_DEPTH_COMPONENT32F(认为我想要最高精度),并且 NVIDIA 驱动程序对此有不同的解释(我怀疑 sRGB 补偿,但我可能是错的)。
我发现有效的渲染缓冲区图像格式是
GL_RGBA8
和GL_DEPTH_COMPONENT24
。The solution that worked for me was changing the renderbuffer color format. I picked
GL_RGBA32F
andGL_DEPTH_COMPONENT32F
(figuring that I wanted the highest precision), and the NVIDIA drivers interpret that differently (I suspect sRGB compensation, but I could be wrong).The renderbuffer image formats I found to work are
GL_RGBA8
withGL_DEPTH_COMPONENT24
.