I am trying to visualize a percolation model that is equivalent to a swiss-cheese where the holes are conducting. At some point, the size of the holes gets large enough for them to touch and a percolating network of holes pervades the sample volume. I would like to visualize the percolated network of holes in a transparent body. I can´t seem to make it work so that i have a nicely rendered inner surface that can be seen through the semitransparent body.
I started with this, using a brute force approach to get a volume filled with non-touching spheres (taken from a different thread: Randomly packing spheres of fixed radius within a cube) and then increasing their size:
spheres = {};
cubesize = 1;(*size of the sample volume*)
diameter = 0.15;(*diameter of the small spheres*)
multi = 1.4;(*multiply small diameter with this to get large diameter*)
number = 10; (*number of spheres within the cube*)
spheredistance = 2.; (*distance of the spheres in multiples of the small diameter*)
Dynamic[Length[spheres]]
While[Length[spheres] < number,
s = RandomReal[{diameter, cubesize - diameter}, 3];
If[And @@ (Norm[# - s] > diameter*spheredistance & /@ spheres),
AppendTo[spheres, s]]];
{Graphics3D[{Opacity[0.4], Specularity[0.4],
smallPockets = Ball[#, diameter] & /@ spheres},
PlotRange -> {{cubesize*.05, cubesize*.95}, {cubesize*.05,
cubesize*.95}, {cubesize*.05, cubesize*.95}}, Boxed -> True,
BoxStyle -> Directive[Black, Thin, Dashed]],
Graphics3D[{Opacity[0.7], Specularity[0.1],
largePockets = Ball[#, diameter*multi] & /@ spheres},
PlotRange -> {{cubesize*.02, cubesize*.98}, {cubesize*.02,
cubesize*.98}, {cubesize*.02, cubesize*.98}}, Boxed -> True,
BoxStyle -> Directive[Black, Thin, Dashed]]}
My attempt to produce the inverse and make it transparent was the following:
largePocketsRegion = largePockets // Region /@ # &;
cube = Cuboid[{0, 0, 0}, {cubesize, cubesize, cubesize}] // Region;
cheese = Fold[RegionDifference, cube, largePocketsRegion ]
giving something like this:
Now I am unable to make this render nicely and transparent. Is there a way to do that?