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

Add More Support and Optimizations for PBD simulation purposes. #31

Merged
merged 1 commit into from
Jan 30, 2025

Conversation

erayzesen
Copy link
Owner

@erayzesen erayzesen commented Jan 30, 2025

Although QuarkPhysics does not have multithreading capabilities to comfortably handle a large number of particles in PBD soft body simulations, we can improve this aspect in single-thread mode with the necessary optimizations that are currently missing, using fun experimental body types for various tests. This PR is expected to add the following supports:

  • Apply the S&P method in a comprehensive manner to handle a larger number of particle collisions, as it is applied to body objects in the physics engine.
  • Add a new QTexturedPBDBodyNode node type for quick tests and use in projects. This node type converts particles into a PBD body with the given texture data. To save on rendering, it uses Godot's MultimeshInstance features and offloads the rendering task to the GPU, separate from other physics objects. It applies a morphing effect to the particles and blends them together. It also has a breakable property that can be adjusted for durability, if needed.
  • Add the QAngleConstraintsObject object. This object can create angle constraints between 3 given particles. It will be available for all uses in the physics engine where needed, though it will not be used in QTexturedPBDBodyNode.

Data from this PR:

  • In tests with QTexturedPBDBodyNode, it was observed that a large number of particles require many iterations. For networks composed of a large number of particles that are interconnected, colliding with each other, and in contact with the world, our default modest iteration count is insufficient to solve them. The necessary iteration counts for solving them cause significant performance bottlenecks.
  • Since we currently do not have multithread support, the maximum number of particles that can be processed is quite limited. We can handle around 15,000 to 20,000 particles connected with QSpringObject, colliding with themselves and other similar objects. However, the results are still reasonable for single-thread conditions, and we could even say they are good.

@erayzesen erayzesen marked this pull request as ready for review January 30, 2025 08:48
@erayzesen erayzesen merged commit d68b93e into master Jan 30, 2025
48 checks passed
@erayzesen erayzesen deleted the feature/improve_pbd_soft_body_support branch January 30, 2025 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant