Quantcast
Channel: Questions in topic: "compute shader"
Viewing all articles
Browse latest Browse all 287

GPU instancing and collision detection in flocking behaviour simulation

$
0
0
Hello!
I am working on a project that requires me to simulate flocking behaviour.

**CPU calculations can't get me far enough** My current approach calculates the flocking using the CPU, which maxes out the amount of possible boids (an object part of the swarm) at around 1500 instances, since each instance has to compare to all other instances in order to create true flocking behavior.
There are some other approaches like Physics.Overlapsphere or using Octrees instead of iterating over a full reference list or making use of ECS.
All of these CPU approaches won't get me over 2k Boids though.... but I need at least 4-5k boids that check collisions or distances to other objects in the scene.

**GPU computing for bigger swarms**
I have looked into compute shaders for this purpose, there is [GPU flocking project][1] out there that makes use of compute shaders and successfully simulates 32k boids at once, which is an insane amount!

However, these simulated instances do not collide or interact with the scene, aka other Monobehaviours. I need my boids to avoid obstacles, which currently works by registering collision and applying an opposite "fear force" onto the steering direction calculation.

**My Question**
Is it possible to register collisions with those GPU instanced objects? Are there other approaches that would work better, for instance ECS and GPU computing? Any suggestions on how to approach this are appreciated. [1]: https://github.com/Shinao/Unity-GPU-Boids

Viewing all articles
Browse latest Browse all 287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>