Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: FXAA with OpenGL ES 2.0

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2011
    Posts
    8

    FXAA with OpenGL ES 2.0

    Hi, I'm new around here and I'm not an OpenGL guru since I just started learning OpenGL ES 2.0 on Android (so please be patient )
    One of the biggest problem I'm having with OpenGL ES is the lack of native antialias support (please correct me if I'm wrong), here it is a sample of my bad looking application (it's a desktop application running OpenGL ES 2.0 in "emulation mode" thanks to a middleware API).

    No antialias


    I have read many articles about antialias (some oriented to "specif tasks" like this one), but I'm looking for a generic and easy to use implementation.
    The two only options available for my requirements, as far as I know, are:
    • Supersampling
    • Postprocessing shaders like FXAA, MLAA etc...

    Supersampling was easy thanks to the library I'm using:

    Supersampling 1.5x


    Supersampling 2x


    Even if supersampling works great and have a good looking result (on the PC), soon I discovered that has very bad performance on "mobile" side and I started looking at the second option

    FXAA 3.11


    FXAA (which is known to be fast) has the best looking result but I'm still not able to make it works on my phone (it works on PC but not on the phone due to a shader error) and that's why I'm writing here today. As I wrote above, my experience with shaders is very limited and I'm not able to track the "real" problem.
    Can anyone tell me if FXAA can run in OpenGL ES 2.0? If not, is there any chance to use something similar which is supported for that target? Maybe MLAA?

    Please help, thanks!

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655

    Re: FXAA with OpenGL ES 2.0

    And what is the "shader error" you get ?

  3. #3
    Junior Member Newbie
    Join Date
    Aug 2011
    Posts
    8

    Re: FXAA with OpenGL ES 2.0

    Quote Originally Posted by ZbuffeR
    And what is the "shader error" you get ?
    Sorry for being "too generic" there but my original intent was to understand if FXAA/MLAA/etc are supported on OpenGL ES 2.0.
    Anyway I have problems in getting a detailed error message when I run the application on my device (no probs on PC): the call to GL_COMPILE_STATUS gives me a return value of 0 which means an error, but GL_INFO_LOG_LENGTH always return 0 and I cannot track the message. After lots of #ifdef in the fragment shader, I suspect that the problem is in a call to "texture2DLod" that is probably not supported. Anyway, as I wrote above, I'm interested in understating if a post processing filter for AA is in general supported in OpenGL ES 2.0.

    I forgot to post the (adapted) shader code:

    Vertex shader
    Fragment shader

    Hope it helps

  4. #4
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655

    Re: FXAA with OpenGL ES 2.0

    The most useful link I found is this one:
    http://www.khronos.org/webgl/wiki/We...GL_Differences
    this confirms that no *Lod is supported in fragment shader.


    EDIT: it seem you can get away without the lod, in this case :
    Code :
        #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)
    This is the base level only, so it can be emulated with a non-mipmapped texture access :
    Code :
        #define FxaaTexTop(t, p) texture2D(t, p)

  5. #5
    Junior Member Newbie
    Join Date
    Aug 2011
    Posts
    8

    Re: FXAA with OpenGL ES 2.0

    Thanks again ZbuffeR for your suggestions, I'll have a try and I'll post my results.
    Am I the only one interested in this !?

  6. #6
    Junior Member Newbie
    Join Date
    Aug 2011
    Posts
    8

    Re: FXAA with OpenGL ES 2.0

    And here it is (directly taken from my Nexus One)

    No antialias


    FXAA 3.11 (low settings)


    As usual, it was very hard to debug since on error I got no message from OpenGL...As suggested by ZbuffeR, all references to texture2DLod has been changed to texture2D and I made some small changes in the code shared in my last post too.
    Btw I got a very very bad frame rate (1fps vs ~30fps ), could it be caused by swapping texture2DLod with texture2D? I'm really noob with this...any other suggestion to increase the fps?
    Thanks anyway for your help

  7. #7
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655

    Re: FXAA with OpenGL ES 2.0

    Read http://www.opengl.org/wiki/Performance
    You can try commenting out various parts of the shader to see how it improves performance, but my understanding is that your hardware is not powerful enough period.

    Speaking of hardware, what are your specs ? By any chance, can you run it on a different phone ?

  8. #8
    Junior Member Newbie
    Join Date
    Aug 2011
    Posts
    8

    Re: FXAA with OpenGL ES 2.0

    Thanks for the link, I'll keep testing the shader.
    About specs, I know that my phone is not a "recent" model (details here), anyway I should be able to make some tests on other devices.
    Thanks again for the support

  9. #9
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655

    Re: FXAA with OpenGL ES 2.0

    It appears to have an andreno 200, which does not seem very fast according to this :
    http://smartphonebenchmarks.com/forum/in...-to-other-gpus/

  10. #10
    Junior Member Newbie
    Join Date
    Aug 2011
    Posts
    8

    Re: FXAA with OpenGL ES 2.0

    Quote Originally Posted by ZbuffeR
    It appears to have an andreno 200, which does not seem very fast according to this :
    http://smartphonebenchmarks.com/forum/in...-to-other-gpus/
    Yes that's right: are you telling me that there is no chance to have a good frame rate on my device? I cannot exclude devices with the same specs for my "target". Can you suggest something better for my purpose?
    Thanks as usual

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •