Seems like I’m done with a proof-of-concept implementation of an OpenCL+OpenGL particle collision tester 🙂
For the curious, white line segments represent direction in which a collision would have been considered for the frame (but not necessarily affecting the particle movement). Blue lines represents velocity vectors (unnormalized)
One of the things which are very peculiar about graphics development is how tricky it is to hunt bugs down. You often have to resort to visual tracing in order to actually be able to experience the “ah-hah!” Archimedes moment.
I have spent a great deal of my free time recently to track down the problem that was causing my particles to fall behind geometry. Were it not the visual hints, I would probably have not been able to tell for the next month that it was AABB/ray intersection test implementation in my OpenCL code that was returning negative values for cases which should be reporting collisions.
Oh well. Let’s move on.
(gray-to-white line segments indicate detected collisions, blue ones represent velocity vectors <not normalized>)
Experimenting a little bit with particle emitters..
The particles you can see above bounce over an infinite plane and a sphere that is in the origin of the scene. This is simple Transform Feedback at work – it costs literally nothing (as the numbers tell) and the renderer is capped at 60 FPS.
For the next stop, I’m planning to have the particles bounce over a mesh represented with a Kd tree.