MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Why aren't both sides of a surface equally

  • To: mathgroup at
  • Subject: [mg81040] Re: Why aren't both sides of a surface equally
  • From: "David Park" <djmpark at>
  • Date: Sun, 9 Sep 2007 06:10:42 -0400 (EDT)
  • References: <> <fbqr1t$7n7$>

Many thanks Chris for the explanation and solution.

That indeed did solve the problem. In my actual case I was writing Text3D 
characters on the inside and outside of the cylinder and then rotating it 
and I wanted the characters to be quite close to the surface.

David Park
djmpark at

"Chris Hill" <chill at> wrote in message 
news:fbqr1t$7n7$1 at
> At 04:38 AM 9/6/2007, David Park wrote:
>>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]];
>>   {cylinder,
>>    outsideline,
>>    insideline}],
>>  Lighting -> "Neutral",
>>  ViewPoint -> {1.718, -2.747, 0.975},
>>  Boxed -> False
> As part of the default hidden surface removal algorithm, Mathematica
> pushes lines towards the viewer to achieve the correct
> sorting.  Given a polygon and a line which are coplanar and
> overlapping this makes the line draw consistently in front of the
> polygon as is expected.  In some cases such the one you've
> discovered, this can also incorrectly make lines that are behind
> polygons appear to be in front.
> The problem is not related to the sides of the surface.  The black
> line happens to poke though the cylinder when it passes behind the
> cylinder at the part of the cylinder that is most distant from the
> view point (the red line passes behind the cylinder closer to the
> view point).  Inaccuracies of this nature are more likely to be
> observed at a greater distance from the view point all other things
> being equal.
> One way to avoid the problem you have encountered is to introduce
> transparency which causes Mathematica to automatically use a
> different hidden surface removal algorithm that is slower and
> consumes more memory but that better handles cases like this.  Here I
> use Opacity[0.999] which is enough transparency to trigger a change
> in the hidden surface algorithm, but not so much as to make objects
> in the scene appear transparent.
> Show[Graphics3D[{Opacity[0.999], cylinder, outsideline, insideline}],
>  Lighting -> "Neutral", ViewPoint -> {1.718, -2.747, 0.975}, Boxed -> 
> False]
> Chris Hill
> Wolfram Research

  • Prev by Date: How to make a Button inside Manipulate?
  • Next by Date: Re: Slow Show/Graphics in v6.0
  • Previous by thread: Re: Why aren't both sides of a surface equally
  • Next by thread: Re: Why aren't both sides of a surface equally opaque?