/Transmogrifier

A Blender addon for batch converting 3D files and associated textures into other formats.

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Transmogrifier

A Blender addon for batch converting 3D files and associated textures into other formats - with an emphasis on visualization for the web and AR. Supports conversions between FBX, OBJ, glTF/GLB, STL, PLY, X3D, DAE, ABC, and USD/USDA/USDC/USDZ.

Installation ๐Ÿ“ฅ ยท Usage ๐Ÿญ ยท How it Works โš™ ยท Benefits ๐ŸŽ ยท Features โœจ ยท Credits ๐Ÿ™

INSTALLATION ๐Ÿ“ฅ

  1. Prerequisites: Blender 3.6 and Windows. (Transmogrifier may work on GNU/Linux and MacOS, but this has not been tested. Support for GNU/Linux is on our roadmap.)
  2. Download the latest version. Select the .zip file with the version number at the end (e.g. "Transmogrifier-v1.0.0.zip"), not the ones named "Source Code".
  1. Install the addon, like this.
  2. Choose where to display the addon menu in Blender.
  1. (Optional) Copy example workflow/import/export presets and a studiolight, "neutral.hdr", to local Blender preferences directory. The studiolight is used for rendering preview image thumbnails of converted models.

USAGE ๐Ÿญ

  1. Select a directory containing 3D files of the chosen import format, or a parent directory of arbitrary organization and/or depth as long as there exists at least one 3D file of the specified import format somewhere inside.
  1. Select an output directory to which 3D files of the chosen export format(s) should be exported. "Adjacents" means that converted models will be saved to the same directories from which they were imported. "Custom" means that converted models will be saved to a chosen custom directory.
  1. Set additional export settings as described in the Features section below. (Optional: to save current settings for later use, save the current .blend file)
  1. Click "Batch Convert". This will spawn a console window and another instance of Blender. The new Blender window will remain grey while the conversion process gets output to the console window. The original Blender window will remain frozen/unresponsive until the batch conversion is complete. This is normal operation. After the conversion finishes, the greyed-out Blender window and console will disappear and the original Blender instance will report how many files were converted.

HOW IT WORKS โš™

Transmogrifier works by searching through a given directory for files ending with the extension of the format selected. When it finds a file, it clears out all the current data blocks in the scene, imports the file, imports the associated textures, creates material(s), assigns that/those material(s) to the object(s) in the scene, and exports the model in the new format specified. If Auto File Resizing is turned on, Transmogrifier will then check the exported file's size and attempt to resize the file. The process then repeats until it has converted all files of the specified import format in the given directory.

The diagram below shows the general process and the variety of ways in which Transmogrifier can convert models with respect to available textures and the chosen import and export formats. Each gray box with rounded corners indicates a directory/folder.

Models from Polyhaven (CC0).

BENEFITS ๐ŸŽ

  • โณ Saves Time. Automates the boring stuff so you can focus on creating instead of converting.
  • ๐Ÿ›ก๏ธ Private and Secure. Runs offline/locally. No account needed.
  • โš“ Non-Destructive. Original files are preserved (unless converting between the same formats).
  • ๐Ÿ”“ Open Source/Licensed-Free. View, modify, and share the code freely.
  • ๐Ÿ†“ Free. No paywall, no trial, no strings attached.

FEATURES โœจ

Transmogrifier includes a robust set of tools for non-destructively converting 3D files and associated textures into other formats.

Workflow

