Godot Version
v4.4.1.stable.official [49a5bc7b6]
Question
I have a texture representing a table of uint data values that I’d like to pass into my shader. I’m declaring the parameter as
uniform usampler2D biome_map : repeat_disable;
and reading it with
uint biome = texture(biome_map, UV * biome_scale + biome_offset).r;
This seems to be returning a 0 where the texture is 0 and I’m guessing a NaN anywhere else because when I divide that number by even very large values, it’s still acting like it’s greater than 1.
I’ve also tried this:
uint biome = texelFetch(biome_map, ivec2((UV * biome_scale + biome_offset) * vec2(textureSize(biome_map, 0))), 0).r;
but get the same result.
The data texture was originally created by writing out an Image with FORMAT_R8, and with a PackedByteArray having values between 0 and 10.
What’s the right way to read data from this texture?