Skip to content

GrahamZen/Soft-Body-Simulation-CUDA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CUDA-Accelerated Soft Body Simulation

CUDA CMake Build (Linux)

University of Pennsylvania, CIS 565: GPU Programming and Architecture, Final Project

Click here for documentation (CIS5650 Final Project version)

Overview

This project is a CUDA-accelerated soft body simulation framework originally developed as a final project for CIS 5650: GPU Programming and Architecture at Upenn.

The goal of this project is to explore GPU-based physics simulation by building a lightweight, extensible simulation framework with minimal external dependencies. The system is designed to support rapid experimentation with different:

  • physical models,
  • numerical solvers,
  • GPU-accelerated linear algebra pipelines.

Features

  • Linear Solvers

    • Sparse Cholesky Prefactorization W/ Approximate Minimum Degree Ordering
    • Dense Cholesky Prefactorization
    • Jacobi Solver (Naive)
    • Cholesky Decomposition
    • Preconditioned Conjugate Gradient
      • Incomplete Cholesky Preconditioner
      • Jacobi Preconditioner
  • FEM

    • Projective Dynamics
      • Direct (Cusolver's Cholesky)
      • Chebyshev Acceleration
    • Explicit Euler
    • Incremental Potential Contact (IPC)
      • Barrier
      • Frictional Contact
      • Dirichlet Boundary Conditions
        • Equality Constraints
      • Materials
        • Corotational
        • Neo-Hookean
  • Collision Detection

    • Real-Time BVH Construction
    • Continuous Collision Detection (CCD)

Dependencies

System Requirements

  • Operating System

    • Windows
    • Linux
  • CUDA Toolkit ≥ 12.0 (cublas, cusolver required)

  • CMake ≥ 3.18

  • OpenGL

Third-Party Libraries

The following libraries are included directly in the project:

  • OpenGL
  • ImGui
  • GLFW
  • Eigen
  • spdlog
  • Catch2

External tools:


Configuration

Environment Configuration

The full runtime configuration is specified in context.json. This file defines simulation contexts, solver settings, and physical parameters.


Scene Configuration

The framework supports multiple simulation contexts, each representing an independent scene. A context may contain:

  • one or more soft bodies,
  • rigid bodies,

Each context can be configured independently with physical parameters such as time step size, gravity, damping coefficients. Contexts can be switched at runtime.


Solver Configuration

Solver behavior is controlled on a per-context basis.

  • Single-precision (float)

    • Uses the Projective Dynamics (PD) solver
  • Double-precision (double)

    • Uses the Incremental Potential Contact (IPC) solver

Only parameters relevant to the active solver are applied.

Notes on Solver Usage

  • The PD solver supports interactive object dragging.
  • IPC is not recommended for scenes with a large number of degrees of freedom; for large vertex counts, careful parameter tuning is required, otherwise the simulation may fail to converge and pause.
  • For large-scale systems, Cholesky-based solvers can become prohibitively slow; PCG with a Jacobi preconditioner is recommended instead.
  • Linear solvers can be switched via ImGui before simulation starts.

Screenshots

showcase.mp4

About

A real-time soft body simulation framework (Incremental Potential Contact (IPC), Projective Dynamics ...)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •