# Why aren't both sides of a surface equally opaque?

Discussion in 'Mathematica' started by David Park, Sep 6, 2007.

1. ### David ParkGuest

The following illustrates a strange behavior of surfaces with respect to
opacity. The code draws a narrow cylinder with a red line on the inside of
the cylinder and a black line on the outside of the cylinder. The cylinder
is completely opaque. The inside red line does not show through the
cylinder, which is proper behavior. However, the black outside line does
show through the back face for a considerable range, which is certainly
improper behavior.

cylinder =
First[ParametricPlot3D[{5 Cos[\[Theta]1], 5 Sin[\[Theta]1],
z}, {\[Theta]1, 0, 2 \[Pi]}, {z, -1, 1},
PlotStyle -> {FaceForm[Orange, LightGray]},
PlotPoints -> {41, 5},
Mesh -> None]];

outsideline =
First[ParametricPlot3D[{5.1 Cos[\[Theta]1], 5.1 Sin[\[Theta]1],
0.2}, {\[Theta]1, 0, 2 \[Pi]},
PlotStyle -> {Black},
PlotPoints -> 41]];

insideline =
First[ParametricPlot3D[{4.9 Cos[\[Theta]1],
4.9 Sin[\[Theta]1], -0.2}, {\[Theta]1, 0, 2 \[Pi]},
PlotStyle -> {Red},
PlotPoints -> 41]];

Show[Graphics3D[
{cylinder,
outsideline,
insideline}],
Lighting -> "Neutral",
ViewPoint -> {1.718, -2.747, 0.975},
Boxed -> False

David Park, Sep 6, 2007

2. ### Jens-Peer KuskaGuest

Hi,

that is a feature (!) because the Plot3D[] commands per default
show mesh lines. These meshlines are not more the outline of the
polygons. The mesh lines are separate lines. If you put a line
on a polygonal surface the result would be, that the line intersect
the polygonal surface approximation. To avoid that, the lines are
rendered with an offset in viewing direction.
What you see is just that offset, that is too huge for you example.

In principle, there should be an Graphics3D[] option the control the
amount of line offsets.

Regards
Jens

Jens-Peer Kuska, Sep 7, 2007