alt text

SIMULATION

To run a cloth simulation use:
python run.py [GPU_ID] [NAME]
where GPU_ID defines which GPU/s to use and NAME is the name of the files where the results will be stored.
Results will be stored as:
‘results/[NAME].obj’ : a 3D mesh for the initial cloth state
‘results/[NAME].pc2’ : animation data for the cloth mesh in PC2 format
These results should be easily viewed in Blender.
NOTE: if using Blender, make sure to set ‘Keep Verts Order’ when importing the OBJ file.

You will find many simulation parameters at the beginning of the script ‘run.py’.
You will find parameters related to the Neural Collider in the script ‘run.py’, lines 83-89.
The code, as it is, is ready to run simulators using two colliders, the stanford bunny and dragon. Checkpoints are provided.
Nonetheless, it should be easily scalable to new objects.

TRAINING

Within the folder ‘SDF/’ you will find all the code needed to train new SDF.
To train a model:
python train.py [GPU_ID] [NAME]
where GPU_ID is the GPU to use and NAME is the name for checkpoint file.
Set 3D object data in ‘train.py’ line 80-81.
Training data can be provided as OBJ or NPY. More info below, see ‘Data’.

Checkpoints

In this folder you will find checkpoints for the bunny and dragon models.
The functionality to save and load checkpoints is written within the model.

Data

It contains the data pipeline implementation.
You can provide the Data object (defined in ‘data.py’) with an OBJ file or a NPY file. This is done in ‘train.py’, lines 82-83.
If OBJ, it will sample points and compute distances on the fly.
If NPY, it expects a pre-computed Nx4 matrix with ‘xyz’ and signed distance ‘d’ as (x,y,z,d) for each point.
The script ‘data.py’ can be used to pre-compute the points. Check lines 91-108.
Pre-computing the points heavily speeds up the training.

Model

Model implementation.
There are specific implementations for the stanford bunny and dragon. Their architecture corresponds to the provided checkpoints.
The simulation script already chooses the correct model for the bunny and dragon.
There is a generic model implementation ‘SDF.py’. Training script will import this model.
The architecture can be easily defined in ‘SDF.py’, function ‘_build(self)’, line 18.
Layers implementation found in ‘Layers.py’.

Objects

Put your OBJ files in this folder. It will also expect NPY files in this folder. ‘data.py’ automatically places NPY in this folder.
Currently it is empty due to size.

GitHub

https://github.com/HugoBA92/NeuralColliders