Ball physics



I got interested in ball physics and I wanted to try and see just how many balls with collisions I could manage to draw on the screen. I could get the amount up to 500.000 on my PC. The amount was possible due to dividing the available space into areas, creating a grid. All items in a gridarea will be checked against each other to see if they have collision. This is done asynchronous to speed it up even more. Every ball can be placed in multiple areas if they are on the edge of an area.

All balls are drawn using GPU Instancing. This draws all balls in the same material pass. The position, color, and size (not demonstrated) of the balls are set in the material using buffers.