Skip to content

Meshcapade/smpl-rs

Repository files navigation

🚶‍♂️ SMPL-rs

Smpl-rs is the suite of SMPL functionality implemented in Rust over gloss. It has features for creating smpl-bodies, modifying and rendering them

Crates.io PyPI License: MIT

SMPL-rs Banner

Features

  • Run forward passes through SMPL models (betas -> mesh)
  • Modify betas and expression parameters of the SMPL model in real time
  • Interfaces with gloss for rendering meshes both in native and web

Documentation

Getting Started

The easiest way to get started with smpl-rs is to install the Python bindings.

$ pip install smpl-rs

Some examples of how to use the python bindings can be found in the python examples linked above.

Data

To use smpl-rs you need to download the SMPL-X data.

  • Download the models from here (Download SMPL-X with removed headbun NPZ).
  • After this change the paths in the misc_scripts/standardize_smpl.py file to the path where you downloaded the models and where you want to save the standardized models. You will need some additional files provided in the data/smplx folder.
  • Then run as python misc_scripts/standardize_smpl.py to standardize the models. Lazy loading will need to be set to the path where you saved the standardized models.

Installation and Dependencies

The main dependency is gloss which will be downloaded and compiled automatically when building this package. You will need rust, and the rest is handled by cargo. To install Rust, simply run the following in your terminal:

$ curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh

Some additional dependencies for Linux:

$ sudo apt-get install libvulkan-dev vulkan-tools xorg-dev libxkbcommon-x11-dev

For MacOs, it should run out of the box.

For running the Rust examples

$ cd smpl-rs
$ cargo run --bin smpl_minimal

For running the Python examples

$ cd smpl-rs/bindings/smpl_py
$ pip install gloss-rs smpl-rs 
$ ./examples/minimal.py

Some more Information

  • The SMPL suite renders using gloss and therefore uses an Entity-Component-System (ECS) framework. For more info on ECS check here. However to be noted that we use [Hecs] for our ECS system but most of them are very similar.
  • Components like Animation and Betas are added to entities and that dictates which systems it uses. If you don't want animation on the avatar, just comment out the component for it when creating the entity.
  • For adding new functionality to gloss we use callbacks. This is needed because on WASM the rendering loop cannot be explictly controlled.

About

A suite of SMPL functionality built in Rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages