# Weird behaviour of multiple transparent Raster3D objects in one Graphics3D

Consider this code

$data = With[{step = .1, r = 2}, Table[Exp[-Norm[{x, y, z}]^2], {x, -r, r, step}, {y, -r, r, step}, {z, -r, r, step}]]; Graphics3D[{Raster3D[$data, {{0, 0, 0}, {1, 1, 1}},
ColorFunction -> (Opacity[#, Red] &)],
Raster3D[$data, {{1, 1, 1}, {2, 2, 2}}, ColorFunction -> (Opacity[#, Red] &)]}]  The generated figure looks like Obviously the transparency works within one Raster3D object but not between them. 1. Is this an expected behaviour? 2. How could I go around this, assuming I cannot generate everything in one Raster3D object? I want to be able to patch various Raster3D objects according to my liking. ## 1 Answer Changing the rendering engine to BSPTree seems to help for me: SetOptions[$FrontEnd, RenderingOptions -> {"Graphics3DRenderingEngine" -> "BSPTree"}]


Not sure if this is the best solution, but do try it out.

• works perfectly, thanks – jhrmnn Jul 17 '15 at 21:59
• I think this is because with the "^2" the values on the edge of the bounding box are still not zero, especially in the cube face centers. Try it with e.g. Exp[-Norm[{x, y, z}]^3.0] (which makes the spheres not touch the boundary). – Arnoud Buzing Jul 17 '15 at 22:03
• I've realized that before and deleted my comment, probably while you were writing the reply, sorry about that – jhrmnn Jul 17 '15 at 22:09
• @ArnoudBuzing Could you comment about this option? When should/could be tried? – Dr. belisarius Jul 17 '15 at 23:26
• Note that Style[graphics, RenderingOptions -> {"Graphics3DRenderingEngine" -> "BSPTree"}] also works without making a persistent change to the $FrontEnd. (I assume SetOptions[$FrontEndSession, RenderingOptions -> {"Graphics3DRenderingEngine" -> "BSPTree"}] would work, too.) – Michael E2 Jul 18 '15 at 2:41