texelFetch equivalent in GLES2

gba25gba25 Posts: 6Member
edited May 27 in Shaders

I am trying to export my game for HTML5 so I converted project to GLES2 from GLES3. The game heavily depends on shaders. In GLES3 I was using texelFetch to access some data in shader script but once I converted it to GLES2 I get following error:

"texelFetch(sampler2D, ivec2, int)" is supported only on high-end platform!

Is there any other way to access sampler2D values? texture( sampler2D, UV) doesn't work because it doesn't return exact values (I searched and found out that it applies some filters but I'm not sure what that means)


Tags :

Answers

  • DschoonmakerDschoonmaker Posts: 266Member

    Why can't you use texture()? I've never had any problems with it.

  • SIsilicon28SIsilicon28 Posts: 757Moderator

    The second function only applies a filter if you setup the sampled texture to do so. Most if not all Godot textures have a filter property. If you disable that along with mipmaps you are guaranteed to have no filters applied to the texture.

    Also when converting from texelFetch to texture, bare in mind that their coordinate systems are different. The first one has a range of (0, texture size), while the other has the range of (0, 1).

  • gba25gba25 Posts: 6Member

    @SIsilicon28 said:
    The second function only applies a filter if you setup the sampled texture to do so. Most if not all Godot textures have a filter property. If you disable that along with mipmaps you are guaranteed to have no filters applied to the texture.

    Also when converting from texelFetch to texture, bare in mind that their coordinate systems are different. The first one has a range of (0, texture size), while the other has the range of (0, 1).

    Thank you! It worked but texture still has very low accuracy. texelFetch was able to extract values from sampler2D with 32 bit float accuracy

Leave a Comment

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