This sample demonstrates how to use compute shaders to generate and render particle-based implicit surfaces.


APIs Used

  • OpenGL ES 3.1

Shared User Interface

The Graphics samples all share a common app framework and certain user interface elements, centered around the "Tweakbar" panel on the left side of the screen which lets you interactively control certain variables in each sample.

To show and hide the Tweakbar, simply click or touch the triangular button positioned in the top-left of the view.

Technical Details


The Mercury sample has an implementation of 3D metaballs using the Marching Cubes algorithm with a physics driven particle system that drives the metaballs. The data-set is manipulated using a compute shader and another compute shader is used to calculate isovalues used by the Marching Cubes algorithm.

Particle Field

The particles themselves are updated using a fluid simulation compute shader.

The 3D sampled potential field is generated from the particles via a compute shader (iterating/summing over all particles per sample), stored in a shader storage buffer

Triangle Generator

The generation of triangles for the algorithm is done in a geometry shader that uses a triangle topology table.


The sample also uses a deferred shading making use of a gbuffer with multiple attachments for albedo, normals, world space coordinates, etc. Currently the deferred path is not making full use of these attachments for post effects but these will be added in a future release.