• This repository has been archived on 03/Nov/2023
  • Stars
    star
    163
  • Rank 230,195 (Top 5 %)
  • Language
    C#
  • License
    MIT License
  • Created over 4 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Trying to replicate what this legend did: https://youtu.be/kCGHXlLR3l8

GPU Cloth Simulation For Real-time Application

This repository is still currently under development, so everything is still in testing mode. A lot of things will break, download at your own risk :/

Disclaimer: This project is in a paused state so there won't be more updates. In the future, if there are any changes to this project, I will post an issue update on this repository. Stay tune!

My goal is to replicate what this legend did: https://youtu.be/kCGHXlLR3l8 (A smooth and interactive cloth simulation)

Currently, my cloth simulation uses Postion Based Dynamics and supports:

  • Distance Constraint
  • Bending Constraint
  • Point Triangle Distance Constraint (Self Collision)
  • Aerodynamics (Wind Effect)

Features comming soon:

  • Vivace Gauss Seidel Method for optimization on GPU (random graph coloring)
  • Primitive Shape Collision (Sphere, Box and Capsule)

Check out my YouTube Playlist where I record my journey on how I approach this problem!

Support me on Patreon so that I can allocate more time to work on this project!

How to use?

*Note: The GPU version is not fully developed yet, this tutorial section will not work for the GPU version.

  1. Create a mesh in Blender that you want to simulate.
  2. Use my custom Blender Addon - Blender Mesh to JSON to transform your mesh into PBD form and export it into your Unity's StreamingAssets folder.
  3. Create an empty GameObject in Unity.
  4. Drag and drop CPUClothSimulation.cs or GPUClothSimulation.cs script onto the GameObject. (Check Cloth Configurations for more cloth parameters' information.)
  5. Select the correct JSON file that the Blender Cloth Exporter Tool exports using the button - Select JSON File.
  6. Press the button - Load Data from JSON.
  7. Put in your Front Material and Back Material.
  8. Press Build Mesh to build the mesh that you have modeled in Blender.
  9. Press Create Back Side to build the other side of the mesh.
  10. Press Apply Materials to apply materials on both sides.

Cloth Configurations

These are the similar parameters in both CPU and GPU Cloth Simulation:

Materials

This determines the front material and back material for the cloth.

ClothSimParam

Tweak these parameters to change the behaviour for the cloth.

  1. Gravity: Constant acceleration.
  2. Compression Stiffness: Coefficient for distance constraint when 2 particles are too close together.
  3. Stretch Stiffness: Coefficient for distance constraint when 2 particles are too far away.
  4. Bending Stiffness: Coefficient for bending constraint when 2 neighbor triangles are not at their rest angle.
  5. Thickness: Cloth thickness for all collisions.
  6. Damping: Multiplier of velocity for every simulation to reduce velocity (as air resistance).

Simulation

Tweak these parameters to balance between accuracy and performance.

  1. Iteration Steps: Number of iterations to solve constraints for every simulation.
  2. Delta Time Step: Time pass between 2 simulations.
  3. Start Simulation On Play: Choose if you want to start the simulation once you enter play mode.

License

This project is under MIT License.

More Repositories

1

URPVolumetricLighting

Volumetric Lighting in URP
C#
139
star
2

UnityTTS

Text to Speech in Unity.
C#
118
star
3

UnityAudioVisualizer

Audio Visualizer in Unity.
ShaderLab
75
star
4

UnityNLP

Natural Language Processing in Unity.
C#
62
star
5

UnityGPUVectorGraphics

Rendering vector graphics in Unity with the power of GPU.
C#
44
star
6

UnityUtil

Utilities for Unity.
C#
34
star
7

UnityASR

Automatic Speech Recognition in Unity.
C#
32
star
8

UnityKinematicaX

A next-generation character animation system built on top of Unity's Kinematica.
C#
22
star
9

UnityAI

AI in Unity.
C#
19
star
10

UnityTTSExamples

Text to speech examples in Unity.
ShaderLab
12
star
11

BlenderMeshToJSON

Addon for Blender to export mesh data as a JSON file.
Python
11
star
12

TransformerChatbot

Training a chatbot using a transformer.
Python
10
star
13

UnityAnimaticExamples

Animation system (motion matching and more) examples in Unity.
C#
10
star
14

bevy_radiance_cascades

Radiance cascade global illumination implementation in Bevy.
Rust
9
star
15

UnityASRExamples

Examples of Automatic Speech Recognition in Unity
ShaderLab
6
star
16

UnityMotionGraphics

Motion graphics creation tool.
C#
5
star
17

UnityGPUVectorGraphicsExamples

GPU accelerated vector graphics examples in Unity.
ShaderLab
5
star
18

boomboom

A physics based explosion game made almost entirely using Unity's ECS.
C#
5
star
19

bevy_vello_renderer

A minimal integration for rendering Vello graphics in Bevy.
Rust
5
star
20

parallel_programming_tutorial

Parallel programming tutorial.
Rust
5
star
21

UnityRasa

Rasa Tree Flow Graph in Unity.
C#
4
star
22

OmniTwin

OmniTwin is a digital twin made in Unity for the Rescue AI project for disaster awareness and disaster prediction.
C#
4
star
23

SmartAssistant

A smart personal assistant to make your life easier.
ShaderLab
2
star
24

unity_pbd_pendulum

C#
2
star
25

galacticguardian

A 2D ship building strategy game made in Unity.
C#
2
star
26

KinematicaTest

Testing Unity KinematicaX on the latest Unity LTS version.
C#
2
star
27

beauty-of-shaders

Beauty of shaders talk presentation via motion canvas.
TypeScript
1
star
28

bevy_motion_matching

Rust
1
star
29

PETS.CO

Online Pet Shop demo that only sells dog.
PHP
1
star
30

UnityNLPExamples

UnityNLP examples.
C#
1
star
31

nixon_resume

Nixon's resume. Created via Typst.
Typst
1
star
32

ggj2024

A game made in global game jam 2024.
Rust
1
star
33

FieryDash

SDP project
C#
1
star
34

LessIsMore

GameJam for BTP #3
C#
1
star
35

OxygenNotEnough

Level 99 Game Jam
C#
1
star