I am coding a 3d fluid simulation. I want to render each cell of the simulation grid with a cube, so I have a grid of cubes. Each cube has its own color, and the colors are stored in a compute buffer. The colors are changing in runtime, i.e. the compute buffer data is being modified with a compute shader in real time. So what I want to do is reflect that change on the cubes, so that they change their colors, achieving the simulation rendering. How can I do that without losing performance?

  • \$\begingroup\$ I'd be tempted to render the volume by raymarching into the grid of cubes, then looking up the colour at the cell where the ray terminates. Then there's no geometry or game object per cube, and it renders in one pass with no overdraw, though you'll need a good raymarching algorithm to traverse the grid efficiently, especially if it's large and sparsely populated. \$\endgroup\$
    – DMGregory
    Commented Jun 19 at 20:05


You must log in to answer this question.

Browse other questions tagged .