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

CPU Particle Systems #3504

Closed
wants to merge 11 commits into from
Closed

Conversation

james7132
Copy link
Member

@james7132 james7132 commented Dec 31, 2021

Objective

Provide an early, WIP initial implementation of bevyengine/rfcs#28 that is up to date with the current state of the Bevy.

Solution

Imports much of the prototype code from https://github.com/james7132/bevy_prototype_particles as bevy_particles. This PR includes the following:

  • A Particles component for holding particles and directing simulation.
    • Allows controlling whether the particle system is actively simulating or not, including modifiers.
    • Setting cull_mode to Pause will cause the particle system to pause when no longer visible by any view, saving CPU resources. This can be overridden to enable simulation, even when not visible.
  • A ParticleEmitter component for easily configuring how and when particles are spawned
  • A ParticleModifier trait for components that alter the post-initialization behavior of particles.
    • Basic ConstantForce modifier that applies a consistent force on each of the particles in a given system, can be used for creating gravity
  • A Transparent2d/Transparent3d phase render pipeline for extracting and rendering particle systems.
    • Includes basic batching of particles across particle systems with the same materials.
    • Particle shader that renders billboarded quad particles without a vertex buffer. Supports up to u32::MAX / 6 particles per draw call.
    • Hooks into existing visibility systems to limit rendering only to particle visible particle systems.
  • A basic example.

This PR does not include the following, and will/may be addressed in follow-up PRs:

  • 2D rendering of particles (i.e. Transparent2d render phase rendering)
  • Curve based modifiers. (Dependent on an animation curve implementation like Math for Curves and Interpolations (Lerp and Callmul-Rom) #1837)
  • Lit particles.
  • Parallelized particle system simulation.
  • Visibility limited simulation of particles.
  • WebGL2/SSBO-less platform support.
  • "Pre-warming" of particle systems.

For the rationale on many of the design choices made here, please see the associated RFC.

@github-actions github-actions bot added the S-Needs-Triage This issue needs to be labelled label Dec 31, 2021
@james7132 james7132 changed the title CPU Particle System CPU Particle Systems Dec 31, 2021
@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen C-Feature A new feature, making something new possible S-Needs-Design-Doc This issue or PR is particularly complex, and needs an approved design doc before it can be merged and removed S-Needs-Triage This issue needs to be labelled labels Dec 31, 2021
@Weibye Weibye added the S-Adopt-Me The original PR author has no intent to complete this work. Pick me up! label Aug 10, 2022
@james7132 james7132 removed the S-Adopt-Me The original PR author has no intent to complete this work. Pick me up! label Sep 10, 2022
@james7132
Copy link
Member Author

Closing this out as there has been too much drift in the renderer implementations and the shift towards GPU-driven rendering, as well as crates like bevy_hanabi readily available in the ecosystem.

@james7132 james7132 closed this Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Feature A new feature, making something new possible S-Needs-Design-Doc This issue or PR is particularly complex, and needs an approved design doc before it can be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants