如何使用着色器平滑图元的边缘?

How do you smooth the edges a primitive using a shader?

在 OpenGL 中使用片段着色器软化简单图元(例如 GL_TRIANGLES)的边缘的最简单技术是什么?

我读到在 GL_BLEND 上下文中,我们可以根据片段与边缘的接近程度来调整片段的 alpha 值;但是这在实践中是如何有效实现的呢?

可以使用抗锯齿来平滑图元的边缘。

OpenGL 提供 multisample buffers to allow hardware-accelerated aliasing of an image, however this feature is not supported by all platforms due to it's dependence on dedicated hardware buffers on board the GPU. An alternative method is to render your display to a texture using a FrameBuffer, and then pass the rendered texture through Timothy Lottes' Fast Approximate Anti Aliasing (FXAA) 着色器,它需要单次传递。