Skip to main content

Creating Specular/Metallic Maps for Standard

When using the Standard shader, it expects the metallic and smoothness map to be elements of the same texture. You can also combine the occlusion map and detail mask into the same texture. Having all these elements be part of the same texture saves memory, so it's a good optimisation.

For reference, Standard expects Metallic in Red, Occlusion in Green, Detail Mask in Blue, and Smoothness in Alpha.

When using Standard (Specular), it also expects the specular and smoothness to be part of the same texture, but there's no room for anything else. Keep your occlusion and detail map separate for Specular materials!

Depending on what tools you use, this can be annoying to manage. For example, Photoshop saves semitransparent images with transparent pixels replaced with pure white - destroying the specular map! And due to an ancient bug in Windows, many tools that manipulate images can do the same to imported images. 

Using SmartTexture to create combined maps

Using SmartTexture, you can create texture files in Unity that automatically combine several different textures into one. Simply store your material attributes as seperate textures, and then create a SmartTexture asset which links them all together. 

To install SmartTexture, follow the instructions here: https://github.com/s-ilent/SmartTexture

Once installed, you can create new SmartTextures within Unity by creating a new SmartTexture asset and dragging in the individual seperated textures from your project. 

Using chaiNNer to combine textures

ChaiNNer is a handy tool for texture manipulation. You can even use it for upscaling textures with neural networks! But here, it's main use is combining textures together. 

You can get chaiNNer from here: https://chainner.app/

You can drag textures onto the board and use the Seperate RGBA nodes to split them into their components, then use Combine RGBA to reassemble them. ChaiNNer also supports various types of filters and can process images in batch. 

Using ImageMagick to combine specular and smoothness

ImageMagick is a simple, efficient way of getting your maps combined outside Unity in a few easy steps - as long as you can work with the command line.

Firstly, download ImageMagick. (The HDRI compatible version is recommended.) https://imagemagick.org/script/download.php#windows

ImageMagick is a long standing open source set of command line tools for editing images. People have done amazing things using IM and batch scripts. Our script is less amazing, but useful all the same.

Here's the script:

magick convert %1 %2 -alpha off -compose CopyOpacity -composite PNG32:%1_result.png

Alternatively, here it is pre-made into a batch file.

_JoinRGBAlpha.bat

To use it, simply select two images of the same size, and then drag the main image into the batch file. In this case, you'd select your specular map and smoothness map, and then drag the specular into the batch come. The result is a combination of the two, with the second image added to the alpha channel - creating a specular and smoothness map ready for Unity! You can then take the resulting file and use it in Unity. Make sure you pick the right one!