How to make shader change texture uv?

Godot Version



As you can see from the screenshot above, I’m going to try to customize a Shader to allow MultiMesh to render different Regions of the same texture, but I don’t really know much about Shaders. i have a merge of Textures right now, with each Tile being 3232, so how do I go about tweaking the Shader so that the multimesh can render different I have a merged Textures, each Tile is 3232.

You’d need some kind of input, like a uniform, to tell the sampler which position to fetch from the texture. Technically, you can use another texture for that, but maybe a custom vertex array is more adequate. It really depends on what exactly you are doing with this.

I’m trying to use MultiMesh to render different regions of the same texture. My current idea is to change the UVs in the shader to achieve this.

Yeah, but for what purpose?

Renders a very large number of sprite

So you’re trying to do what the TextureAtlas already does, but in a shader?
I can already tell you that it’s not worth it, because godot does not have support for data textures yet, and that means you can’t pass the instancing data in a reasonable way. You do not need to worry about this until you actually hit a performance issue, so maybe by the time that is true then godot will have support for it.
Until then, just use TextureAtlas.

1 Like