godot: emit_particle doesn't work (GPUParticles2D and 3D)

Godot version

v4.2.beta1.official [b1371806a]

System information

Windows 10 / NVIDIA Geforce GTX 1060 3GB / all backends

Issue description

GPUParticles2D/3D emit_particle doesn’t do anything in the 4.2 beta 1. In the last snapshot it worked fine. Tested in Forward+, Mobile and Compatibility backends.

Steps to reproduce

Create a GPUParticles2D and set up as normal. Add following script:

extends GPUParticles2D
func _process(delta: float) -> void:
	emit_particle(global_transform, Vector2.ZERO, Color.WHITE, Color.WHITE, 0b11111)

or GPUParticles3D

extends GPUParticles3D
func _process(delta: float) -> void:
	emit_particle(global_transform, Vector3.ZERO, Color.WHITE, Color.WHITE, 0b11111)

Minimal reproduction project

ParticleMRP.zip

About this issue

  • Original URL
  • State: closed
  • Created 9 months ago
  • Comments: 20 (16 by maintainers)

Most upvoted comments

So, about the Rotation, Scale, Color, CUSTOM Red/Blue/Alpha and CUSTOM documentation? Do they deserve issues of their own to look into that later?

I’ve made a little reproduction project to test the issue in 2D and 3D. It works directly on the editor and exposes the emission settings to test the issue.

From the tests, I’ve found out that the CUSTOM color’s Alpha and Green channels are being used for the particle’s lifetime.

  • More green lowers the lifetime, less alpha also does the same.
  • In Godot 4.1.2-stable none of this happen.

I’m not completely sure on how emit_particle() works, but from more testing, I’ve also found that it doesn’t seem to be applying Rotation, Scale or Color. This behavior is the same in Godot 4.1.2-stable.

Also, the compatibility renderer explicitly warns on the console that it does not support manually emitting the particles.

GPUParticle Emit.zip

You unbroke it!

Haha no i think emit_particle still needs to be fixed

Then we also need some documentation, since CUSTOM has no description of what each value does.

Yeah fair!

CUSTOM.x = angle (for billboard) CUSTOM.y = current lifetime CUSTOM.z = animation for flipbook CUSTOM.w = lifetime randomness

actual lifetime (in 0-1 value) is INSTANCE_CUSTOM.y/INSTANCE_CUSTOM.w

I’m not so sure either how my PR broke it, but of note CUSTOM always had lifetime in green and lifetime randomness in alpha. That is intended behaviour, unless there’s some strange interaction now that wasn’t there before