↓ Skip to main content

Digital garment modelling in VR

·444 words·3 mins

Digital garment modelling in VR (short dgmvr) is a cloth simulation tool in VR developed as a semester thesis at the Interactive Geometry Lab at ETH Zurich.

Showcase with gravity and no regularization

Method
#

Existing methods and VR implementations
#

There are many different approaches used to simulate fabrics (table links either to paper about method or an vr implementation if it exist)

MethodFastPreciseAnisotropic deformations
Mass spring systems (1)✓XX
Finite element method (2)X✓✓
Yarn level simulation (3)X✓✓
Position based dynamics (4)✓~X
Chebshev (5)✓✓✓

Chebyshev deformation
#

The goal of the semester thesis was to implement the Chebyshev deformation (introduced by Annika Öehri here) in Unity. The goal of the method is to solve minimize following energy describing the stretching of our mesh along the yarn lines.

Equation to minimize

Here C is the set of jakobians for deformations we want to allow. To minimize the energy a local global approach can be used. The local step (1,2) are independent for each triangle and the global solve (3) corresponds to a sparse solve of a symmetric matrix. The pseudo code is as follows:

foreach iteration step
  1. Compute jakobian J_t
  2. Solve local step c_t = min_{c ∈ 𝐶} ||J_t - c||_f
  3. Minimize SUM_{t ∈ T} A_t c_t 
  4. Recompute velocity

Position constraints can be enforced by clever substitution and we can add gravity by changing the free vertices before the solve (not constrained/pinned by user). One important thing if gravity is added, our cloth can collapse into a line (still in set C), thus regularizer’s are needed that slightly bias our c_t towards rotations only without deformations (method use ARAP for this).

Showcase
#

Showcase without gravity or regularization Showcase with gravity and regularization

Implementation
#

The project was made in Unity 5 and supports Meta’s headsets with the Meta Quest 3 being tested. It runs via the Link (due to how the simulation code is compiled currently). While C# has numerics libraries, they all have some drawbacks.

LibraryFlaw
Numerics.NetNot free
AlglibBLAS level (no easy sparse x sparse mult.)
Math.NetNo sparse factorization

Instead the project relies on Unity’s support for external C++ dll, handling the whole simulation in C++ with Eigen and Libigl while passing the mesh data between each other. The simulation supports grabbing handles and changing different parameters (stiffness, regularization strength, gravity strength) and does one iteration per frame.

Code
#

The code of this project is hosted on Github.

Acknowledgement
#

This project was developed as a semester thesis at IGL under the supervision of Annika Oehri