Creating PBR Materials for Unity
In an earlier post, I wrote about how to pack textures in different channels, and how to set up a PBR material for Unity’s Standard Shader.
In this post, I would like to share a node setup I made for Substance Designer, to speed up material export to Unity.
When I first bashed together these nodes, I didn’t know much about exposing settings and creating conditions and buttons. I manually connected all the necessary conversion nodes for each project, and by some time, I realized I’m wasting my own production time by repeating things over and over.
I knew that Substance is capable of creating incredible generators, and other artist tools that save you time so you can focus on the creative process, rather than playing connect-the-dots.
Custom material converter and template
First, let me introduce the node setup for the Unity Converter node. Currently, it can receive six types of texture maps.
- The base color is merged with the opacity mask, to create Albedo.
- Normal maps are converted from DirectX to OpenGL format.
- Roughness is inverted, then merged.
- Metallic is merged into a combined map.
- Ambient Occlusion is merged the same way.
- Height is converted to sRGB format.
After everything is set, the node creates exports that are corresponding to Unity’s shader needs. By plugging your PBR material to this node, I didn’t have to make the conversions manually.
Mesh Materials vs. Terrain Materials
The converter can work in two modes: mesh material mode and terrain material mode. The former is the default usage, this one we know well already. The terrain material mode creates textures suitable for Unity’s built-in terrain shader. This needs two texture maps: Albedo and Normal. Within the alpha channel of the Albedo, the shader looks for a smoothness map. You can toggle between these modes in the node Instance Parameters, under Albedo Merge. In addition, you can choose to use opacity and ambient occlusion, or not with these simple buttons.
Here you can see the basic custom template I made for exporting to Unity. After I have a PBR Material I want to use in Unity, I just drag it into this template, plug, and it’s ready for export. You can view the inputs separately by pressing [1].