Modo Material Importer for Unity
Modo Material Importer is a Unity plug-in that sets up standard materials in Unity, ensuring that their settings match those of your materials in Modo. If the script is unable to find a viable matching texture in your project, it automatically imports texture files that are stored outside of your Unity project.
Installing the Material Importer
You can download the plug-in from the Unity Asset Store.
After creating a project in Unity, create a folder called Editor in the Assets folder of your project, and copy the script into it. When you open your project, you can see the material importer script in the bottom area of the interface, under Assets > Editor.
Using the Material Importer
After exporting the .fbx and .xml files from Modo, place them into the Assets folder of your Unity project. The importer automatically detects the .xml files that are exported alongside the .fbx files from Modo, based on their matching file names.
If either the .fbx or the .xml file is updated, the plug-in automatically applies the material settings.
The regular Unity settings of your mesh for material naming and texture searching are respected. You can check these by selecting your imported .fbx file and opening the Inspector tab on the right side of the Unity interface.
There are two global options for the script. You can access these by opening an .xml file exported from Modo in Unity's Inspector. The Inspector tab appears on the right side of the screen. These options affect all .xml files, not just the selected one.
• Always Update Material Values - With this option enabled, the importer always re-imports the material settings. When disabled, the settings of existing materials remain intact, and only new or missing materials have their settings applied from the XML values.
Note: If a matching texture is found inside your project, the importer doesn't attempt to import an external texture to replace it.
• Always Reimport External Textures - When enabled, the plug-in always re-imports textures from an external location. When disabled, if an existing texture is found, the material uses that. Only new or missing textures are imported from an external source.
Selecting an .xml asset displays a custom Inspector containing options for the global settings.
Clicking the Force Reimport button re-imports the material settings from the currently selected .xml file.
Below are the current settings for the materials defined in the .xml file. They cannot be edited, they are for information only.
The following rules apply for material parameters:
• Transparency - Transparency is currently not supported for Unity in Modo, nor is it exported to the .xml file. However, you can use the regular Transparent Amount texture effect with Invert enabled. To match Unity, set your Transparent Amount texture to be the Albedo texture, but swizzled to output just the Alpha channel. To do this, check Swizzling and set the Channel to Alpha. Then, in Unity, manually set your material's blend mode to Fade or Transparent. For more details on channel swizzling, see Channel Swizzling.
Note: The standard shaders in Unity use the alpha of the Albedo texture for their opacity mask.
• Color - Your material's base Albedo color is only applied if there is no Albedo texture defined in your material. Similarly, your material's Emissive color is only applied if your material has an Emissive color texture defined. These are both set to white if a texture is defined.
• Normal Maps - Textures set to Normal or Detail Normal are automatically set to normal maps at import if imported from an external location.
• Height/Emissive - Most other settings are enabled correctly depending on whether textures or values are present (Height for parallax mapping, Emissive for lightmap baking).
Exported Materials and Textures
Almost all material settings and textures are exported:
• Texture Wrap - In Unity, all of the main texture UVs are derived from the texture settings of the Albedo texture. Similarly, all of the detail texture UVs are derived from the texture settings of the Detail Albedo texture.
You can export the Wrap U/Wrap V settings of a texture layer from Modo into Unity.
However, like Unity, Modo only uses the Wrap U/Wrap V values sampled from Albedo and Detail Albedo textures. This means that if you have an Albedo with 2.0 Wrap U and 2.0 Wrap V, but a Normal map with 1.0, when exported to Unity, the Normal map takes the 2.0 Wrap U and Wrap V settings of the Albedo texture.
• Detail UV - Modo assumes that all of your main textures are using the first set of UVs on your mesh. This works similarly in Texture Wrap values. If the UV map of your Albedo texture and Detail Albedo texture differ, Modo assumes that your detail map uses a second UV set. The material importer script then sets the detail maps to use the second UV set.
What Doesn't Get Exported
Unity has hard-coded settings for certain texture map channels it takes its values from.
For example, Unity expects the Albedo texture to contain the Albedo color in the RGB channels and the transparency in the alpha channel. If you have your transparency set up to use a different texture in Modo, then it doesn't carry over to Unity, and the alpha channel of the Albedo texture is used instead.
Matching Modo textures with Unity Expectations
The following table contains groups of values and the corresponding texture of Modo, from which the Unity importer takes them. Each group is hard-coded in Unity to come from the same texture.
Albedo Color and Transparency
Albedo Color: RGB
Metalness and Glossiness
Modo: Ambient Occlusion
Ambient Occlusion: G
Modo: Detail Mask
Detail Mask: A
Tip: Modo's channel swizzling feature allows you to set your textures up in Modo the way that Unity requires them to be. For more information, see Channel Swizzling.