11 - Finding collisions among thousands of objects blazing fast

  Рет қаралды 26,736

Ten Minute Physics

Ten Minute Physics

Күн бұрын

Пікірлер: 43
@kiaranr
@kiaranr 2 жыл бұрын
Hash grids are my go-to solutions for all things that interact in space; which is a lot. They seem to always beat other spatial partitioning algos
@nolram
@nolram 2 жыл бұрын
Thank you for these videos, they are an absolute treasure.
@ahmedsalih2308
@ahmedsalih2308 11 ай бұрын
This is the best explanation of neighbor search algorithms I've seen on youtube yet and you demystify really hard concepts for me. Thanks a ton! Now I understand a lot better :)
@WomboBraker
@WomboBraker Жыл бұрын
i was playing around with building a simple game with lots of moving units that follow certain rules, and came up with storing an id of each entity to an 2 dimensional array for proximity logic. This example here showed me in the end how naive my idea was, but damn i'm exited to apply this videos teachings into practice!!!
@toshi4186
@toshi4186 2 жыл бұрын
Thank you so much matthias... This is gold !
@ssssos5155
@ssssos5155 2 жыл бұрын
Sweet! waiting for an upload for softbody+rigid body interaction :)
@TenMinutePhysics
@TenMinutePhysics 2 жыл бұрын
I will certainly do a tutorial on this once I have introduced XPBD rigid bodies.
@barlex9113
@barlex9113 Жыл бұрын
@@TenMinutePhysics Any status on the progress of the XPBD rigid bodies? Do you maybe have a written resource somewhere?
@saivarunsanapala8199
@saivarunsanapala8199 11 ай бұрын
@@barlex9113 he hasn't released in his channel yet, but he gave a talk about it in 2020. you can see his paper there
@johnpelitidis6297
@johnpelitidis6297 10 ай бұрын
What you do is outstanding... Thank you 🙂
@7steelrainbow
@7steelrainbow 2 жыл бұрын
Thanks for this tutorial. Building an hash grid seems very affordable.
@hommhommhomm
@hommhommhomm Жыл бұрын
Thank you! This excellent video would be easier to find if the word "collision" was present in the title.
@pronotron
@pronotron Жыл бұрын
Thank you for sharing! How you handle collisions if other primitives mixed in PBD like spheres, boxes, capsules?
@odo432
@odo432 Жыл бұрын
This is great if all the objects are the same size. But if you've got variable sized objects then things start to become increasingly more complicated fairly quickly with growing impact on performance.
@joshuasonnen5982
@joshuasonnen5982 21 күн бұрын
I wanted a table showing hashing speeds for different number of particles. I have my own collision detection written in Julia and can't tell which is faster.
@444haluk
@444haluk 2 жыл бұрын
Great! Watched all your videos! How about fluids? Are your XPBD videos enough?
@TenMinutePhysics
@TenMinutePhysics 2 жыл бұрын
I am glad you like the videos. I won't restrict the content in any way within the field of real-time physics.
@voxelltech
@voxelltech 2 жыл бұрын
Thank you for the video!
@DasAntiNaziBroetchen
@DasAntiNaziBroetchen 9 сағат бұрын
Does anyone here have any information on how this compares to using a BVH to find colliding pairs? A BVH has obvious advantages like not caring about the size of elements.
@Typhh
@Typhh 2 жыл бұрын
Hey matthias! how do you deal with input points that have negative values? i'm trying to sample a selection of points ranging from -10/10 xyz however the hashing function and querying seems alittle off. Many thanks!
@Typhh
@Typhh 2 жыл бұрын
ah turns out it was fine all along, just needed to use a better table size :)
@robbie_
@robbie_ Жыл бұрын
So I implemented this algorithm in C++ and made it multithreaded using std::execution::par. I used _InterlockedIncrement and _InterlockedDecrement to prevent races. I could do a single pass constructing the structure ready for collision checks giving it an array of 1,000,000 entities with a 2048x2048 size grid in about 14ms. Pretty good. I didn't try quadtree. Something tells me it'll be way slower with way more contention (single threaded was about 47ms - the benefit of multithreading grows with the number of entities of course).
@Pheubel
@Pheubel 11 ай бұрын
Have you also tried playing around with hardware acceleration where you use a single instruction to handle multiple bits of data. With the locality, i would imagine it could speed it up by a fair bit
@mmmovania
@mmmovania Жыл бұрын
Thank for the tutorial. You shared on slide 5 that you need to check 9 cells in 2D I dont understand why? from the image on slide 5, you have shown if the distance h=2r then u only need to test four cells to check for overlap/collision no?
@sayochikun3288
@sayochikun3288 Жыл бұрын
Yes. Worse case scenario is a ball, overlapping with 4 cells but calculating "which 4 cells" is worse than just checking 9 of them in most cases.
@neonmarblerust
@neonmarblerust Жыл бұрын
@@sayochikun3288 No, you need to check 9 cells because you need to check all cells where another ball might be able to overlap. You need to query more than just the cells the ball can touch, you need all of the cells that can contain a ball that touches the queried ball.
@sayochikun3288
@sayochikun3288 Жыл бұрын
@@neonmarblerust you might be right. Ill make a quick sim to fiddle my thoughts then come back to you
@DasAntiNaziBroetchen
@DasAntiNaziBroetchen 9 сағат бұрын
@@sayochikun3288 And we never heard from them again...
@sayochikun3288
@sayochikun3288 8 сағат бұрын
@@DasAntiNaziBroetchen I'm still working on the simulation 👍
@PaleyDaley
@PaleyDaley 2 жыл бұрын
A couple of questions: 1) You say with naively checking 100 thousand objects you'd need ten billion tests. But surely it should be only half that, because you don't want to test pairs twice. Right? I know it's not important, but I just want to clarify. 2) For the hash cells that correspond to empty grid cells, why do they contain valid values? Shouldn't they contain -1 so you can skip them?
@TenMinutePhysics
@TenMinutePhysics 2 жыл бұрын
You are right, only half. Here we are just looking at the order of magnitude though The entries have the same first and last value so we don't do anything without the need of doing a special check.
@fizixx
@fizixx 2 жыл бұрын
ten billion --- (1:36) according to what's written.
@LowLifeGraphicsProgrammer
@LowLifeGraphicsProgrammer 2 жыл бұрын
This scheme seems easy to parallelize, but too many atomics ops I guess...
@TenMinutePhysics
@TenMinutePhysics 2 жыл бұрын
For the GPU there is a better algorithm: documents.pub/document/particle-based-fluid-simulationbased-fluid-fluid-simulationbased-fluid-simulation.html
@alengm
@alengm 2 жыл бұрын
@@TenMinutePhysics isn't this the same one as in the video?
@ThankYouESM
@ThankYouESM 2 жыл бұрын
Could you please make us an HTML5 3D graphics engine as a single file... which I hope to build a Py2JS solution for very soon? Thanks.
@quillaja
@quillaja 2 жыл бұрын
you could check out p5.js
@drk7016
@drk7016 Жыл бұрын
The movement of those balls proves that the universe was not formed by random evolution but was created by God
@phutureproof
@phutureproof 11 ай бұрын
keep taking those pills brother
@Pheubel
@Pheubel 11 ай бұрын
Terry might be gone, but his spirit lives on.
@atomictraveller
@atomictraveller Ай бұрын
ball movement. that's what i'm getting at. yeah. it's a part of you it's a part of me. deez
@DasAntiNaziBroetchen
@DasAntiNaziBroetchen 9 сағат бұрын
I seriously did not expect to see a religious comment like this here. I'll let you in on a secret: Those balls are not moving around randomly. Here's another secret: Evolution isn't random.
Spatial Hash Grids & Tales from Game Development
19:08
SimonDev
Рет қаралды 123 М.
15  - Self-collisions, solving the hardest problem in animation
7:31
Ten Minute Physics
Рет қаралды 13 М.
小丑女COCO的审判。#天使 #小丑 #超人不会飞
00:53
超人不会飞
Рет қаралды 16 МЛН
黑天使只对C罗有感觉#short #angel #clown
00:39
Super Beauty team
Рет қаралды 36 МЛН
Что-что Мурсдей говорит? 💭 #симбочка #симба #мурсдей
00:19
Tuna 🍣 ​⁠@patrickzeinali ​⁠@ChefRush
00:48
albert_cancook
Рет қаралды 148 МЛН
09 Getting ready to simulate the world with XPBD
15:38
Ten Minute Physics
Рет қаралды 23 М.
Python Hash Sets Explained & Demonstrated - Computerphile
18:39
Computerphile
Рет қаралды 124 М.
Geohash: Deep Intuitive Understanding in under 7 Minutes
6:56
Jim O'Flaherty
Рет қаралды 38 М.
Neat AI does Spatial Hash Boids
8:10
Neat AI
Рет қаралды 17 М.
17 - How to write an Eulerian fluid simulator with 200 lines of code.
12:05
Ten Minute Physics
Рет қаралды 314 М.
Faster than Rust and C++: the PERFECT hash table
33:52
strager
Рет қаралды 613 М.
Just Boids | Useless Game Dev
12:10
Useless Game Dev
Рет қаралды 65 М.
What P vs NP is actually about
17:58
Polylog
Рет қаралды 145 М.
10 - Simple and unbreakable simulation of soft bodies
13:53
Ten Minute Physics
Рет қаралды 19 М.
The Absolute Best Intro to Monads For Software Engineers
15:12
Studying With Alex
Рет қаралды 678 М.
小丑女COCO的审判。#天使 #小丑 #超人不会飞
00:53
超人不会飞
Рет қаралды 16 МЛН