This code generates reduced subspaces for physics-based simulations, including real-time deformable character animation.
- Uses a snapshots method to capture the range of deformations for a character.
- Snapshots: Collected during a range-of-motion test for a character mesh.
- Provides the closest approximate solution with a user-defined size.
- Tested on projective dynamics simulations, which use an iterative solver for position state computation.
- Faster, more stable, and visually accurate compared to Linear-blend skinning subspaces.
For more details, refer to the following publication(s):
- Improved-Projective-Dynamics-Global-Using-Snapshots-based-Reduced-Bases SIGGRAPH23 1st place student competition award-winning paper.

- On DEIM Compatibility for Constraint Projection Reduction soon available
Developed by:
- Shaimaa Monem
- Max Planck Institute for Dynamics of Complex Technical Systems, Magdeburg, Germany.
Repository:
- https://github.com/ShMonem/animSnapBases
- Moved from: https://github.com/ShMonem/Snapshots-Reduction-Subspaces-for-Projective-Dynamics
License:
- Apache-2.0 see LICENSE.md.
- This code borrwes some functions from the beautiful implementations of SPLOCS, which was published under MIT license.
Copyright holders:
- Install dependencies from
venv_requirements.txt:
pip install -r venv_requirements.txt
- Activate the virtual environment:
- On Linux:
source re_pd/bin/activate - On Windows
re_pd/Scripts/Activate
- On Linux:
Thank you for your interest in our code, which you all the fun trying it out :-). !The code id structured into main directories
| Item | sub-directories | data/code |
|---|---|---|
input_data |
<mesh>\<experiment>\FOM_snapshots |
*.off/*.ply |
snapbases |
posSnapshots.py |
|
posComponents.py |
||
nonlinear_snapshots.py |
||
constraintsComponents.py |
||
projective_dynamics |
demos |
|
main.py |
||
Simulators.py |
||
usr_interface.json |
||
utils |
utils.py |
|
process.py |
||
support.py |
||
test |
compare_npy_files.py |
|
config |
config.py |
|
bases_config.json |
-
input_datastores your snapshots or frames in.offor.plyformat. If you use a different example or file format, update the inputs inconfig/bases_config.json. -
To run the provided example, execute
main.pyin the root directory:python main.py -
In
main.py:
- Snapshots/frames are imported, creating a
.h5file with aligned frames. basescontainer is initialized by calling theposComponentsclass.posComponentshas anposSnapshotsattribute that access configurations from.json.-
bases = posComponents() - Compute the bases using:
bases.compute_components_store_singvalues(vertPos_output_directory) - Store the bases/components as
.binor.npy:bases.store_components_to_files(vertPos_output_directory, start, vertPos_numComponents, step, '.bin')
For vertex positions reduction, a repository redPD is provided in order to test and reproduce results from the mentioned paper.
- Kindly refer to the dedicated README.test.md. It explains all steps starting from snapshots collections to bases testing.
For constarints projection reduction, the directory projective_dynamics/
contains README.pd.md
that explains all steps to collect nonlinear forces snapshots and basis computations, as well as running reduced simulations.
- Clone the repo.
- Install the virtual environment.
- Run the code from the root directory using
python main.pywithsplocs->"compute": "No"and then withsplocs->"compute": "Yes":"splocs": { "compute": "No", }
PCA--> computeis always set toYes, otherwise no computations run.- Bases matrices in
.bin/.npy/.h5formats, and a.csvfor singular values if desired, will be stored inresults/<mesh>/<experiment>/q_bases/. - After bases storage, both snapshots and bases can be visualized, this option can be modified in the
bases_config.json. Associated animation files can be found in bothresults/<mesh>/<experiment>/q_snapshts_h5/andresults/<mesh>/<experiment>/q_bases/. Note: In order to stop the snapshots animations from the animations cycle, pressstop animation --> OKthen close the tap, otherwise it might produce an error.
For code navigation and further development, refer to config/README.dev.md.