30

15

Consider the following code:

```
Show[{Graphics3D[{Opacity[0.2], Sphere[], Opacity[1.0], Blue,
Polygon[{{-.2, -.3, -.3}, {-.2, .3, -.3}, {-.2, .3, .3}, {-.2, \
-.3, .3}}]}],
ParametricPlot3D[{Sin[th] Cos[ph], Sin[th] Sin[ph], Cos[th]}, {th,
0, Pi}, {ph, 0, 2 Pi},
RegionFunction -> Function[{x, y, z}, Abs[x] < .9],
PlotRange -> {-1, 1}, PlotStyle -> Red, Mesh -> None]}]
```

(Doctored somewhat from another question on this site.) It produces a sphere, with an opaque red surface, except for two "portholes", which allow one to see the blue rectangle inside.

Now consider the following minor tweak, replacing the square by some text:

```
Show[{Graphics3D[{Opacity[0.2], Sphere[], Opacity[1.0], Blue,
Text["Surprise!", {0, 0, 0}]}],
ParametricPlot3D[{Sin[th] Cos[ph], Sin[th] Sin[ph], Cos[th]}, {th,
0, Pi}, {ph, 0, 2 Pi},
RegionFunction -> Function[{x, y, z}, Abs[x] < .9],
PlotRange -> {-1, 1}, PlotStyle -> Red, Mesh -> None]}]
```

The output (which I don't know how to save as a rotating GIF [side question?]) shows the blue text *over* the red sphere, whether or not I am "looking" through the porthole or not.

The reason for this is in the help:

Text is drawn in front of all other objects.

Is there way to treat Text like other Graphics primitives, so that indeed it will be a "Surprise!" when you look through the porthole? That is, to get behavior similar to that of the blue rectangle?

Perhaps I should clarify I am most interested in being able to change the "z order" of the Text. But the fact that it doesn't rotate with the rest of the Graphics objects (using the mouse) is also kind of annoying.

Thanks!

2

This was in fact the reason for me to ask this question.

– Sjoerd C. de Vries – 2012-04-27T20:37:49.533