Blog Post

Sand Grain

Sand Grain Fountain

Colorful Sands

SAND SIMULATION IN UNITY

ON DECEMBER 19, 2025 / GAME DEVELOPMENT

Simulating materials like sand or water is a significant challenge in game development. Maintaining smooth performance (such as 60 FPS) on modern hardware while calculating complex physics for thousands of individual particles can be very demanding.

Using a Cellular Automata (grid-based) approach is often an optimal solution. Instead of instantiating thousands of individual GameObjects, this method relies on a two-dimensional array as a grid. Each cell in the grid stores a simple state (e.g., material type), while the overall simulation is rendered efficiently as a single texture or via a Compute Shader.

 

How it works:

In a grid-based simulation the entire grid is mapped to one texture. Each cell is typically a small piece of data (like a byte or an integer) in an array. Those values are baked into the pixels of the one texture to show it on the screen.
While a standard Unity GameObject carries significant overhead —including Transform data and Mesh Renderers— an array of primitive types like integers is extremely lightweight. By shifting to a data-oriented approach, the simulation can process millions of particles rather than being capped at a few thousand.

Sand_Simulation_Comparison_Table
Code Examples

SAND SIMULATION IN UNITY

ON DECEMBER 19, 2025 / GAME DEVELOPMENT

Simulating materials like sand or water is a significant challenge in game development. Maintaining smooth performance (such as 60 FPS) on modern hardware while calculating complex physics for thousands of individual particles can be very demanding.

 

Using a Cellular Automata (grid-based) approach is often an optimal solution. Instead of instantiating thousands of individual GameObjects, this method relies on a two-dimensional array as a grid. Each cell in the grid stores a simple state (e.g., material type), while the overall simulation is rendered efficiently as a single texture or via a Compute Shader.

 

How it works:

In a grid-based simulation the entire grid is mapped to one texture. Each cell is typically a small piece of data (like a byte or an integer) in an array. Those values are baked into the pixels of the one texture to show it on the screen.
While a standard Unity GameObject carries significant overhead —including Transform data and Mesh Renderers— an array of primitive types like integers is extremely lightweight. By shifting to a data-oriented approach, the simulation can process millions of particles rather than being capped at a few thousand.

Sand_Simulation_Comparison_Table

Sand Grain

Sand Grain Fountain

Colorful Sands

Code Examples