Odd shader behaviour in GLES 2.0.

SIsilicon28SIsilicon28 Posts: 87Member
edited January 3 in Shaders

You see, I have this shader that supposed to render as rainbow tail for a powerup in my game. It looks fine GLES 3.0,

but all the colour is lost when running with GLES 2.0.

I can't seem to find what's causing the difference, so I'm hoping someone here in the forums can help me out with this dilemma.

Here's the shader code.

I have asked the question on the Q&A site too.

Best Answer

  • TwistedTwiglegTwistedTwigleg Posts: 1,826
    Accepted Answer

    From what I remember, an issue with GLES2 is that it doesn't have HDR support, so values above 1 are just rendered as white. If you add rainbow = normalize(rainbow); before COLOR = vec4(rainbow, 2.0 * (0.5 - tail_center)); then the rainbow will still have color, though the colors will be muted.

    As @cybereality mentioned and what I have found on the documentation, the issue is that GLES2 uses an sRGB color space instead of a linear color space. I tried using OUTPUT_IS_SRGB but it was not working for me.

Answers

  • cyberealitycybereality Posts: 340Member

    Colors seem to be handled differently in GLES3 and GLES2 on Godot. I believe it has something to do with sRGB and Linear color spaces, but in my testing I was not able to make them look the same.

  • TwistedTwiglegTwistedTwigleg Posts: 1,826Admin
    Accepted Answer

    From what I remember, an issue with GLES2 is that it doesn't have HDR support, so values above 1 are just rendered as white. If you add rainbow = normalize(rainbow); before COLOR = vec4(rainbow, 2.0 * (0.5 - tail_center)); then the rainbow will still have color, though the colors will be muted.

    As @cybereality mentioned and what I have found on the documentation, the issue is that GLES2 uses an sRGB color space instead of a linear color space. I tried using OUTPUT_IS_SRGB but it was not working for me.

  • SIsilicon28SIsilicon28 Posts: 87Member

    Normalizing the colour worked. Thanks! But for some reason, I can't seem to type in OUTPUT_IS_SRGB without getting an error.

  • TwistedTwiglegTwistedTwigleg Posts: 1,826Admin

    @SIsilicon28 said:
    Normalizing the colour worked. Thanks! But for some reason, I can't seem to type in OUTPUT_IS_SRGB without getting an error.

    No problem, I'm glad that it is working. I also was getting errors with OUTPUT_IS_SRGB, at least in Godot 3.1. Maybe it is a Godot 3.2 thing? I didn't think to try testing Godot 3.2 and see if it works there.

  • SIsilicon28SIsilicon28 Posts: 87Member

    I'll be "waiting for Godot" 3.2 to be fully released until then. ;)

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file