![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | johnygames |
I want to add a shader to a particular tile in a tileset and I want it to affect the specific tile only. So far I have tried adding shaders in the individual tileset slots, but the effect of those shaders seem to take the whole tileset into account and not just the tile that I have put the shader into.
Here’s a simple example:
Say I have four tiles in tileset. Now, I add the following shader to the last tile:
shader_type canvas_item;
void fragment(){
vec2 uv_2 = (UV * cos(TIME))*0.5;
COLOR = texture(TEXTURE, uv_2 );
This is supposed to animate the tile’s texture and create a swaying motion. But to my dismay I see that the whole texture is being animated and not just the tile I have selected. I’ve thought of exporting all tiles s individual textures and aign these into the sshaders, but that is a lot of work and it seems impractical. How do we make it so the shader samples one tile and considers only that tile’s UVs?