Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Particles Animation repeat the first frame when using not square sheets #36435

Closed
Anyeos opened this issue Feb 22, 2020 · 7 comments · Fixed by #53237
Closed

Particles Animation repeat the first frame when using not square sheets #36435

Anyeos opened this issue Feb 22, 2020 · 7 comments · Fixed by #53237

Comments

@Anyeos
Copy link

Anyeos commented Feb 22, 2020

Godot version:
3.2 stable

OS/device including version:
Ubuntu 19.10

Issue description:
The Particles2D with Particles Animation repeat the first frame when it animates.
On a 3x2 sheet the Particles Animation shows in this order: 1, 2, 3, 1, 5, 6. But it must be: 1, 2, 3, 4, 5, 6
The sheet is correctly created from left to right and uppter to bottom.
I numerated the sheet and it repeat the number "1". So it is eventualy wrong.

Steps to reproduce:

  1. Add a Particles2D node.
  2. Load a texture with a sheet of animation (ie: Explosion)
  3. Create a CanvasItemMaterial and set it to animate and fill the H and V frames properly.

Minimal reproduction project:

@Anyeos
Copy link
Author

Anyeos commented Feb 22, 2020

muzzle1

Simple0000-2020-02-22_00 06 48

@Anyeos
Copy link
Author

Anyeos commented Feb 22, 2020

Workaround: Instead of 3x2 sheet I created a 2x3 sheet with the same frames and it works as expected.

@tom-jk
Copy link

tom-jk commented Jul 12, 2020

Can't reproduce in 3.2.2.stable.

Minimum reproduction project: 36435.zip

Video (0m10s)

@Calinou
Copy link
Member

Calinou commented Jul 12, 2020

@tom-jk Thanks for testing it! I'll close this as resolved then.

If anyone else can still reproduce this in 3.2.2 or later, please comment so this issue can be reopened.

@Anyeos Also, it's best to upload a minimal reproduction project when reporting bugs so people can try reproducing it in the exact same configuration (same renderer, same node properties).

@Calinou Calinou closed this as completed Jul 12, 2020
@Calinou Calinou added this to the 4.0 milestone Jul 12, 2020
@Anyeos
Copy link
Author

Anyeos commented Oct 1, 2020

The problem is still present but different behaviour. And the same behaviour in CPUParticles2D. So it appears to be a bug inside of the sheet handling.

Godot Engine v3.2.2.stable.official

Here the Godot project to reproduce:
Bug#36435.zip

@metinc
Copy link
Contributor

metinc commented Sep 29, 2021

I found another discussion on this topic where the conclusion was that it must be related to older hardware or drivers: #31699

I can reproduce this bug on v3.3.3.stable.official [b973f99]. I'm using Ubuntu 21.04 but my hardware is not old (AMD Ryzen 7 4800H with Radeon Graphics).

@metinc
Copy link
Contributor

metinc commented Sep 29, 2021

I looked into this issue and found out that it is caused by an imprecision in the shader when calling floor(). For example the parameter in floor() could be expected to be 1.0 and should be floored to 1.0 but in fact it is something like 0.999999 and gets floored to 0.0 (because of the imprecision). Have a look at my bugfix for the exact line of code #53233 . You will see that I added a 0.5 to the number of frames before using floor which ensures we wont get close to numbers where imprecision might happen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants