I believe I have discovered a bug in WolframScript but it's a priori more probable that I'm doing something wrong so I'd be grateful if someone either confirmed the problem, tells me what I'm doing wrong, or tell me a way around it. I am using WolframScript, version 1.10.0 on a laptop.
I was writing code to display an evolving lattice of spheres and did this by collecting all the spheres and manipulating their opacity as time increased but there were anomalies in the result. The code below is a minimal example. Basically, it comprises
- a fully visible sphere,
- an invisible one that partially occludes the first,
- two invisible spheres which are closer to the observer and so appear bigger than the others and they each totally eclipse both of the first two.
- a fifth invisible sphere that partially eclipses the first two
With only two eclipsing invisible spheres everything appears as I would expect (foo.png) but when I add a third then the overlap becomes invisible (bar.png), as if the fifth sphere renders the opacity of the combination as zero and the background is visible. This isn't the full story though, and I gave up trying to diagnose what was going on, because if I increase the size of the fifth sphere then the combination (baz.png) is downright weird.
sph = {
Blue,
Sphere[{51, 1, 1}, Sqrt[2]],
Red,
Opacity[0.],
Sphere[{51 + 2*(1 + Sqrt[2/3]), 1 + 2*(1 + Sqrt[2/3]), -1 + 2*(1 + Sqrt[2/3])}, Sqrt[2]],
Orange,
Opacity[0.0],
Sphere[{49 + 4*(1 + Sqrt[2/3]), -1 + 4*(1 + Sqrt[2/3]), 1 + 2*(-1 - Sqrt[2/3]) + 2*(1 + Sqrt[2/3])}, 4],
Sphere[{51 + 4*(1 + Sqrt[2/3]), 1 + 4*(1 + Sqrt[2/3]), 1 + 2*(-1 - Sqrt[2/3]) + 2*(1 + Sqrt[2/3])}, 4]
}
sph5 = Sphere[{49 + 2*(1 + Sqrt[2/3]), -1 + 2*(1 + Sqrt[2/3]), -1 + 2*(1 + Sqrt[2/3])},Sqrt[2]];
sph6 = Sphere[{49 + 2*(1 + Sqrt[2/3]), -1 + 2*(1 + Sqrt[2/3]), -1 + 2*(1 + Sqrt[2/3])},2];
ShowSpheres[sph_,filename_] := Module[{},
t = 0.705;
gr = Graphics3D[ sph,
ViewPoint->{1Cos[t],1Sin[t],0},
ViewVertical->{0,0,1},
ViewAngle -> Pi/4,
Boxed -> False,
Background -> LightBlue
];
Export[filename,gr]]
ShowSpheres[sph, "/tmp/foo.png"]
ShowSpheres[Join[sph,{Opacity[0.],Green,sph5}], "/tmp/bar.png"]
ShowSpheres[Join[sph,{Opacity[0.],Green,sph6}], "/tmp/baz.png"]
Edit: This is not the same question as asked here although it has the same answer. The question at reference asked why objects were occluded when they shouldn't. This question was about the opposite, objects were made invisible but shouldn't be and the background shone through.


