Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #4654 > unrolled thread

Re: Defective Mesh lines in ContourPlot3D

Started byJohn Fultz <jfultz@wolfram.com>
First post2011-08-30 00:02 +0000
Last post2011-09-01 10:06 +0000
Articles 5 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Re: Defective Mesh lines in ContourPlot3D John Fultz <jfultz@wolfram.com> - 2011-08-30 00:02 +0000
    Re: Defective Mesh lines in ContourPlot3D Roger Bagula <roger.bagula@gmail.com> - 2011-08-31 10:06 +0000
    Re: Defective Mesh lines in ContourPlot3D Roger Bagula <roger.bagula@gmail.com> - 2011-08-31 10:06 +0000
    Re: Defective Mesh lines in ContourPlot3D Roger Bagula <roger.bagula@gmail.com> - 2011-08-31 10:07 +0000
      Re: Defective Mesh lines in ContourPlot3D Roger Bagula <roger.bagula@gmail.com> - 2011-09-01 10:06 +0000

#4654 — Re: Defective Mesh lines in ContourPlot3D

FromJohn Fultz <jfultz@wolfram.com>
Date2011-08-30 00:02 +0000
SubjectRe: Defective Mesh lines in ContourPlot3D
Message-ID<j3h9b7$ni4$1@smc.vnet.net>
Version 8 has three rendering methods, controlled by the 
RenderingOptions->{"Graphics3DRenderingEngine"} option:

DepthBuffer
Advantage - very fast
Disadvantage - absolutely unusable with transparency

BSPTree
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.

DepthPeeling
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.

Sincerely,

John Fultz
jfultz@wolfram.com
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: http://i.stack.imgur.com/zBtYC.png )
>
> Let us to look closer on Mesh lines:
>
> Show[p, PlotRange -> {{-.16, -.05}, {0, .1}}]
>
> (see screenshot here: http://i.stack.imgur.com/JBkcc.png )
>
> 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?


[toc] | [next] | [standalone]


#4663

FromRoger Bagula <roger.bagula@gmail.com>
Date2011-08-31 10:06 +0000
Message-ID<j3l12k$bse$1@smc.vnet.net>
In reply to#4654
John Flutz,
I tried two experiments with the mesh-tubes
and only one worked:
Clear[x, y, a, g, p, k]
x[t_, p_] := (1 - p)*Cos[t]
y[t_, p_] := (1 + p)*Sin[t]
p = (k + 1)/10
ga = ParametricPlot3D[{x[Pi*t, p], y[Pi*t, p], p}, {t, -1, 1}, {p, -1,
    1}, Axes -> False, Boxed -> False, PlotPoints -> 60,
  MeshStyle -> {{GrayLevel[.7], Tube[0.1]}}]
Export["RuledTetrahedron_tubelines.stl", ga]

The Mesh tubes show up in the stl model.
Roger Bagula

[toc] | [prev] | [next] | [standalone]


#4664

FromRoger Bagula <roger.bagula@gmail.com>
Date2011-08-31 10:06 +0000
Message-ID<j3l13j$bt6$1@smc.vnet.net>
In reply to#4654
John Fultz
That mesh-tubes effect is nice:
I wonder if it shows up in 3d models?
Is there any way to get Mathematica
to send surface colors to a 3d model
that will be seen by other modeling software?
Roger Bagula

[toc] | [prev] | [next] | [standalone]


#4665

FromRoger Bagula <roger.bagula@gmail.com>
Date2011-08-31 10:07 +0000
Message-ID<j3l14h$bth$1@smc.vnet.net>
In reply to#4654
John Furth,
The Mesh Tubes use a lot of memory
( as seen in the model being much larger as output),
so that the real time effect
doesn't work as well in 8.
The last/ first tube mesh line doesn't print:
Clear[g1, g2, x1, x2x3, x, y, z, t, p]
x1 = Cos[t]; x2 = Cos[t + 2*Pi/3]; x3 = Cos[t - 2*Pi/3];
z = x1*p;
x = x2*(-1 + p);
y = x3*(1 - p);
g1 = ParametricPlot3D[{x, y, z}, {t, 0, 2*Pi}, {p, 0, 1},
  Axes -> False, Boxed -> False, PlotPoints -> 60,
  MeshStyle -> {{GrayLevel[.9], Tube[0.025]}}]
g2 = ParametricPlot3D[{x, y, -z}, {t, 0, 2*Pi}, {p, 0, 1},
  Axes -> False, Boxed -> False, PlotPoints -> 60,
  MeshStyle -> {{GrayLevel[.9], Tube[0.025]}}]
Show[{g1, g2}]
Export["Ruledellipsedouble_tubelines.stl", %]

For getting color out the web suggests the *.coff
file format: Mathematica gives
Export::infer: "Cannot infer format of file \!\
(\"Ruledellipsedouble_tubelines.coff\"\)."
but will do an *.off file.
Roger Bagula

[toc] | [prev] | [next] | [standalone]


#4688

FromRoger Bagula <roger.bagula@gmail.com>
Date2011-09-01 10:06 +0000
Message-ID<j3nleo$p1j$1@smc.vnet.net>
In reply to#4665
Getting the color out...
*.mtl files are generated when you make a Mathematica *.obj export.
They are said to contain the color information.
*.3ds will transfer color and are made with Mathematica as well.

There is still the problem of what the printers call:
Non-Manifold
model outputs in Mathematica.
It appears that Mathematica models leave holes
that 3d Printers can't stand. They all have to be repaired
and mesh holes closed.
They all deal with me like I'm the village idiot
for having such bad mesh files, LOL.
Roger Bagula

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web