Automating 3Ds Max export to Unreal Datasmith using Python

Unreal has quite a handy plugin for 3Ds Max that is able to export to Unreal Datasmith.

Advantages of using Datasmith over FBX or Alembic:

  1. Geometry is exported as a hierarchy, rather than just a single actor. If you have 100 distinct components, you have each component as a single actor, rather than 100 material slots named “Element 0” to “Element 99”. This opens a door for further post-processing, such as automatically assigning materials based on actor name

Disadvantages:

  1. The exporter AFAIK does not support deformations in alembic cache. Only transformations are exported into a level sequence. This stands to reason since Geometry cache is still experimental in Unreal (as of 4.26.1).

You can open the script editor in 3Ds Max by going through menu: “Scripting -> Script editor”. Go ahead and open “Script listener” too, so you can see interactive results. Evaluate a line by highlighting text in the script editor and hit “shift-enter”.

You can use the following command to run max in “headless” mode and quit max after the export was finished:

"D:\Program Files\Autodesk\3ds Max 2020\3dsmax.exe" -q -silent -mip -mxs "quitMAX() #nopromptfile.max" -u PythonHost "C:\Users\filip\Documents\3ds Max 2020\export\export_datasmith.py"

Source: https://knowledge.autodesk.com/support/3ds-max/learn-explore/caas/CloudHelp/cloudhelp/2016/ENU/3DSMax/files/GUID-BCB04DEC-7967-4091-B980-638CFDFE47EC-htm.html

Sadly, there is no way to pass arguments from max to the python script. You can however create a file, run the script and then read the file in the script. You can also create a new text file, where you can write logs or results of your operation. The beauty is that you can do just about anything once you are in a python environment.

If you are interested in the source code of the Datasmith plugin for Max, you can find it in Unreal Engine repository, at path “Source/Programs/Enterprise/Datasmith”.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store