I wrote this script to speed up the process of assigning textures and set the materials in Marmoset according to the project I worked, with just a click.
This script finds the assigned materials and texture-files of a model and creates a materialfile (.tbmat) for each one to use in Marmoset Toolbag. The materials already have all the predefined settings for marmoset we had in our project, so no additional adjustments were necessary.
The layout is very similar to the texture assign module of the Material manager, as it is based on that.
- Top: Path where to look for textures
- Pickbutton to select an object in the scene
- Listview of materials found on the object
- Remove string can be added if mesh and texture name are not exactly the same
- Listview of textures found
- Radiobuttons to select what type the alpha channel is, when one is found
- Export path
- Export MMat:
- Leftclick – Exports only selected material
- Rightclick – Exports all materials in list
- Export Mesh:
- Exports mesh with current set FBX-settings
The .tbmat definitions for all kind of different texture/materials for the project are stored in a separated file as string, which are read in and combined into the final .tbmat file.
Here’s a part of how the parameters for different channels with textures are defined:
ParAlbedo = "
@Sub SRAlbedo = SRAlbedoMap
Albedo Map = "+LineAlb +"
Color = 1 1 1
@End
"
ParNormal = "
@Sub SRSurface = SRSurfaceNormalMap
Normal Map = "+LineNrm +"
Scale & Bias = 1
Flip X = 0
Flip Y = 1
Flip Z = 0
Object Space = 0
@End
"
ParRough = "
@Sub SRMicrosurface = SRMicrosurfaceGlossMap
Gloss Map = "+LinePar +"
Channel = 0
Gloss = 1
Horizon Smoothing = 0.5
Invert = 1
@End
"
ParMetal = "
@Sub SRReflectivity = SRReflectivityMetalnessMap
Metalness Map = "+LinePar +"
Channel = 1
Metalness = 1
Invert = 0
@End
"
ParAO = "
@Sub SROcclusion = SROcclusionMap
Occlusion Map = " +LinePar +"
Channel;occlusion = 2
Occlusion = 1
UV Set = 0
Vertex Channel = 0
Cavity Map = nil
Channel;cavity = 2
Diffuse Cavity = 1
Specular Cavity = 1
@End
"