If I generate a complexplot as follows:

a1 = ComplexPlot3D[Log[z], {z, -5 - 5 I, 5 + 5 I}]

enter image description here

I can export it to a 3D mesh (for use in external applications) with:

Export["a1.obj", a1]

This gives me a .obj file which has the 3D mesh of the plot. This works OK. The problem is that the exported material file (.mtl) is a solid color (instead of the rainbow representing the argument). This is the content of the .mtl file.

# Created with the Wolfram Language : www.wolfram.com

newmtl DefaultMaterial
Kd 0.60000002 0.60000002 0.60000002
Ka 0.050000001 0.050000001 0.050000001
Ks 0.60000002 0.60000002 0.60000002
illum 1

As you can see, it's just a solid color. Is there any way to export the material to correspond to whatever color function is used? Or export UV maps so I can apply it to the mesh in an external program? I'm open to using other formats other than .obj. I just want to be able to import the mesh into an external 3D program and have the same texture so it is colored the same way it is in Mathematica.


This is on Mathematica 12.2 and may be different on other versions.

You can hack out the texture from the innards of that plot using:

a1[[1, 1, 2, 1, 1, 2, 1]]

Or you could try:

First[Cases[a1, Texture[_], Infinity]][[1]]

The projection appears to be top down and flat and you can Export this as an image or use the front end to save it.

plot texture

  • $\begingroup$ Would there be any way to get a higher resolution version of the texture? Could I somehow tell Mathematica to plot the function with a higher resolution version, and then "hack out" the higher resolution texture, as you've done here? $\endgroup$
    – jippyjoe4
    Apr 27 at 3:48
  • $\begingroup$ @jippyjoe4 I don't think so - perhaps Mathematica is smoothing it. $\endgroup$
    – flinty
    Apr 27 at 9:10

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.