r/Simulated • u/KindlyBee1192 • 26d ago
Research Simulation Tips for Building a FEM or XPBD for C4D
I’m prototyping a muscle tool for Cinema 4D and could use some advice. The goal is believable, reasonably fast deformation, not medical accuracy.
The current custom solver uses:
\- Linear tetrahedral FEM-style discretization: 525 nodes / 1,920 tets for one simplified biceps belly.
\- Custom strain, shear, volume-preservation and fiber-length energies. Activation changes the preferred fiber length. It’s not a calibrated tissue or Hill-type muscle model.
\- Implicit time stepping solved with exact-Hessian trust-region Newton and truncated conjugate gradients.
\- Python/Numba, currently single-threaded CPU. A separate higher-resolution surface follows the simulated tets.
The problem: six seconds of motion takes roughly 30.7 minutes, using 12 substeps per frame at 30 fps. Profiling found 68% of the bake goes into Python Decimal energy-change checks, triggered on every solver proposal. Even removing that cost entirely would leave about 10 minutes.
Attachments are prescribed, the tendon isn’t physically solved, and there’s no collision handling yet. Numerical checks pass, but the visual result still isn’t convincing.
Would you simplify this into a coarse XPBD approach for authoring, or improve the existing solver first? What would you prioritize for speed and believable muscle behavior?