Godot Version
4.3 stable
Question
Classic thing.
I have an 8x8(tiles of 32x32 pixels) texture atlas.
I spawn a bunch of particles.
Each particle is a quad and should get a random tile from that 8x8 texture atlas.
I’ve tried INSTANCE_ID and INSTANCE_CUSTOM but both of them yield an error in my shader for me.
caption: I cant even get it to accept the statement…
.
What am i missing here? How would you normally utilize IDs to “shift” the UVs in an atlas?
.
void fragment()
{
int id = INSTANCE_ID;
vec2 atlas_uv = flipbook(UV, vec2(TILING, TILING), TIME * FLIP_SPEED);//Speed is 0, so image stays put.
vec4 atlas_result = texture(TEXTURE, atlas_uv);
ALBEDO = atlas_result.rgb;
ALPHA = atlas_result.a;
ALPHA_SCISSOR_THRESHOLD = ALPHA_THRESHOLD;
}