, include_normals=None, include_color=True, include_texture=True, return_texture=False, write_texture=True, resolver=None, digits=8, mtl_name=None, header='')#

Export a mesh as a Wavefront OBJ file. TODO: scenes with textured meshes

  • mesh (trimesh.Trimesh) – Mesh to be exported

  • include_normals (Optional[bool]) – Include vertex normals in export. If None will only be included if vertex normals are in cache.

  • include_color (bool) – Include vertex color in export

  • include_texture (bool) – Include vt texture in file text

  • return_texture (bool) – If True, return a dict with texture files

  • write_texture (bool) – If True and a writable resolver is passed write the referenced texture files with resolver

  • resolver (None or trimesh.resolvers.Resolver) – Resolver which can write referenced text objects

  • digits (int) – Number of digits to include for floating point

  • mtl_name (None or str) – If passed, the file name of the MTL file.

  • header (str or None) – Header string for top of file or None for no header.


  • export (str) – OBJ format output

  • texture (dict) – Contains files that need to be saved in the same directory as the exported mesh: {file name : bytes}, resolver=None, group_material=True, skip_materials=False, maintain_order=False, **kwargs)#

Load a Wavefront OBJ file into kwargs for a trimesh.Scene object.

  • file_obj (file like object) – Contains OBJ data

  • resolver (trimesh.visual.resolvers.Resolver) – Allow assets such as referenced textures and material files to be loaded

  • group_material (bool) – Group faces that share the same material into the same mesh.

  • skip_materials (bool) – Don’t load any materials.

  • maintain_order (bool or None) – Do not reorder faces or vertices which may result in visual artifacts.


kwargs – Keyword arguments which can be loaded by into a trimesh.Scene

Return type:

dict, resolver=None)#

Parse a loaded MTL file.

  • mtl (str or bytes) – Data from an MTL file

  • resolver (trimesh.Resolver) – Fetch assets by name from file system, web, or other


mtllibs – Each dict has keys: newmtl, map_Kd, Kd

Return type:

list of dict