Soft2D: A 2D multi-material continuum physics engine designed for real-time applications.
This is soft2d's official repository for the latest releases, user examples, and documentation. The user documentation is hosted here.
Soft2D is a 2D multi-material continuum physics engine designed for real-time applications. With soft2d, users can simulate various materials such as fluids, sand, snow, and elastic bodies within their applications. Soft2D runs on GPU, and currently supports Vulkan and Metal backends.
Soft2D is distributed as shared library binary files and header files. These files are under the soft2d/
directory. Additionally, soft2d relies on the Taichi C-API library. The Taichi C-API library is located at dependencies/taichi_c_api/
, which has the same directory structure as soft2d/
.
Here we list the ABI compatibility of soft2d binary files:
Under the examples/
directory, we provide a collection of user examples demonstrating the capabilities of soft2d. These examples can run on Linux and Windows with Vulkan installed. All examples have been tested on Ubuntu 20.04/22.04 and Windows 10 with Visual Studio 2022. Follow the steps below to build and run these examples.
Video-version of these examples can be found on Soft2D YouTube channel.
git-lfs
to clone binary files correctly.git submodule
to install the necessary third-party dependencies for the Vulkan renderer.# git clone ...
# cd soft2d-release/
git lfs pull
git submodule update --init --recursive
Please install Vulkan SDK from vulkan-sdk website, and make sure Vulkan-related environment variables (VULKAN_SDK
) are properly configured.
Linux and Windows users can use the following commands to build and run the examples:
./build_linux.sh --clean
./build_linux.sh --test
./build_linux.sh --example=<example_name>
examples/basic_shapes.cpp
, please use the command ./build_linux.sh --example=basic_shapes
./build_linux.sh
build/
directory..\build_windows.bat --clean
.\build_windows.bat --test
.\build_windows.bat --example=<example_name>
examples/basic_shapes.cpp
, please use the command .\build_windows.bat --example=basic_shapes
.\build_windows.bat
build/Release/
directory.