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

Billboarded particles are rotated incorrectly with double-precision builds #89020

Closed
TCROC opened this issue Feb 29, 2024 · 10 comments
Closed

Billboarded particles are rotated incorrectly with double-precision builds #89020

TCROC opened this issue Feb 29, 2024 · 10 comments

Comments

@TCROC
Copy link
Contributor

TCROC commented Feb 29, 2024

Tested versions

Godot Engine v4.3.dev.mono.custom_build.a47830c66

System information

Pop OS 22.04

Issue description

When rotating an instance of ParticlesGPU3D, the particles become distorted. They continue to distort worse and worse until a threshold is passed and they become invisible.

Here is a particle effect that isn't rotated:

image

image

And here is one that is rotated 85.5 degrees along the x axis:

image

image

And if you continue to rotate it, it eventually becomes invisible:

image

This poses a problem for wanting to do things like simulate a rocket emitting fire out of a thruster. Or pretty much any dynamic moving and rotating 3d object.

Steps to reproduce

  1. Open the example project.
  2. See that everything is behaving as expected in "ParticlesGpu.tscn".
  3. See that things are distorted in "ParticlesGpuRotated.tscn"

Minimal reproduction project (MRP)

GodotGpuParticlesBug.zip

@TCROC
Copy link
Contributor Author

TCROC commented Feb 29, 2024

Ok I found a solution. Maybe its not a bug. I would love some clarification tho and maybe whether or not we should consider enabling this by default. Anyways:

image

Enabling "Rotate Y" seems to fix it. So my new questions are:

  1. What does this boolean do?
  2. Why do I get the weird distorted behavior without it?
  3. Why isn't it enabled by default?
  4. Is there a performance impact? (This might be answered by 3).

Thanks again everyone! :)

@clayjohn
Copy link
Member

Running your MRP it both the regular parties and the rotated particles look fine

Rotated particles
image

However, I noticed that the project is flagged as using "double precision" and you are using a custom build of Godot.

Can you test the project with your custom build with double precision disabled? This issue might be specific to double precision builds

@TCROC
Copy link
Contributor Author

TCROC commented Feb 29, 2024

Yep I'll give that a shot

@clayjohn
Copy link
Member

Also to be clear, I don't think Rotate Y is the proper fix here, it more likely just avoids the actual problem for some reason. Its a good data point to help find the actual solution though

@TCROC
Copy link
Contributor Author

TCROC commented Feb 29, 2024

While godot is building on my machine, I tested it with the CPU particles as well. I noticed that the CPU particles don't seem to change the direction they emit from / towards when rotating in 3D space. Would this be another bug? Is there a config that needs to be checked for CPU particles to emit relative to its current rotation?

@TCROC
Copy link
Contributor Author

TCROC commented Feb 29, 2024

I can confirm that both CPU and GPU particles are working as expected without double precision enabled. So there are currently 2 known issues with particles and double precision builds:

  1. GPU Particles get distorted when rotating.
  2. CPU particles do not emit in the correct direction when rotating.

So I guess the issue should probably be renamed to something more in line with:

"Particles rotating incorrectly on double precision builds" or something along those lines.

@TCROC
Copy link
Contributor Author

TCROC commented Feb 29, 2024

And just tested "Rotate Y" with CPU particles. That does not fix the CPU particles like it does the GPU particles.

@Calinou Calinou added the bug label Feb 29, 2024
@Calinou Calinou changed the title GPU Particles 3D distorted when rotating Billboarded particles are rotated incorrectly with double-precision builds Feb 29, 2024
@cridenour
Copy link
Contributor

Dupe of #76388 but great find on the Rotate Y workaround.

@TCROC
Copy link
Contributor Author

TCROC commented Mar 1, 2024

Thanks @cridenour ! :) So I guess we can probably close this issue as a duplicate then? Unless you guys still want to keep it open for reference. I opened up a separate issue for what I found with the cpu particles that I mentioned in this issue: #89061 so we won't lose that if we close this.

@clayjohn
Copy link
Member

clayjohn commented Mar 1, 2024

Thanks @cridenour ! :) So I guess we can probably close this issue as a duplicate then? Unless you guys still want to keep it open for reference. I opened up a separate issue for what I found with the cpu particles that I mentioned in this issue: #89061 so we won't lose that if we close this.

I'll go ahead and close this as we like to only keep one issue open. The discussion was fruitful though and this will remain linked to #76388

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

No branches or pull requests

4 participants