Skip to content Skip to sidebar Skip to footer

Opengl Es 2.0 Antialiasing Or Smoothing On Ios And Android From Shared C++ Code

I'm fairly new to OpenGL and to ES2.0. I have shared c++ opengl es2 code that i use to draw on ios and android(with ndk CMake)... it mostly works but now I need antialiasing and it

Solution 1:

OpenGL ES 2.0 targets low-end platforms and therefore does not require anti-aliasing. Extensions are often implemented however since there is lot of hardware exceeding the ES 2.0 requirements.

Assuming you need to do it on platforms that does not support it, despite being an unfair requirement (hobos should buy effing hardware if they desire visual perfection), there are a couple of things that might work depending on the rendered scene and development budget:

  1. Calculate fragment coverage manually in shader, set alpha, blend using GL_ALPHA_SATURATE; IMO the best looking AA technique there is, though opaque surfaces only (strangely enough supported on ES 2.0 despite no smooth polygons?)
  2. Temporal supersampling. Merge a few recent frames together rendered with slight offsets. If things move alot on display it might not preferable.
  3. Overdraw using transparent lines. For any surface draw its wireframe with transparency. The edges will becomes a little smoother, though the surface will also grow a little.
  4. Clamp vertices to pixel center in shader. This will slightly reduce moving sensation for near vertical/horizontal edges, but may give a less smooth feeling in some scenarios.
  5. Choosing a visual style that is more resistant to aliasing. I avoid circles when pixel-aligned quads work just as good. When there is risk of chromatic aliasing due to pixel geometry I select background and foreground colors more carefully. This is in some sense AA on design level, rather than on a rendering level, and should not be under estimated since it is often cheap and portable.

Should you implement any of above I'd be really interested in your results and more details of your scenario.

Post a Comment for "Opengl Es 2.0 Antialiasing Or Smoothing On Ios And Android From Shared C++ Code"