Create custom Transmogrifier presets (aka "Workflows) for quickly switching between different conversion scenarios. Click the plus button "+" to create a Workflow from all of the current Transmogrifier settings, giving it a custom name. Workflows are stored as "operator presets" in Blender preferences directory. To remove a workflow, select it from the menu, then click the minus button "-".

3D Formats

  • FBX
  • OBJ
  • glTF/GLB
  • STL
  • PLY
  • X3D
  • DAE
  • ABC
  • USD/USDA/USDC/USDZ

Import/Export Presets

Set user-defined import and export presets.

Import Location

Select a directory containing 3D files of the chosen import format, or a parent directory of arbitrary organization and/or depth as long as there exists at least one 3D file of the specified import format somewhere inside.

Export Location

Set the export location to either "Adjacent" or "Custom". "Adjacents" means that converted models will be saved to the same directories from which they were imported. "Custom" means that converted models will be saved to a chosen custom directory. Choose whether to place converted models in subdirectories of their same names. If so, choose whether to copy original files from import directories to respective subdirectories.

Name

Set a custom prefix and/or suffix for every exported file. Synchronize object names and object data names according to the former. Rename UV channels of all objects to "UVMap" (and "UVMap_1", etc. for objects with more than 1 UV channel).

Textures

Transmogrifier can detect the presence of multiple image texture sets and non-destructively modify them during the conversion process. Select whether to use textures, regex the PBR tags in the textures' names, and keep the otherwise temporary textures folders with their modifications.

Source:

  • External: image textures nearby the imported model.
    • in a "textures" subfolder
    • in "[texture set]" subfolders inside a "textures" subfolder
    • in the same directory as the imported 3D file
  • Packed: image textures packed into the imported file (e.g. GLB or USDZ)
  • Custom: image textures from a custom directory, which will be applied to all models converted.

Models from Polyhaven (CC0). The scenarios shown depend on whether the selected import or export formats support textures. Each gray box with rounded corners indicates a directory/folder.

3 Texturing Rules

There are three naming conventions that must be followed in order for textures to be properly imported, materials created, and materials assigned to the right objects.

  1. Transparent pieces have "transparent" in name and are separate objects. Objects that should appear transparent must have the word "transparent" present somewhere in their names. This indicates to Transmogrifier that it should duplicate the material as "[material]_transparent" and turn on "Alpha Blend" blending mode, then assign "[material]" to the opaque objects and "[material]_transparent" to the transparent objects. This convention works for multiple texture sets as well.
  1. Per item, if only 1 texture set is present, object names don't matter except for Rule 1. For "External" and "Custom" texture sources and for models with only one texture set present, the first rule doesn't matter because it is assumed that that texture set should be applied to all the objects in the scene.
  1. Per item, if >1 texture set is present, object and textures set names do matter: object prefixes must match texture set prefixes. For "External" and "Custom" texture source and for models with more than one texture set present, a naming convention must be followed for Transmogrifier to correctly import and assign multiple texture sets to the proper objects. Simply ensure that the the first word before an underscore or another separator in the textures' and objects' names is 1) distinct between texture sets and 2) consistent between i.) each PBR image in each texture set and ii.) between the texture sets and the objects to which those textures should be applied (See image below). As such, having multiple materials assigned to different meshes within an object does not work. For "Packed" textures, Transmogrifier automatically synchronizes prefixes by inserting the exising materials' prefixes as prefixes to the names of their corresponding image textures and objects to which those materials are assigned.

Resolution:

Resize textures and filter what to include by PBR type. Images will not be upscaled.

  • 8192
  • 4096
  • 2048
  • 1024
  • 512
  • 256
  • 128

Format:

Reformat textures and filter what to include by PBR type.

  • PNG
  • JPEG (.jpg)
  • TARGA
  • TIFF
  • WEBP
  • BMP

Transformations

Perform custom transformations and/or apply transformations to every model before export. Filter what transformations to set/apply.

Animations

Delete animations of every imported object before export.

Scene

Set a custom unit system and length unit for export.

File

Perform automatic file-resizing methods to every model in order reduce the exported file size below a custom target maximum. Filter which methods are used. If all methods are exhausted and the file size is still above the target maximum, Transmogrifier will report this in the log and move on.

Approaches:

  • All (Always export despite any pre-existing file that is already below the target file size.)
  • Only Above Max (Only export and resize files that are above the target file sizes. Pre-existing files already below the target are ignored.)
  • None (Don't auto-resize at all.)

Methods:

  • Draco compression (Only works for GLB/glTF.)
  • Resize textures (Set a minimum resolution limit.)
  • Reformat textures (Convert all textures to JPG except normal maps.)
  • Decimate mesh objects (Uses edge collapse at 50% ratio each time. Set a maximum decimate iteration.)

Archive

Save a .blend and/or render an image preivew thumbnail with Material Preview viewport shading for every imported file. Save a log of the conversion process to troubleshoot errors or simply to get a list of the output files and their file sizes.

CREDITS ๐Ÿ™

Many thanks to the people who develop Blender, without whom this addon would have no foundation to exist!

Transmogrifier used code from the following repositories in the following ways. If you give a star to this repository, please also do the same for theirs!