I am trying to reconstruct the surface for a fluid simulation based on a list of particles using the Marching Cubes algorithm. From different resources, such as http://paulbourke.net/geometry/polygonise/, or https://cseweb.ucsd.edu/classes/sp16/cse169-a/slides/CSE169_15.pdf
I see that I have to compute an isosurface based on a 3D scalar field. My question is, how can I set density values to the corners of the cubes for each cell of the grid and how should I compute the isosurface constant. Is that constant same for every cell, or unique for each one?