Message Boards Message Boards

1
|
8224 Views
|
3 Replies
|
6 Total Likes
View groups...
Share
Share this post:

Howto prevent Mesh-Lines from bleeding through in Plot3D-plots?

Posted 11 years ago
Hi everyone,

i am trying to create a nice plot of a function in 3d, that consists of three parts: a top part (z>=0), a bottom part (z<0, scaled) and a zero-level plane z=0. However, when using the following code the parametric mesh lines of the lover plot bleed through the plane at z=0 although i explicitly define the PlotRegion only to draw true negative parts:
A = -100 + (5 dt)/(
  11 alpha^2 (alpha - Surd[alpha^3 - (1387 dt)/106480, 3]))
Show[Plot3D[A, {alpha, 0.5, 2}, {dt, 0, 10}, RegionFunction -> Function[{alpha, dt, z}, A >= 0], MaxRecursion -> 3, PlotPoints -> 100],
Plot3D[(A/10), {alpha, 0.5, 2}, {dt, 0, 10}, RegionFunction -> Function[{alpha, dt, z}, A < 0], MaxRecursion -> 3, PlotPoints -> 100],
Plot3D[0, {alpha, 0.5, 2}, {dt, 0, 10}, Mesh -> None, PlotStyle -> {Opacity[0.8]}],
{PlotRange -> {Automatic, Automatic, {-6, 5}}}]

I have read in the docs that mathematica uses depth buffering when everything drawn is opaque and BSP-Trees if transparency is involved. However, despite using transparency the amount of bleeding seems to be view dependent, which should only be the case when using depthbuffer... (also, as you can see only mesh lines behave incorrectly; filled faces are ok). Not using transparency gives the same result.

Any ideas how to prevent this Mesh-bleeding whilest not deactivating the mesh?

Thanks,
Thomas
POSTED BY: Thomas W
3 Replies
Posted 11 years ago
You can force  BSP-Trees rendering by using Style[..., RenderingOptions -> {"Graphics3DRenderingEngine" -> "BSPTree"}]
 A = -100 + (5 dt)/(11 alpha^2 (alpha - Surd[alpha^3 - (1387 dt)/106480, 3]));
 Style[Show[Plot3D[A, {alpha, 0.5, 2}, {dt, 0, 10},
    RegionFunction -> Function[{alpha, dt, z}, A >= 0],
    MaxRecursion -> 3, PlotPoints -> 100],
   Plot3D[(A/10), {alpha, 0.5, 2}, {dt, 0, 10},
    RegionFunction -> Function[{alpha, dt, z}, A < 0],
    MaxRecursion -> 3, PlotPoints -> 100],
   Plot3D[0, {alpha, 0.5, 2}, {dt, 0, 10}, Mesh -> None,
    PlotStyle -> {Opacity[.8]}], {PlotRange -> {Automatic,
     Automatic, {-6, 5}}}],
RenderingOptions -> {"Graphics3DRenderingEngine" -> "BSPTree"}]

POSTED BY: Yuzhu Lu
This rendering problem is an artifact of the hidden-surface removal algorithm.
When polygons are close to co-planar, they are hard to separate.

In most cases, giving Opacity less than 1.0 works around it adequately.
(Here it does not.)

A cut-down example that shows the specific issue more clearly is,
 In[1]:= $Version
 Out[1]= "9.0 for Mac OS X x86 (64-bit) (January 24, 2013)"
 
 In[2]:= A = -100 + (5 dt)/(11 alpha^2 (alpha - Surd[alpha^3 - (1387 dt)/106480, 3]));
 
 In[3]:= p2 = Plot3D[(A/10), {alpha, 0.5, 2}, {dt, 0, 10},
         RegionFunction -> Function[{alpha, dt, z}, A < 0],
         MaxRecursion -> 3, PlotPoints -> 100]
 
In[4]:= p3 = Plot3D[0, {alpha, 0.5, 2}, {dt, 0, 10}, Mesh -> None ,  PlotStyle -> {Orange} ];

In[5]:= Show[ p2, p3, PlotRange -> {Automatic, Automatic, {-6, 5}}, ViewPoint -> {-0.2, 2.6, 2.0}]
POSTED BY: Bruce Miller
Anonymous User
Anonymous User
Posted 11 years ago
Experts answer you below.
POSTED BY: Anonymous User
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract