Why aren't both sides of a surface equally

Why aren't both sides of a surface equally

Post by Chris Hil » Sat, 08 Sep 2007 15:28:13

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

Why aren't both sides of a surface equally

Post by David Par » Mon, 10 Sep 2007 19:13:11

any 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

"Chris Hill" < XXXX@XXXXX.COM > wrote in message
news:fbqr1t$7n7$ XXXX@XXXXX.COM ...