15
$\begingroup$

Is there any object geometry format for which Mathematica supports the exporting of textures for external (non-Mathematica) use ? If not does anyone know of work arounds?

All the texture primitives are culled, this is the normal behavior I see for the formats listed below:

g = Graphics[{Texture[ExampleData[{"TestImage","Lena"}]],
        Polygon[{{1,0},{0,Sqrt[3]},{-1,0}},
    VertexTextureCoordinates->{{1,0},{0.5,1},{0,0}}]}]
Export["~/test.stl",g]
Import["~/test.stl"]

enter image description here

I will not accept an answer that uses wolfram specific formats such as mx, wdx, etc... as this does not answer my question.

Here are a list of the ones I have tried:

3D Object Geometry Formats

"PLY" - PLY 3D geometry format (.ply)
"OFF", "NOFF" - 3D object file formats (.off, .coff, .noff, .cnoff)
"BYU" - BYU 3D geometry format (.byu)
"OBJ" - Wavefront OBJ format (.obj)
"VTK" - Visualization Toolkit 3D format (.vtk)

3D Viewing Formats

"X3D" - X3D XML geometry format (.x3d)
"JVX" - JavaView format (.jvx)
"VRML" - Virtual Reality Modeling Language format (.vrml)

Modeling & Rendering Formats

"Maya" - Maya entity files (.ma)
"POV" - POV-Ray ray-tracing object description format (.pov)
"LWO" - LightWave 3D file format (.lwo)
"3DS" - 3D Studio format (.3ds)
"RIB" - Renderman interchange format (.rib)

CAD-Related Formats

"DXF" - AutoCAD 2D & 3D formats (.dxf)
"STL" - stereolithography format (.stl)
"ZPR" - Z Corp. 3D printer format (.zpr)
$\endgroup$
  • 2
    $\begingroup$ Do you know of a file type that supports embedded textures? I only know of Autodesk FBX that can contain textures in the file. However, it is particular to Autodesk. There are other formats that are essentially ZIP files that allow textures to be transported with an object file. $\endgroup$ – Edmund Dec 21 '15 at 13:45
  • $\begingroup$ Most 3D file formats support texture mapping. $\endgroup$ – M.R. Dec 21 '15 at 15:16
  • $\begingroup$ 3ds, max, lwo, obj, xsi, c4d, fbx, blend, oth to name a few. $\endgroup$ – M.R. Dec 21 '15 at 15:17
  • $\begingroup$ Just google "free 3d models", there are many sites that have examples: turbosquid.com/Search/3D-Models/free, tf3dm.com, or my favorite: clara.io/library?query=starwars $\endgroup$ – M.R. Dec 21 '15 at 15:19
  • $\begingroup$ @M.R. Most don't support embedding the texture in the file though. Have you also checked the various packages written for interoperability with other 3D software? There are some for POV-Ray. Maybe some support handling textures. $\endgroup$ – Szabolcs Dec 24 '15 at 10:16
3
+75
$\begingroup$

If this texture only needs to be processed in Mathematica, you can use the binary WDX format, which is also platform-independent and "standard" for use with Mathematica.

g = Graphics[{Texture[ExampleData[{"TestImage", "Lena"}]], 
    Polygon[{{1, 0}, {0, Sqrt[3]}, {-1, 0}}, 
    VertexTextureCoordinates -> {{1, 0}, {0.5, 1}, {0, 0}}]}];

Export["txtr.wdx", g]

Then we can import and get the exact symbol back up and running. For proof of preservation:

Import["txtr.wdx"]  // InputForm

(*Results in*)
Graphics[{Texture[Image[RawArray["Byte", {{{226, 137, 125},
...............
 {185, 74, 81}}}], "Byte", ColorSpace -> "RGB", 
 Interleaving -> True]], Polygon[{{1, 0}, {0, Sqrt[3]}, {-1, 0}}, 
 VertexTextureCoordinates -> {{1, 0}, {0.5, 1}, {0, 0}}]}]

lena

$\endgroup$
  • 1
    $\begingroup$ Thanks for the response, but no, this does not help me. By "standard" I mean non proprietary and not "Mathematica Only". $\endgroup$ – M.R. Dec 18 '15 at 0:17
  • 1
    $\begingroup$ Anyone can dumpsave a symbol, this is not an answer. $\endgroup$ – M.R. Dec 24 '15 at 4:09
2
$\begingroup$

There is no way to export textures in 2d or 3d graphics to standard (nonmma-only) formats as of 10.3.1.

$\endgroup$
  • $\begingroup$ Don't know about the downvote, perhaps you got blamed as the messenger of negative news. $\endgroup$ – Yves Klett Dec 24 '15 at 7:33
  • $\begingroup$ Fine by me, the other answer didn't deserve any points. $\endgroup$ – M.R. Dec 25 '15 at 21:46

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.