# How to make overlapped part to be transparent?

I want to ask is it possible to make the overlapped part to be transparent in Graphics3D.

Graphics3D[{Brown, {Cuboid[{0, 0, 0}, {0.8, 0.1, 2}], Opacity[0],
White, Cuboid[{0.1, -0.001, 1.35}, {0.7, 0.101, 1.85}]}}]

• Graphics3D[{Brown, {Cuboid[{0, 0, 0}, {0.8, 0.1, 2}], White, {Cuboid[{0.1, -0.001, 1.35}, {0.7, 0.101, 1.85}], Opacity[0]}}}, Lighting -> {{"Ambient", White}}] Dec 7, 2014 at 19:46

You can also use RegionPlot3D:

cuboid1 = {{0, 0, 0}, {0.8, 0.1, 2}};
cuboid2 = {{0.1, -0.001, 1.35}, {0.7, 0.101, 1.85}};
{cuboid1b, cuboid2b} = Insert[#, {x, y, z}, 2] & /@ {cuboid1, cuboid2};
{region, hole} = (And @@ Less @@@ Transpose@#) & /@ {cuboid1b, cuboid2b};

RegionPlot3D[region && Not[hole],{x, 0, 2}, {y, 0, 2}, {z, 0, 2},
PlotPoints -> 200, MaxRecursion -> 6, PlotStyle -> Brown, Mesh -> None,
Lighting -> "Neutral", Boxed -> False, Axes -> False]


One way to make transparent regions is to use RegionFunctions. For example, here are your two cubes and then the "symmetric difference" between them. This essentially removes the smaller one from the larger, and leaves a transparent window.

r1 = Cuboid[{0, 0, 0}, {0.8, 0.1, 2}];
r2 = Cuboid[{0.1, -0.001, 1.35}, {0.7, 0.101, 1.85}];
d = RegionSymmetricDifference[r1, r2]
Show[BoundaryDiscretizeRegion[d]]


• It seems Mathematica 9 doesn't have funtions RegionSymmetricDifference[] and BoundaryDiscretizeRegion[]. Dec 7, 2014 at 20:06
• That's true -- I just learned about these functions from here: wolfram.com/broadcast/video.php?c=376&v=1230 Dec 7, 2014 at 20:08
• If don't use the two functions, having other ways can do this? Dec 7, 2014 at 20:54