ZePoLiTaT / PyFleX

Customized Python APIs for NVIDIA FleX

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PyFleX

NVIDIA FleX is an amazing particle-based simulator for simulating interactions between rigid bodies, fluids, clothing, etc. In this repo, we have developed Python bindings for setting up and interacting with a few enviroments that we can used to evaluate different simulation and control algorithms.

Prerequisite

This codebase is tested with Ubuntu 16.04 LTS and CUDA 9.1. Other versions might work but are not guaranteed.

Compile and play with the original demo provided by NVIDIA FleX

First compile the demo

cd demo/compiler/makelinux64/
make -j

Then go to the target folder and start the demo!

cd ../../../bin/linux64
./NvFlexDemoReleaseCUDA_x64

Compile PyFleX with CMake & Pybind11

Go to the root folder of PyFleX, and set up paths

export PYFLEXROOT=${PWD}
export PYTHONPATH=${PYFLEXROOT}/bindings/build:$PYTHONPATH
export export LD_LIBRARY_PATH=${PYFLEXROOT}/external/SDL2-2.0.4/lib/x64:$LD_LIBRARY_PATH

Compile PyFleX

cd bindings/
mkdir build; cd build; cmake ..; make -j

Try with FluidFall example. A window will pop up showing the simulation results.

cd ${PYFLEXROOT}/bindings/examples
python test_FluidFall.py

Demo

Following we provided 6 environments for you to play with. Directly run the python scripts to see the simulation results. Screenshots will be stored in ${PYFLEXROOT}/bindings/examples/test_[env]/.

FluidFall - Two drops of high-viscosity fluids are falling down and merging with each other.

cd ${PYFLEXROOT}/bindings/examples
python test_FluidFall.py

BoxBath - A block of water is flushing a rigid cube.

cd ${PYFLEXROOT}/bindings/examples
python test_BoxBath.py

FluidShake - Shake a box of fluids. The following script will first simulate the scene, and then playback the motion of the particles with the frontal wall removed for visualization.

cd ${PYFLEXROOT}/bindings/examples
python test_FluidShake.py

RiceGrip - Grip an object that can deform both elastically and plastically (e.g., sticky rice).

cd ${PYFLEXROOT}/bindings/examples
python test_RiceGrip.py

RigidFall - A stack of rigid cubes falling down.

cd ${PYFLEXROOT}/bindings/examples
python test_RigidFall.py

FluidIceShake - Shake a box of fluids and a rigid cube. The following script will first simulate the scene, and then playback the motion of the particles with the frontal wall removed for visualization.

cd ${PYFLEXROOT}/bindings/examples
python test_FluidIceShake.py

APIs

Please see the example test scripts and the bottom of bindings/pyflex.cpp for available APIs.

References

About

Customized Python APIs for NVIDIA FleX

License:Other


Languages

Language:C++ 86.7%Language:C 6.7%Language:Makefile 2.2%Language:HLSL 2.1%Language:Python 1.1%Language:Objective-C 0.7%Language:Cuda 0.3%Language:CMake 0.1%Language:Batchfile 0.0%