I would like to build a simple visualization of the distribution of galaxies on a large scale model of the universe. Currently, my galaxies are represented as uniform random black dots in a 3D cube, using the minimal working code below (this is a manipulate box, to see the effect of adding random dots, from 1 to 1000):
r = 1;
box = Graphics3D[{Opacity[0.1], EdgeForm[Gray], Cuboid[{0, 0, 0}, {1, 1, 1}]}];
x0[n_, r_] := x0[n, r] = RandomReal[{0, 1}]
y0[n_, r_] := y0[n, r] = RandomReal[{0, 1}]
z0[n_, r_] := z0[n, r] = RandomReal[{0, 1}]
particles[n_, r_] := Graphics3D[{PointSize -> 0.005,
Point[{x0[n, r], y0[n, r], z0[n, r]}]
}]
graph3D[Np_, r_] := Show[
{box, Table[{particles[n, r]}, {n, 1, Np}]},
PlotRange -> {{0, 1}, {0, 1}, {0, 1}},
ImageSize -> {700, 700},
SphericalRegion -> True,
Method -> {"RotationControl" -> "Globe"}
]
Manipulate[graph3D[Np, r], {{Np, 1, "N"}, 1, 1000, 1}, Row[{Button["Randomiser", {r = RandomReal[]}]}]]
I want to modify the random distribution to add correlation between galaxies, so the dots are creating random clusters and filaments as seen in the popular 3D simulations found on the internet (see for example this one: https://hipacc.ucsc.edu/Bolshoi/index.html).
So how could we modify the three functions x0[n_, r_]
, y0[n_, r_]
, z0[n_, r_]
to introduce some random correlations between the black dots (i.e to create clusters and random structures)?
Please, I'm looking for something very simple, nothing fancy or complicated, that could work with an old version of Mathematica. I don't need something very realistic and I don't want to reproduce the large Newtonian N-body simulations like the Millenium Run! I simply want to produce a 3D visualization that feels qualitatively similar to the cosmic web: