Last updated on
May 17, 2023
- Substance 3D home
- Ecosystems and Plugins
- Home
- Game Engines
- Unreal Engine
- Unreal Engine 5
- Unreal Engine 5 overview
- Unreal Engine 5 Release Notes
- Plugin Overview - UE5
- Plugin Settings - UE5
- Substance Input Image - UE5
- Material Instance Definition - UE5
- Material Template Usage - UE5
- Out-of-the-Box Material Templates
- Tiling Substance - UE5
- Substance 3D Plugin Default Templates
- Substance 3D Assets Library Usage - UE5
- Blueprints - UE5
- Unreal Engine 5 Scripting
- Installing to Source Builds
- Unreal Engine 5 overview
- Unreal Engine 4
- Unreal Engine 4 overview
- Unreal Engine 4 plugin release notes
- Unreal plugin 4.27.0.1
- Unreal plugin 4.26.0.21
- Unreal plugin 4.26.0.2
- Unreal plugin 4.26.0.1
- Unreal plugin 4.25.0.5
- Unreal plugin 4.25.0.4
- Unreal plugin 4.25.0.3
- Unreal plugin 4.24.0.3
- Unreal plugin 4.23.0.2
- Unreal plugin 4.23.0.1
- Unreal plugin 4.22.0.33
- Unreal plugin 4.22.0.32
- Unreal plugin 4.21.0.31
- Plugin Overview - UE4
- Plugin Settings - UE4
- Substance Input Image - UE4
- Material Instance Definition - UE4
- Tiling Substance - UE4
- Working with Bump Offset (Parallax) - UE4
- Working with Displacement - UE4
- Source in UE4
- Live Link in UE4
- Blueprints - UE4
- Unreal Engine 4 Scripting
- Unreal Engine 4 overview
- Unreal Engine 5
- Unity
- Unity overview
- Unity Release Notes
- Downloading Substance 3D Plugin in Unity
- Unity Plugin Overview
- Unity Preferences
- Optimization Guidelines
- Upgrading Projects/Known Issues
- Managing Substance Graphs
- Changing parameters
- Generated Textures (Packing)
- Rendering Color Space
- Using Image Inputs
- Publishing for Mobile
- Substance 3D for Unity Scripting
- Scripting in Unity (Deprecated)
- API Overview
- Scripting API
- C# Example Script
- Substance 3D Assets Library Usage
- Removing Substance Plugin
- Substance 3D in Unity Tutorials
- Physical Size in Unity
- Sharing sbsar Files Between Projects
- Unity overview
- Lumberyard
- Roblox
- Unreal Engine
- 3D Applications
- Maya
- 3ds Max
- MODO
- MODO overview
- Modo Plugin Release Notes
- Substance in MODO Overview
- Modo Installation
- Parameters
- Custom Materials
- Working with Normals
- Working with Emissive
- Bump and Displacement
- Working with References
- Animating Substances
- Copy/Duplicate Substance
- Environment and Rendering Setup
- Modo Switch Engine
- Tiling Modo textures
- MODO overview
- Cinema 4D
- Houdini
- Blender
- Blender overview
- Release Notes
- Substance in Blender Overview
- Downloading and Installing the Plugin
- Preferences
- The Substance 3D Panel
- Shortcuts and Navigation
- Workflows
- Physical size in Blender
- Substance 3D Assets Library
- Troubleshooting
- Uninstalling the Add-on
- Substance 3D Add-on for Blender Tutorials
- Blender overview
- Creative Cloud Applications
- Renderers
- Partnerships
Maya Scripting
The Substance in Maya plugin can be scripted. An exposed API allows Substance commands to be used in scripts for creating and managing Substance materials. You can access the available commands by going to the plugin information.
Windows>Settings/Preferences/Plugin Manager and search for the substancemaya.mll file.
Click the "i" button to see the available commands
Example Script:
This script will load an sbsar file and apply the Arnold render workflow to the selected mesh. To use the script, please follow the example listed here.
- copy and paste the code into a Python tab of the script editor.
- Select and mesh in the viewport
- Select the text in the Python tab and hit "ctrl + enter"
- In the window, browse for an sbsar file.
import maya.cmds as cmds def _connect_place2d(substance_node): """ Connects the place2d texture node to the Substance node """ place_node = cmds.shadingNode('place2dTexture', asUtility=True) connect_attrs = [('outUV', 'uvCoord'), ('outUvFilterSize', 'uvFilterSize')] for out_attr, in_attr in connect_attrs: cmds.connectAttr('{}.{}'.format(place_node, out_attr), '{}.{}'.format(substance_node, in_attr)) def _find_shading_group(node): """ Walks the shader graph to find the shading group """ result = None connections = cmds.listConnections(node, source=False) if connections: for connection in connections: if cmds.nodeType(connection) == 'shadingEngine': result = connection else: result = _find_shading_group(connection) if result is not None: break return result def _apply_substance_workflow_to_selected(substance_file, workflow): """ Imports a mesh into Maya and applies the shader from a Substance workflow to it """ geometry = cmds.ls(geometry=True) # Create the substance node and connect the place2d texture node substance_node = cmds.shadingNode('substanceNode', asTexture=True) _connect_place2d(substance_node) # Load the Substance file cmds.substanceNodeLoadSubstance(substance_node, substance_file) # Apply the workflow cmds.substanceNodeApplyWorkflow(substance_node, workflow=workflow) # Acquire the shading group and apply it to the mesh shading_group = _find_shading_group(substance_node) cmds.select(geometry) cmds.hyperShade(assign=shading_group) def demo_load_sbsar_workflow(): """ Acquires an sbsar from a file dialog, loading and applying it to any selected mesh """ file_filter = 'Substance (*.sbsar);;' files = cmds.fileDialog2(cap='Select a Substance file', fm=1, dialogStyle=2, okc='Open', fileFilter=file_filter) if files: substance_file = files[0] _apply_substance_workflow_to_selected(substance_file, cmds.substanceGetWorkflow()) if __name__ == '__main__': demo_load_sbsar_workflow()
An exposed API allows Substance commands to be used in scripts