GL_POLYGON_SMOOTH的白色像素 [英] White Pixels With GL_POLYGON_SMOOTH

查看:266
本文介绍了GL_POLYGON_SMOOTH的白色像素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个问题,即在OpenGL中的对象上随机出现白色像素(某种类型)。 是一个正在发生的事情的例子。在为可能遇到此问题的其他人搜索Stack Overflow时,我发现 GL_POLYGON_SMOOTH 不值得启用。我禁用了它,斑点消失了(这对我很幸运)。这非常幸运,但我仍然不明白为什么启用 GL_POLYGON_SMOOTH 会创建这些工件。有人能解释他们出现的原因吗?另请注意,我已经 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA)正在进行。

I had a problem where white pixels appeared randomly (sort of) on objects in OpenGL. This is an example of what was going on. While searching Stack Overflow for other people who may have had this problem, I found that GL_POLYGON_SMOOTH wasn't worth enabling. I disabled it, and the spots disappeared (this was lucky of me). This was very lucky, but I still don't understand why enabling GL_POLYGON_SMOOTH creates these artifact-thingies. Can someone explain why they appear? Also note I had glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) going on.

推荐答案

GL_POLYGON_SMOOTH 是选择性抗锯齿,而不是完全抗锯齿(如MSAA或SSAA)。

GL_POLYGON_SMOOTH is selective anti-aliasing, as opposed to fullscene anti-aliasing (such as MSAA or SSAA).

这里真正的问题基本上是通过将光栅化多边形的轮廓边与帧缓冲区中已有的像素混合来实现的。它依赖于顺序,因此除非您的多边形是完全深度排序的(在这种情况下您不需要深度缓冲区),否则它不会产生完美的结果。即使你确实把所有东西都完美地排序了,但在许多场景中,这需要的透支量是荒谬的。

The real problem here is basically that this works by blending the silhouette edges of rasterized polygons with pixels already in the frame buffer. It is order-dependent, so unless your polygons are perfectly depth sorted (in which case you would not need a depth buffer) it is not going to generate perfect results. And even if you did have everything perfectly sorted, in many scenes the amount of overdraw this would require would be ridiculous.

现在首选多重采样抗锯齿,它避免了在顺序依赖的问题上,您可以更好地控制质量与性能,并且您可以使用多重采样纹理自己实现它。 GL_POLYGON_SMOOTH 有质量提示(快/好),就是这样。

Multisample anti-aliasing is preferred these days, it avoids the issues of order dependence, you have much better control over the quality vs. performance and you can actually implement it yourself using multisample texturing. GL_POLYGON_SMOOTH has a quality hint (fast/nice) and that is it.

这篇关于GL_POLYGON_SMOOTH的白色像素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