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

[3.x] Add infinite lifetime for Particles #53787

Draft
wants to merge 1 commit into
base: 3.x
Choose a base branch
from

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Oct 14, 2021

This is useful in custom shaders to render permanent elements such as grass.

I haven't tested this with custom shaders yet. Help is welcome in this area 🙂

This closes godotengine/godot-proposals#2614.

Testing project: test_particles_infinite_lifetime_3.x.zip

Preview

2021-10-14_02 21 49

TODO

  • Allow for particle curve animation by using the lifetime as an animation duration when the lifetime is infinite. (Don't hide the Lifetime property anymore when Lifetime Infinite is checked in the inspector.)
    • The animation should likely be looped rather than clamped.
  • Implement infinite lifetime in Particles2D.
  • Create a version of this PR for master.

Not sure about those:

  • Allow for particle movement (built-in velocity)? It's not very useful with infinite lifetime with the default ParticlesMaterial, since particles would usually end up going infinitely far from the origin.
  • Implement infinite lifetime in CPUParticles and CPUParticles2D? It's not very useful there since you don't have custom particle shaders.

@Calinou Calinou added this to the 3.5 milestone Oct 14, 2021
@Calinou Calinou changed the title Add infinite lifetime for Particles Add infinite lifetime for Particles (3.x) Oct 14, 2021
@QbieShay
Copy link
Contributor

QbieShay commented Nov 8, 2021

Hey @Calinou , thanks a lot for this work!

I believe that infinite lifetime is something relevant only for when doing a custom particle shader and it's fine if it doesn't mash well with the existing particle material

@RPicster
Copy link
Contributor

That's a great addition to the ParticleMaterial.

About the two points you are unsure:

  • Movement: I don't think there is any way of implementing this without making the behaviour different from what certain parameters normally do. If it's implemented in a way that makes sense it would probably be something that is looping and that would be a break from how velocity is used without infinite lifetime.
  • I think it could be useful in CPU Particles, however, much more limited than in GPU Particles. I think in the long run it will almost be impossible to have feature parity on CPU and GPU Particles.

@crabdancing
Copy link

Is there anything stopping this from getting merged? Excited to use this feature! :)

@Calinou
Copy link
Member Author

Calinou commented Sep 24, 2022

Is there anything stopping this from getting merged? Excited to use this feature! :)

See the TODO section in the pull request – this can't be merged in its current state. Feel free to salvage this PR as I don't have time to work on it.

This will also need an implementation in master to be merged first before this can be merged in 3.x. Implementing this in CPUParticles isn't required, but having the implementation available in both 2D and 3D is required.

@crabdancing
Copy link

3.x? My studio's already on 4.0! xD

I wouldn't mind taking a crack at helping out, although I don't think I'm familiar enough with the codebase for it to be expedient. I might make a PR one of these days, tho.

I've been led to believe that the logic (as opposed to hardware) particle API internals are essentially analogous, between CPU/GPU/2D/3D? If what needs to be done is mostly boilerplate, I think I can handle it.

@Calinou
Copy link
Member Author

Calinou commented Sep 26, 2022

I've been led to believe that the logic (as opposed to hardware) particle API internals are essentially analogous, between CPU/GPU/2D/3D? If what needs to be done is mostly boilerplate, I think I can handle it.

The way CPU and GPU particles are simulated internally is quite different, but 2D and 3D are very close to each other.

This is useful in custom shaders to render permanent elements
such as grass.
@Calinou Calinou force-pushed the particles-add-infinite-lifetime-3.x branch from 69dd5d4 to 23381dc Compare June 27, 2023 07:20
@Calinou Calinou changed the title Add infinite lifetime for Particles (3.x) [3.x] Add infinite lifetime for Particles Jun 27, 2023
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.

6 participants