This is the testing Godot forums! All forum posts unique to this forum will be deleted! Please use the main forums here for any posts you want to keep. All forum rules still apply.

texelFetch equivalent in GLES2

gba25gba25 Posts: 6Member
edited May 2020 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: 216Member

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

  • SIsilicon28SIsilicon28 Posts: 693Moderator

    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

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.