|Topic was automatically imported from the old Question2Answer platform.
I need this for my 3D plane. I have a single png file containing several sprites and I want to show a certain sprite onto my 3D plane mesh using shadermaterial with params such as vframes(number of frames vertical), hframes(number of frames horizontally), frames(current shown frame), and texture. Basically I want a shadermaterial that works just like the 2D Sprite node’s animation properties.
I could just use a viewport and sprites to draw the spite I want and return the viewport’s texture to my 3d mesh material or manually separate the large png file into several smaller files. But that would make the game I am making run a tad bit slower. I want to use a single large png file for all my sprites so that the file will be cached during gameplay allowing better performance compared to loading many different files.
I’ve been reading the docs on shading language but I can’t seem to get an idea on how to specifically show only a part of the large png file using shaders. Please guide me senpais.