Code Monkey home page Code Monkey logo

Comments (3)

Jondolf avatar Jondolf commented on June 4, 2024 10

This has been sitting here for a while now; apologies for not leaving a proper response sooner.

This is clearly a very important issue to address, and definitely one of the areas where bevy_xpbd is severely lacking in comparison to Rapier and many other physics engines.

I'm in the process of a major rework of the solver and a lot of the other internals (see #346, although it's slightly outdated at this point). It will hopefully be ready and released in roughly a couple of weeks. The new version only runs narrow phase collision detection just once per frame instead of once per substep, and is also more stable in general, which should improve performance for collision-heavy applications quite significantly (about 3-5x fps in some tests, but results may vary).

After that, I plan on opening a bunch of issues for further performance improvement work, as well as a tracking issue. Some big things include:

  • Simulation islands (most likely persistent and parallel)
    • This would also fix sleeping, as the current per-body approach is not great
  • Graph coloring for the solver to enable large-scale multi-threading on modern multi-core hardware
  • SIMD contact solving with wide types to solve multiple constraints at once
    • Requires wide types in Glam (I've been experimenting a bit with this)
  • One-body constraints for interactions like dynamic-static contacts
  • A better broad phase (most likely a dynamic Bounding Volume Hierarchy)
  • Use par_iter in more systems in general (position integration, CCD, constraint preparation)
  • Figure out a fix for #356

Simulation islands will probably be the first big improvement I plan on working on after the upcoming release, along with one-body contact constraints (which should be pretty trivial) and some smaller miscallaneous performance work. Other things like graph coloring and SIMD constraints might take longer, but I'm interested in trying to implement them as well.

In short, I acknowledge that the current performance frankly sucks for physics engine standards, and I really want to improve the engine in this regard. The new solver should hopefully address some collision performance issues, but there will still be a lot of follow-up work. I will lay this out in more detail in issues after the upcoming release.

from bevy_xpbd.

mattlennon3 avatar mattlennon3 commented on June 4, 2024 5

I was just coming here to write a similar issue. The move-marbles example is a fairly sluggish 30fps for me while moving them around.
I am researching libraries to implement something like this fluid simulation, which seems to have excellent performance with vanilla JS in a web browser. There are significantly more entities in that simulation too.

Thanks again for your amazing contribution!!!

I would definitely echo this, I am not trying to throw any shade on the developers here. This library seems really great already, just lacking in performance right now.
Thanks 🙏

from bevy_xpbd.

dror-g avatar dror-g commented on June 4, 2024 2

The new version only runs narrow phase collision detection just once per frame instead of once per substep

Amazing! great to see these small high-reward fixes. great work finding these!

Use par_iter in more systems in general (position integration, CCD, constraint preparation)

Sounds like good first-issues for contributors!

I have very high confidence in this project, given your priorities and roadmap. Well done!

from bevy_xpbd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.