• Atomize • GPGPU elastic-viscuous particles simulation


• Atomize •

I’ve been working on and off on this project for quite a while now. Slowly adjusting and implementing more and more features. I think this is finally at a stage where I consider it fit for display, so I thought I would share this here. :eyes:


I won’t go into much detail about how it all works, but if you are interested in learning about GPGPU techniques, I highly recommend this blog post by Nicolas Barradeau.

You can also check the complete code on the github repo.

Would greatly appreciate some feedback about the project, I’ve tried my best to make it as compatible and mobile friendly as possible. Enjoy :smile:


Loving the shadows! :star_struck:
Are you calculating depth of field, or is it just a soft particle texture that gives that illusion?


@marquizzo I’m definitely calculating depth of field, in my opinion it adds a lot to the scene.

Due to the nature of dof effect and particles being small circles, we don’t need to make use of complex post-processing rendering to achieve a good depth of field on them.

In regular dof, frag pixels become larger circular spots, which need to be calculated at every frame. How big is that spot and how bright or faint depends on the distance to focal plane of the camera.This is not a linear function though, nor is it mirrored before/after focal point. Objects before the focal place (closer to the camera) have a faster exponential growth rate, compared to the ones after the focal plane.

In the case of dof on circular particles, I already have control over the size of each particle. So, I just calculate the enlargement ratio and transparency falloff based on z-distance to the focal plane.

Using transparency on particles can add a few problems when rendering, because we can’t sort their rendering order, since that is locked by the order you define the vertices on geometry instantiation. I handled this by dividing the particle field intro discrete blocks and sorting these blocks accordingly.
1 Like

Really cool! It evens runs (with a cool slow-mo effect) on my mobile!

Gonna investigate your code sometime soon :slight_smile:

1 Like

Really cool! It evens runs (with a cool slow-mo effect) on my mobile!

Thank you, totally intentional mobile slow-mo effect :rofl:

Gonna investigate your code sometime soon :slight_smile:

Would love to hear your thoughts about it !

1 Like

very very cool!:grinning:

1 Like