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

Random initial color for all Particle Nodes #55263

Merged

Conversation

RPicster
Copy link
Contributor

In this PR all Particle Nodes get a new parameter: color initial

In this new parameter, a Gradient can be set and each particle will select a random color from that Gradient on birth.
This color then gets multiplied with the overall color. Like this is is combineable with the normal color_ramp (color over life) and color.

This gives a lot more flexibility when setting up particle systems.
It also makes sense to add this as in 4.0 all parameters got min and max values, so it fits into that mindset.

For GPUParticles2D and GPUParticles3D it is solved via the ParticleMaterial class.
For CPUParticles2D and CPUParticles3D it is implemented directly in the classes.

Converting from GPU to CPU is supported in 2D and 3D.

Here are some examples of using this new parameter:

kgY9BrB8tO.mp4

@Calinou
Copy link
Member

Calinou commented Nov 23, 2021

Now that we have a random initial color ramp, do the Hue Random properties still have an use case? These also provided random color functionality, but in a less flexible way (it was also harder to control).

@RPicster
Copy link
Contributor Author

RPicster commented Nov 23, 2021

Now that we have a random initial color ramp, do the Hue Random properties still have an use case? These also provided random color functionality, but in a less flexible way (it was also harder to control).

I also tought about this, but hue manipulation is doind a different kind of color change than a multiplication.
I agree that hue is pretty hard to use "correctly", but I don't think it is out of use.

Sometimes it's really great to combine all of the properties to get a lot of variety in the final result.

EDIT: A good example of a combination of both parameters:
You want a firework that has a random initial color of either red, blue or yellow.
Now combining that with a random hue those initial colors would be slightly shifted resulting in a more interesting color 👍

@RPicster RPicster force-pushed the ParticleMaterial-random-start-color branch from d649c08 to b004a9b Compare November 26, 2021 00:15
Works with 2D and 3D GPU Particles
@RPicster RPicster force-pushed the ParticleMaterial-random-start-color branch from b004a9b to ddf8269 Compare December 3, 2021 12:58
@akien-mga akien-mga merged commit 3c44843 into godotengine:master Dec 10, 2021
@akien-mga
Copy link
Member

Thanks!

@RPicster
Copy link
Contributor Author

If it's ok, I would love to do a backport for 3.x 😃

@akien-mga
Copy link
Member

Sure 👍

@RPicster RPicster deleted the ParticleMaterial-random-start-color branch December 10, 2021 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants