as described im my blog post:


I tried to export a Klein bottle ParametricPlot3D to one commonly used 3D mesh formats (3DS, OBJ, PLY, x3D) to do some post processing in Blender. My code looks as follows:

thePlot = ParametricPlot3D[
{-200000/15 Cos[u] (6 Cos[v] - 30 Sin[u] + 90 (Cos[u])^4 Sin[u] - 
60 (Cos[u])^6 Sin[u] + 5 Cos[u] Cos[v] Sin[u]),
-100000/15 Sin[u] (6 Cos[v] - 3 (Cos[u])^2 Cos[v] - 48 (Cos[u])^4 Cos[v] +
48 (Cos[u])^6 Cos[v] - 60 Sin[u] - 5 Cos[u] Cos[v] Sin[u] - 10 (Cos[u])^3 Cos[v] Sin[u] -
80 (Cos[u])^5 Cos[v] Sin[u] + 150 (Cos[u])^7 Cos[v] Sin[u]), 
300000/15 (3 + 5 Cos[u] Sin[u]) Sin[v]},
{u, -Pi, Pi}, {v, 0, 2 Pi}, Axes -> None, Boxed -> False,
PlotPoints -> 30, Mesh -> None ]

Export["KleinBottle.<3D mesh format>", thePlot]

However, whatever I did, the exported mesh data did not produce any "nice", smooth meshes, but always meshes with distorted, jagged surfaces. As it seems, Mathematica exports the data in a way like setting NormalsFunction->None in ParametricPlot3D which yields the same "ugly" output.

Here a comparison:

NormalsFunction->True (Default in ParametricPlot3D)


The only workaround I found was exporting the plot to dxf and to do some post processing (see my blog). But there is no direct way into Blender. Is there any way to export "smooth" meshes in a mesh format (3DS, OBJ, PLY, x3D)?

Any help appreciated.

  • $\begingroup$ Does this work: Export["KleinBottle.obj", thePlot, "VertexNormals" -> Automatic]? $\endgroup$ – kglr Apr 8 '15 at 23:24
  • $\begingroup$ ... or Export["KleinBottle.ply", thePlot, "VertexNormals" -> Automatic]? $\endgroup$ – kglr Apr 8 '15 at 23:30
  • $\begingroup$ Hi kguler, thanks for your comment, but unfortunately it does not help $\endgroup$ – WolfiG Apr 10 '15 at 14:00

Whereas the problem above is not solved I finally found a proper formulation of the Klein bottle immersion in 3 dimensions:

r = 4 (1 - cos(u)/2)
x = Piecewise[({
    {r cos(u) cos(v) + 6 (sin(u) + 1) cos(u), 0 <= u < \[Pi]},
    {r cos(v + \[Pi]) + 6 (sin(u) + 1) cos(u), \[Pi] <= u <= 2 \[Pi]}
y = Piecewise[({
    {r sin(u) cos(v) + 16 sin(u), 0 < u < \[Pi]},
    {16 sin(u), \[Pi] <= u <= 2 \[Pi]}
z = r sin (v)
thePlot = 
 ParametricPlot3D[{x, y, z}, {u, 0, 2 \[Pi]}, {v, 0, 2 \[Pi]}, 
  Axes -> None, Boxed -> False, PlotPoints -> 50, MaxRecursion -> 10, 
  Mesh -> None, NormalsFunction -> None]
Export["KleinBottle1.ply", thePlot, "VertexNormals" -> Automatic]

The results of my efforts can be viewed in a new blog post of mine: http://wolfig-techblog.blogspot.de/2015/04/math-gems-klein-bottle.html

| improve this answer | |

See How to Render, raytrace, Export Graphics3D in Mathematica 11.0

NO - you can export the full monte to (GL) format or Renderer format and other 3D formats: and some Exports come with Normals.

ie, the following exports to rayshade or povray and uses the normals for smooth triangle shading automatically ...

As for if Export to 3DStudio works as well or better I cannot say (in past Mathematica no not at all - but today's mm11.0 i'm totally unsure)

the below is a low resolution rendering, at higher resolution (and with things like Specularity added) the looks can be improved much further using

https://sourceforge.net/projects/rayshade-math/ enter image description here

for fun, heres a render with older 3DGraphics and different scene setup

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.