MathGroup Archive 2011

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

Search the Archive

Re: Defective Mesh lines in ContourPlot3D

  • To: mathgroup at
  • Subject: [mg121126] Re: Defective Mesh lines in ContourPlot3D
  • From: John Fultz <jfultz at>
  • Date: Mon, 29 Aug 2011 20:01:21 -0400 (EDT)
  • Delivered-to:
  • Reply-to: jfultz at

Version 8 has three rendering methods, controlled by the 
RenderingOptions->{"Graphics3DRenderingEngine"} option:

Advantage - very fast
Disadvantage - absolutely unusable with transparency

Advantage - renders everything
Disadvantage - divvies up the polygons into a bazillion sub-polygons, which are 
reordered during rotation.  Most of this happens in the CPU, not the GPU. By
far, the slowest rendering method.

Advantage - renders most transparency fine, uses GPU hardware.
Disadvantage - some older video cards don't support it, a few (but rare) 
outlying transparent cases don't work well.

V7 only had the first two options.  What you're seeing is a complication 
stemming from the facts that:

* There's a great deal of polygonal subdividision
* The mesh is also highly subdivided
* The mesh and the polygons are nearly (or sometimes exactly) coplanar polygons

In v7, there are two ways out of this.  One is to prevent the BSPTree method
from being used by removing the transparency from the graphic.  The second is to 
prevent the coplanarity by changing how the mesh is rendered.  There's an 
undocumented usage of the MeshStyle option which would do this:

MeshStyle -> {{GrayLevel[.7], Tube[0.01]}} 

In v8, the DepthPeeling method does a vastly better job with the transparent
version of the graphic.  And, if your hardware supports it, DepthPeeling is what 
Mathematica will use by default.


John Fultz
jfultz at
User Interface Group
Wolfram Research, Inc.

On Mon, 29 Aug 2011 03:46:57 -0400 (EDT), Alexey Popkov wrote:
> Hello,
> I have a problem with rendering of Mesh lines on a 3D surface produced by
> ContourPlot3D in Mathematica 7.0.1:
> p=ContourPlot3D[x^4+y^4+z^4-(x^2+y^2+z^2)^2+3(x^2+y^2+z^2)==3,
> {x, -2,2}, {y, -2, 2}, {z,-2,2},
> BoundaryStyle->Directive[Black,Thickness[.003]],
> ContourStyle->Directive[Orange,Opacity[0.5],Specularity[White,300]],
> PlotPoints->90,Ticks->None,
> MeshStyle->Directive[GrayLevel[.7],Thickness[.001]],
> Lighting->{{"Directional",RGBColor[1,1,1],
> {ImageScaled@{1,0,1},ImageScaled@{0,0,0}}}}];
> p=Graphics[Inset[p,{0,0},Center,{1,1}],
> PlotRange->{{-.5,.5},{-.5,.5}},Frame->True]
> (see screenshot here: )
> Let us to look closer on Mesh lines:
> Show[p, PlotRange -> {{-.16, -.05}, {0, .1}}]
> (see screenshot here: )
> You can see that gray Mesh lines are overlapped by surface-forming
> triangles in many places and even look dashed. Is there a way to avoid
> this?

  • Prev by Date: Importing FITS files into Mathematica
  • Next by Date: add arrow to ContourPlot3D
  • Previous by thread: Defective Mesh lines in ContourPlot3D
  • Next by thread: Re: Defective Mesh lines in ContourPlot3D