Open krzmig opened 1 year ago
emit_subparticle() from inside the shader has the same issue.
For those wanting a workaround for this issue - convert the Process Material to a shader (warning: is somewhat destructive), there is a line in the shader that sets the color based on two attributes of the shader:
COLOR = hue_rot_mat * color_value;
If you uncomment this the per-particle color will work, albeit with the caveat that color_value and hue rotation will go unused.
there is a line in the shader that sets the color based on two attributes of the shader:
Would making that line use COLOR *=
fix the issue? The existing color would be multiplied instead of being overridden entirely.
there is a line in the shader that sets the color based on two attributes of the shader:
Would making that line use
COLOR *=
fix the issue? The existing color would be multiplied instead of being overridden entirely.
I've quickly tested this, and this has an effect similar to (identical to?) modulating the custom particle color with hue_rot_mat * color_value
. This however messes up when no custom color is set: the color is multiplied by the previous color over time.
I've made a few attempts - but it is quite difficult to preserve the hue-varying behavior while doing so and not turning the particle into a rainbow.
I confirm experiencing same issue in mono 4.1.3 and even 4.2 beta5.
Same thing happens here in Mono 4.2.1 stable.
For those wanting a workaround for this issue - convert the Process Material to a shader (warning: is somewhat destructive), there is a line in the shader that sets the color based on two attributes of the shader:
COLOR = hue_rot_mat * color_value;
If you uncomment this the per-particle color will work, albeit with the caveat that color_value and hue rotation will go unused.
I don't see this line in the shader code (Godot Mono 4.2.1 stable). The only line I see about COLOR is
COLOR = params.color;
This looks like it's the same issue as https://github.com/godotengine/godot/issues/83245
The ParticleProcessMaterial is not designed to handle colors coming from custom emitted particles. The logic for handling color just uses the parameters that go into the shader. If you want to use custom color from custom emitted particles, you need to write your own shader that handles that case.
This looks like it's the same issue as #83245
The ParticleProcessMaterial is not designed to handle colors coming from custom emitted particles. The logic for handling color just uses the parameters that go into the shader. If you want to use custom color from custom emitted particles, you need to write your own shader that handles that case.
But then why do the emit_particle function has "color" in its arguments if it does not work ?
I don't understand also how to modify the shader code in order to take into account the color passed into the emit_particle function. How do I get this color in the shader code ?
Godot version
4.0.2 stable, 4.1.dev1
System information
Linux Debian 11, Vulkan, NVIDIA GeForce GTX 1050
Issue description
Hi, I have a problem to change the color of manually emitted particles 3D. The particles still have the default color selected in the inspector. Other properties, such as position or velocity, work fine (I also included them in the project).
Steps to reproduce
Use method "emit_particle" with custom color on GPUParticles3D:
Minimal reproduction project
particles.zip