0
$\begingroup$

I would like to export this parametrization from ParametricPlot3D in a 3D format such as .obj or .stl. All the exports I have made show an ugly mesh. Is there a way to export the mesh as you see it on Mathematica?

param[a_, g_][u_, v_] := 
  {50*(a + Cos[u/2]*g*Sin[v] - Sin[u/2]*Sin[2 v]) Cos[u],
   50*(a + Cos[u/2]*g*Sin[v]- Sin[u/2]*Sin[2 v]) Sin[u],
   50*(Sin[u/2]*g*Sin[v] + Cos[u/2]*Sin[2 v])}

ParametricPlot3D[param[2, 1][u, v] // Evaluate, {u, 0, 2 Pi}, {v, 0, 2*Pi},
  PlotPoints -> {50, 50}, Axes -> None, Boxed -> False]

visualization of great mesh applied

bad mesh

$\endgroup$
2
$\begingroup$

The "ugly" mesh is indeed what makes up the surface - even in Mathematica. The lines that you see in the Mathematica plot are extra Lines that are controlled with the Mesh option. These get also exported to obj. In order to render the surface appropriately, you have to tell the renderer to use the .mtl file that is exported along with the .obj file. It's the .mtl file that has to tell the renderer not to render the "ugly mesh".

$\endgroup$
2
  • $\begingroup$ Thank you so much for your answer. However I am not sure I understand the .mtl. Do you have a line of code to export .mtl ? The only files I can have do not include .mtl. Thank you for your great support. Marc $\endgroup$ – M. Joe Oct 20 '17 at 6:43
  • $\begingroup$ Mathematica creates a file with ending .obj.mtl automatically on export in the same folder as the .obj file. Maybe you have to change the file end from .obj.mtl to .mtl, since that is the standard: External renderers will look for the same file name but with ending .mtl. Generally, I cannot tell how far the export filter in Mathematic is conform to the obj standard. E.g., I cannot open your model in GLC_Player when exported by Mathematica... Moreover, the export filter is slow and ineffiecient in the sense that it creates way too large obj files. $\endgroup$ – Henrik Schumacher Oct 20 '17 at 9:50

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.