Ghislain Girardot demonstrates how to use and write HLSL for Niagara's NeighborGrid3D to implement GPU-based spatial hashing and particle collisions.
Files are available as a Tier 1 reward on my Patreon (BOIDS not included!): patreon.com/GhislainGir
Twitter: twitter.com/GhislainGir
Mastodon: @GhislainGir@mastodon.gamedev.place
Intro
NeighborGrid3D Interface: What For?
System/Emitter Base Setup
NeighborGrid3D Initialization
MaxNeighborsPerCell
Module Input
Fill Grid Sim Stage
Particle Index Randomness
Fill Position
Unit Space
Transform Matrix
Transform Matrix Module
World Position
Simulation To Unit
Unit To Index
Add Particle
HLSL Fill
HLSL Execution
GPU_SIMULATION
Fill Module Configuration
Query Grid Sim Stage Setup
Query Grid HLSL
Cells For Loops
Particles For Loop
Index To Linear
Particle Index
Neighbor Particle Position
Distance To Neighbor
Collision Distance
Resolve Collision
Query Module Configuration
Result
Simulation Stage Iterations
Debug View
From Emitter To System
Debug Emitter
Debug Cell Init
Debug Text Material
Debug Cell Material
Get & Send Debug Data
Update Debug Cells
Cell Color
Debug View Conclusions
Create Asset & Template
Improving Visuals
Velocity & Forces
Material
Light Upon Hit
PBD
Penetration Offset Issue
Mass
Restitution
Add Particle HLSL
Single For Loop
Bounds
Spatial Hash Grids
Conclusion
Outro
Hope you'll like the video!
Why it's here
1 person recommends this
What people say. Recommended as a practical guide to implementing spatial hashing and collision detection on the GPU using Unreal Engine.
On “Has anyone successfully implemented collision detection and resolution on the GPU using compute shaders or CUDA?”
Collision detection on the gpu is a broad topic - there are many different approaches. For example, Neighbor grid is extremely popular to implement on the gpu. It is basically a fast spacial hash. Here is an example in Unreal: [video Physx itself has optional CUDA support https://nvidia-omniverse.github.io/PhysX/physx/5.6.1/docs/GPURigidBodies.html . If you areinterested in cloth, avbd might be more what you are looking for https://graphics.cs.utah.edu/research/projects/avbd/