Is it possible to give 3D particles animated textures?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By del
:warning: Old Version Published before Godot 3 was released.

I’ve tied to give a fixed material an atlas texture, but that didn’t work. Maybe it works with shader materials, but I don’t understand them yet and it seems like there are no settings for animations in the particle inspector anyway.
Is there a way to do this?

:bust_in_silhouette: Reply From: puppetmaster-

I only found an example to animate tiles in a tilemap over CanvasItemShader in this video
Pause the video to see the finished CanvasItemShaderGraph.

It also works with the particles.

It’s not the exact answer but perhaps you get the idea.

Sorry, I hadn’t had the time to try this till now. I’ve tried to set up a shader material like in the video, but after I linked the textures they didn’t show on the particles. Also I’ve tried to set up a graph shader, which worked better, but I couldn’t figure out the exact settings (because I can’t watch the video in hd) and it seems far too complicated for that matter, anyhow compared to setting up some animated 2D sprites.
Maybe I try something with 3DSprites. Dunno. Thanks for your answer anyway!

del | 2016-03-18 01:57

:bust_in_silhouette: Reply From: KRL

Yes it is totally possible by two ways:

  1. Put the texture with fixed material on the particle and animate the texture pixel by pixel (not very efficient)
  2. Put the texture containing all the frames of your animation next to each other, with fixed material and use old trick with changing mapping of the texture selecting the part with the one frame of your animation and just jumping with mapping coordinates beetwen the frames

Thanks for your answer, but I think I don’t understand you. I couldn’d find a way to animate fixed materials, except with an animation player, but that won’t work for me because than all the particles would have the same frame at the same time.
What do you mean with pixel by pixel?

del | 2016-03-18 02:04

If you want to have every particle animated separately then write particle system by yourself using “3d sprites”.

KRL | 2016-03-18 14:02

:bust_in_silhouette: Reply From: Ninfur

I couldn’t find an answer to this anywhere so I’ll post a solution here that works in Godot 4. I’m unsure about earlier versions, but I did not see the same settings in Godot 3.4.2 after a quick look.

There are parameters that control how many frames the texture contains under the geometry’s spatial material in a group called “Particles Anim”:
enter image description here

While the parameters that control animation speed and frame offset are located in the particle material (aka process material) in a group called “Animation”:
enter image description here

By tweaking these parameters it’s possible to achieve both an animated flip book effect, or randomly selected particle texture without using multiple particle systems.

Additional information
The way these two materials communicate with eachother seems to be explained in one of the particle articles in the docs.

A unique thing about particle shaders is that some built-in variables are saved across frames. TRANSFORM, COLOR, and CUSTOM can all be accessed in the Spatial shader of the mesh, and also in the particle shader the next time it is run.

Just a reminder for myself and anyone who can’t find the “Particle Anim” group under “Billboard”. You have to change the billboard type to “Particle Billboard”, otherwise the “Particle Anim” won’t show up in the panel. It is same in Godot 3.x and 4.x. (And I spent almost one hours for each… I really think Godot makes such simple function too complicate.)

meowyih | 2023-03-29 05:26