Тёмный
No video :(

11 - Finding collisions among thousands of objects blazing fast 

Ten Minute Physics
Подписаться 24 тыс.
Просмотров 23 тыс.
50% 1

For the source html code and all other tutorials see matthias-research.github.io/p...
In this tutorial I show how to find overlaps among thousands of objects using spatial hashing. In addition to explaining the method, I also show how to implement it in a very efficient way.

Опубликовано:

 

5 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 36   
@nolram
@nolram 2 года назад
Thank you for these videos, they are an absolute treasure.
@kiaranr
@kiaranr Год назад
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
@WomboBraker
@WomboBraker 8 месяцев назад
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 !
@johnpelitidis6297
@johnpelitidis6297 4 месяца назад
What you do is outstanding... Thank you 🙂
@7steelrainbow
@7steelrainbow 2 года назад
Thanks for this tutorial. Building an hash grid seems very affordable.
@voxelltech
@voxelltech 2 года назад
Thank you for the video!
@ahmedsalih2308
@ahmedsalih2308 5 месяцев назад
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 :)
@odo432
@odo432 11 месяцев назад
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.
@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 8 месяцев назад
@@TenMinutePhysics Any status on the progress of the XPBD rigid bodies? Do you maybe have a written resource somewhere?
@saivarunsanapala8199
@saivarunsanapala8199 5 месяцев назад
@@barlex9113 he hasn't released in his channel yet, but he gave a talk about it in 2020. you can see his paper there
@hommhommhomm
@hommhommhomm 11 месяцев назад
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?
@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.
@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 :)
@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 6 месяцев назад
@@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 6 месяцев назад
@@neonmarblerust you might be right. Ill make a quick sim to fiddle my thoughts then come back to you
@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 5 месяцев назад
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
@PaleyDaley
@PaleyDaley Год назад
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 Год назад
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.
@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 Год назад
you could check out p5.js
@fizixx
@fizixx Год назад
ten billion --- (1:36) according to what's written.
@user-ef3ej4pq4f
@user-ef3ej4pq4f 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 Год назад
@@TenMinutePhysics isn't this the same one as in the video?
@drk7016
@drk7016 8 месяцев назад
The movement of those balls proves that the universe was not formed by random evolution but was created by God
@phutureproof
@phutureproof 6 месяцев назад
keep taking those pills brother
@Pheubel
@Pheubel 5 месяцев назад
Terry might be gone, but his spirit lives on.
Далее
09 Getting ready to simulate the world with XPBD
15:38
Spatial Hash Grids & Tales from Game Development
19:08
Просмотров 116 тыс.
The lightweights ended Round One with a BANG 💪
00:10
Neat AI does Spatial Hash Boids
8:10
Просмотров 15 тыс.
This Algorithm is 1,606,240% FASTER
13:31
Просмотров 784 тыс.
Collision Detection (An Overview) (UPDATED!)
7:27
Просмотров 35 тыс.
What would 10,000 endermans build over time?
12:14
Просмотров 3,3 млн
Realtime 2D Gravity Simulation
12:31
Просмотров 406 тыс.