godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.08k stars 21.18k forks source link

Particles2D - texture animation speed problem with random lifetime #54993

Closed RPicster closed 2 years ago

RPicster commented 2 years ago

Godot version

3.4 stable

System information

Windows 10 (GLES3)

Issue description

When setting up a Particle2D or CPUParticle2D node with a animated texture (frames setup via a CanvasItemMaterial), the animation won't be fully played when using a random lifetime in the particle system.

The animation will always be played a speed depending on the full lifetime and will be cut off if the particle dies earlier (due to random lifetime)

It can be fixed in the Particle2D node by converting to a shader and changing CUSTOM.y to tv at the anim_speed line.

https://user-images.githubusercontent.com/9423774/141766384-797a590e-8ff0-482a-9885-dd455e5296f0.mp4

Steps to reproduce

Minimal reproduction project

3.4_particle_texture_animation_speed.zip

akien-mga commented 2 years ago

I guess both the current and "fixed" behavior could be considered valid? How do other parameters behave in relationship to random lifetime, e.g. scale?

RPicster commented 2 years ago

I guess both the current and "fixed" behavior could be considered valid? How do other parameters behave in relationship to random lifetime, e.g. scale?

I remember in the past no other parameters were "influenced" by the random lifetime. But some time ago this behaviour was changed and now most parameters get influenced by the random lifetime and use the randomized lifetime as their way to measure progressing through time.

After a quick check, following parameters work with a modified random lifetime:

And the following parameters don't work with it:

So I would say that it's really the exception.

Calinou commented 2 years ago

Particle random lifetime was originally fixed in https://github.com/godotengine/godot/issues/43485, but I guess flipbook animation wasn't taken into account.

Does this bug occur in 3D too?

RPicster commented 2 years ago

Particle random lifetime was originally fixed in #43485, but I guess flipbook animation wasn't taken into account.

Does this bug occur in 3D too?

Judging by the code: yes I tried to reproduce it, but honestly 3D isn't my strength and I didn't find out how to use a flipbook animation in 3D.

akien-mga commented 2 years ago

For context as references were lost: