Skip to content

chainGpu, a GPU-based chain physics simulator tool for TouchDesigner.

License

Notifications You must be signed in to change notification settings

mickeyvanolst/TD-chainGpu-Physics-Sim-Tool

Repository files navigation

chainGpu Physics Simulation Tool

NON-COMMERCIAL USE ONLY

Tested on TouchDesigner 2022.32660 for Windows.

Description

chainGpu is a toolkit that allows you to simulate chain-like physics on the GPU using TouchDesigner. It is especially suitable for structures found in nature such as flowers, plants, grass, tentacles, hair and trees. Or any other use case where your imagination might take you.

The calculations are done on a compute shader, and use a unique method where each segment posesses a target orientation, allowing it to calculate a linear velocity to get closer to that orientation. This results in organic looking movements which are fully compatible with other aspects, such as gravity, wind, turbulence, colliders etc. Please note that this approach is very different from most other physics simulations, a more common approach is to apply springs and make use of Verlet-integration. At this point I have yet to research the advantages or disadvantages compared with this method. It does however come with limitations in its current form.

Demos

In the included toe file you'll find four demos, including annotation.

basic_setup Example of the tox itself with nothing added. As you can see, quite a lot is already possible out of the box.

til

flower_demo_recursive By using multiple simulation instances, you can create complex animations that build on top of each other. Here you can see the flowers are anchored to the positions of the stem from the previous instance. Note that TD Chain Physics Sim can only handle 1D textures as an input.

til

teapot_demo You can use 1D textures to spawn chains onto existing geometry, both the point positions and the normals can be used. This demo also showcases how to use the positions from the simulation in order to deform a Tube SOP. chainGpu Physics has build-in geometry intended for debugging, but is intended to simply supply the position and orientation data needed to build your own graphics.

til

hello_demo Due to the way we are calculating the forces based on orientations, we can actually supply our own target orientations. This demo shows how you can take the positions and normals of an existing path SOP and use it to initialize a physics chain.

til

Known issues and limitations (see Issue Log for details)

  • This tool is still in development, beware of dragons.
  • Not really an issue, but keep in mind some of the demos only work if you have a licence.
  • chainGpu is not intended to be a fully featured physics engine, neither is it a fully accurate representation of the real world, it will work well for some things.
  • Due to an issue with GPU Texture buffer allocation, uncooking/cooking the parent comp where you place chainGpu, it will get comprimised data in its buffers, no matter if you reset the simulation. If anyone knows whats up, let me know.

Roadmap (see Issue Log for details)

  • Recursion, paving the way for linked structures such as L-systems, bones, etc. Currently you can use multiple instances of chainGpu Physics to achieve a similar effect.
  • Self-collision, make chains collide with other chains and their own segments (will likely require binning method to remain performant).
  • More options for colissions, repellers and attractors
  • Arbitrary anchor points
  • Elasticity
  • Compatibility with particlesGpu from the TD Palette

Credits

I'd like to thank Atagen, Tim Gerritsen, Markus Heckmann, Josef Pelz and David Braun. This project has been inspired by their work, and includes knowledge and methods they shared with the community.

chainGpu has been developed by Mickey van Olst (2023).

Portfolio: mickeyvanolst.com

Instagram: @mickeyvanolst

Please inquire for any commercial applications. Non-commercial use only, author must be credited.

Shield: CC BY-NC-SA 4.0

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

CC BY-NC-SA 4.0

About

chainGpu, a GPU-based chain physics simulator tool for TouchDesigner.

Resources

License

Stars

Watchers

Forks

Packages

No packages published