Skip to content
0:00 / 0:00

#collisiondetection#boundingvolumehierarchies#sweepandprune

Building Collision Simulations: An Introduction to Computer Graphics

Reducible

338K subscribers • 4 videos on Hallway

YouTube

Beginner. No background in the topic needed.

538K views5 years ago2 recommendations

Graphics and audioComputer scienceAlgorithmsRenderingGame programming

An animated explanation of discrete and continuous collision detection algorithms and spatial partitioning optimization techniques.

Collision detection systems show up in all sorts of video games and simulations. But how do you actually build these systems? Turns out that the key ideas behind these systems show up all over a field of computer science called computer graphics. We start off with the basics of animation and then branch off into ideas in discrete and continuous collision detection. We break them down in the context of some simple simulations of a small number of particles, but scaling up these simulations is another challenge entirely. We present big ideas in broad phase optimization schemes for speeding up collision detection including the sweep and prune algorithm, uniform grids, K-D trees, and bounding volume hierarchies. Introduction Intro to Animation Discrete Collision Detection and Response Implementation Discrete Collision Detection Limitations Continuous Collision Detection Two Particle Simulations Scaling Up Simulations Sweep and Prune Algorithm Uniform Grid Space Partitioning KD Trees Bounding Volume Hierarchies Recap Correction: At , the linear interpolation equations should be x(t) = t * x(1) + (1 - t) * x(0) and y(t) = t * y(1) + (1 - t) * y(0). All subsequent derivations have the x(0) switched with x(1). All y(0) should also be switched with y(1) for the same reason. Post-correction 2: I ran the experiment with the naive solution of checking every pair of particles with an added inefficiency in rendering the animations so the comparison wasn't fair and that's why the number was so high. The actual speed up is still fairly significant, but not THAT significant. Minor correction: p.vel is updated and used in the next line at , p.vel and p.pos should be updated simultaneously This video is supported by a community of Patreons Special Thanks to the following Patreons: Burt Humburg Justin Hiester Michael Nawenstein Richard Wells Zac Landis Support: patreon.com/reducible Twitter: twitter.com/Reducible20 This video wouldn't be possible without the open source library manim created by 3blue1brown: github.com/3b1b/manim Here is link to the repository that contains the code used to generate the animations in this video: github.com/nipunramk/Reducible 2D Collision Response Vector Equation Derivation Walkthrough: vobarian.com/collisions/2dcollisions2.pdf Bounding Volume Hierarchy Traversal Algorithm for Broad Phase: thegeneralsolution.wordpress.com/2011/12/13/broad-phase-coll… The ideas and presentation in this video were inspired by a culmination of resources -- here are some that I found particularly nice for further exploration: toptal.com/game/video-game-physics-part-ii-collision-detecti… Game Physics Engine Development by Ian Millington Ch. 12 github.com/mattleibow/jitterphysics/wiki/Sweep-and-Prune mcihanozer.com

Why it's here

2 people recommend this

What people say. Highly recommended for learning efficient collision detection implementations and spatial data structures.

Moments people linked to

u/MyinStudiosin r/gameenginedevs • Recommends

On “Efficient Collision Detection Implementations?”

Hey! We highly recommend watching this video! It explains various techniques

u/adesmein r/C_Programming • Recommends

On “simple nbody sim”

This is for collision detection, but I think it may be useful or inspirational anyway: link to this video
2View on Reddit

u/Darth_Bonziin r/GraphicsProgramming • Mentions

On “Why does learning graphics programming have to be so hard?”

You should start simpler. Try Raylib graphics library. Make a game with it, get comfortable with 2d and math. I implemented a simple particle collider from the video link to this video You can find more videos on this topic too. Once you are comfortable with 2d then look at what the GPU does. Resources like this would help https://jtsorlinis.github.io/rendering-tutorial/ After that you will be better able to tackle opengl. You don't have to follow these steps exactly, this is just how I learnt things. And as many here have said, graphics programming is hard. You will keep learning new things so don't worry about not knowing it all.