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

GPUParticles3D flickers frozen particle at world origin (0, 0, 0) when shader material has y-billboard set #72650

Closed
Tracked by #61067
kraybit opened this issue Feb 3, 2023 · 7 comments · Fixed by #75162

Comments

@kraybit
Copy link

kraybit commented Feb 3, 2023

Godot version

v4.0.beta17.mono.official [c400205]

System information

Windows 10

Issue description

With certain settings, GPUParticles3D intermittently shows a particle at world origin with zero velocity.

These settings in GPUParticles3D caused this behavior:

  • Lifetime 1 s
  • Material Override / StandardMaterial3D / Billboard / Mode : Y-Billboard
  • Mesh: Quad

Quirks

  • Turning Y-Billboard on and off toggles the bug
  • Setting Lifetime for particles to 10 s makes the bug disappear "for ever", even if setting back Lifetime to 1 s (?)

gpu_particles_ybillboard_bug

Steps to reproduce

  • Create new Godot project
  • Create new scene with Node3D
  • Add GPUParticles3D node
  • Under Process Material, select New ParticleProcessMaterial
  • Click ParticleProcessMaterial for settings, there set Emisssion Shape to Box
  • Under Draw Passes / Pass 1, select New QuadMesh
  • Click the QuadMesh for settings, there set size to 0.1 , 0.1
  • Under Geomeetry / Material Override, select New StandardMaterial3D
  • Click StandardMaterial3D for settings, there set Billboard / Mode to Y-Billboard
  • Set Transform y-position to 1

At world origin (0, 0, 0) there's intermittently a particle with zero velocity.

Minimal reproduction project

gpu_particles_ybillboard_bug.zip

@QbieShay
Copy link
Contributor

Could you re-test with apply_scale flag enabled?

@kraybit
Copy link
Author

kraybit commented Feb 22, 2023

If the Keep Scale flag is enabled (In the shader material), then the bug disappears!

image
Enabling Keep Scale fixes bug

Does this flag have any other side-effects? Also, I couldn't find any apply_scale flag?

@Calinou
Copy link
Member

Calinou commented Feb 22, 2023

I could reproduce a similar issue with the Particle Billboard mode here: #49767 (comment)

godotengine/godot-demo-projects#849 also has a stray rain particle in the world origin that remains visible for a long time because of this.

@QbieShay
Copy link
Contributor

QbieShay commented Feb 23, 2023

oop sorry @kraybit . Yes, it was keep scale not apply scale :D

@Calinou particles use scale 0 to try and make particles invisible, but if keep scale is off then a new matrix is generated based on the camera matrix and the instance_custom.x as a rotation value, so the particles that should be "dead" are instead displayed at the origin (at least this is how it worked in 3.x)

@Calinou
Copy link
Member

Calinou commented Mar 19, 2023

@Calinou particles use scale 0 to try and make particles invisible, but if keep scale is off then a new matrix is generated based on the camera matrix and the instance_custom.x as a rotation value, so the particles that should be "dead" are instead displayed at the origin (at least this is how it worked in 3.x)

Interesting, I thought their position would be changed to -INF, -INF, -INF (effectively ensuring they're outside the view frustum). This is what the Hide On Contact collision mode does. Should we make it scale particles to 0, 0, 0 instead of moving them?

@QbieShay
Copy link
Contributor

I think that's what happens already, but if you don't enable scale in billboards you still see them. The inf solution sounds better

@ecmjohnson
Copy link
Contributor

The inf solution is much cleaner (2 line change vs. 12) and doesn't have a performance impact on the billboarded materials since they don't need to even check anything

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