Asset Import / Export Tools

Published: Oct 30, 2020 by Bailey Martin

Python Assets Tools Pipeline

These are a series of tools written to automate the general import and export pipeline of different asset types from various DCC packages, into a final game engine (In this case Unreal).

The main aim with these tools is to take various processes which by default take a series of clicks (and a bit of careful thought) and condense them down to 1 or 2 button clicks, and removing the thinking step all together.

The tools are were all built around an asset pipeline I’m using for my personal projects, so portability is very limited. However all of the source is available here for you to pick through as you please.

The codebase is also all built around my Juniper Tools Framework which aims to further standardize the tools pipeline across multiple DCC packages. Feel free to take a look at that.

Material Exporter (Substance Designer)

Tool used to auto-export the currently opened Material Graph, and all child graphs.

What happens when the tool is ran:
1 - Texture Exporting: All textures are updated and exported
2 - Material Metadata: A {mat_name}.material metadata file is generated (I’ll cover this in the unreal export)
3 - Unreal Reimport: If Unreal is open, the textures are re-imported (à la live link)
4 - SBSAR Export: A {mat_name}.SBSAR file automatically is generated/updated (for use in Substance Painter)

Image

Material Refresh (Substance Designer)

Automatically imports the current Material into Unreal. Automatically taking care of things such as, Texture Properties, Material Generation, Asset Dependency Importing.

Changing the material import proces to:
1 - Re-import: Material is imported to Unreal from a single button click, no more navigating and picking files, it’s all automated.

From the previously cumbersom process of:
1 - Open Unreal: Must swap to the program before starting
2 - Find in Content Browser:_ Hand find and select all source assets to reimport. Multiple times if the files are in different source folders.
3 - Pick Import Properties: For new assets things such as texture properties (compression, type, etc) were previously hand done.
4 - Build Material: For new materials the material would need manually creating.

Image

Material Importer (Substance Designer)

Used for quick loading of materials. Gathers all valid ‘.material’ files found in the asset library, and adds them to a single combo box.

Removes the task of navigating through all folders to find materials - this can save a lot of time depending on how big the asset library is.

Geometry Exporter (3DS Max)

Exports a currently opened ‘.max’ file as FBX - along with associated materials, using a couple of methods.

This is what happens when the exporter is ran:

1a - Single Export: Used when a single sub-mesh is found in the Max file
Image
1b - Multi Export: Exports a series of meshes from the file. Layers beginning with ‘SM_’ denote unique meshes to be exported.
Image
2 - Material Processing: Material IDs are baked down to ensure only used materials are exported (0..NUM)
3 - Metadata Export: A ‘.geometry’ file is generated per-mesh containing metadata on the asset (such as material paths, and source file data).

Material Importer (Unreal)

Image

As mentioned previously, this can either be automatic (on export), or manual - this will cover the manual portion.
There’s also a batch mode which whill import all materials. Although this needs more work to ensure only “dirty” assets are updated.

This takes the path of a ‘.material’ file, and automatically imports it to unreal, along with some other things. Depending on how many assets your library has, this can save anywhere from minutes, to hours of work.

This is what happens when import is ran:
1 - Create Unreal Material: A new material instance is created (on first import)
2 - Set Shader: A parent master material is applied - if set in the host application (see ‘Shader Exporter’ below)
3 - Import Textures: All texture dependencies are imported (this means no hand importing all wanted textures)
4 - Set Parameters: All texture parameters are set from the ‘.material’ file

Geometry Importer (Unreal)

Similar to the Material Importer, this imports a geometry asset from a ‘.geometry’ file. It will also import the material and texture dependencies if they don’t already exist.


Shader Exporter (Unreal)

A smaller, but useful tool, which will loop over all Master Materials in the project, and serialize them to a {shader_name}.shader file. Useful as all existing ‘.shader’ files are then exposed to external Import/Export tools. Meaning things such as parent master materials can be edited per-material outside of Unreal.

This file is ‘.json’ based, and stores things such as:

  • Parameters (Ie, Vector, Float, Bool, etc.)
  • Properties (Statically compiled properties - Ie, “Parent Shader”, “Two Sided?”)


Material Exporter (Unreal)

This tool serializes all materials inside the currently opened unreal project out to ‘.material’ files.
This adds the option for essentially editing materials outside of the host Unreal instance. Where they can be auto-imported back into the engine. It’s a bit of a workaround for the fact everything in unreal is a binary ‘.uasset’ file.

Again, there’s more that could be done here to combat the two-way material editing issues which may come from editing inside Unreal, and another host process.

Exported data includes:

  • All Material Parameters (Ie, float, vector, etc)
  • All Texture Parameters (with paths relative to the project)
Python Assets Tools Pipeline

Share

Store

Retro Filters Pack

Pack containing filters for VHS / Glitch, CRT Monitor, Vintage, Pixelate, Retro Console, Arcade Machine, and more..

Iridescent Materials Pack

Pearlescent, Bubbles, Iridescent Paint

Sketch-It

Hand Drawn Post Process Pack