GLB Materials in Blender

This page goes into how to create Materials in blender including ways to optimise texture to export as glbs...

GLB assets have certain things to do in order to have textured materials appear how you want within Unity. This document will go over different material setups using the Blender Node graph.

For more information you can go to the Blender documentation.

All of the following material examples are created in the Blender 'Shading' menu at the top of the window. You'll have your File Browser (Top left), 3D viewport (Top Middle), the Image Editor (Bottom left), and the Shader Editor (Bottom middle). Along with the Outliner and Properties tabs to the right.

  • Make sure that the Render Mode is set to Material or Rendered at the top right of the 3D Viewport so you can see the results as you update the node graph.

  • Make sure that the material that you are modifying is selected as well in the Material Properties panel after you have selected the asset that uses it.

Diffuse + Normal Map

The most common type of material would be a Diffuse, also known as color or Albedo, for color and a Normal map which offers bump details on your asset. You could also skip either of these if you don't want to use it. Note that the Normal map texture requires a specific Normal Map node to work correctly.

Adding a Diffuse Texture

  • In the Shader Editor at the bottom, go to the 'Add / Texture / Image Texture' menu , use 'Shift + A', or Right click on the Shader graph background, to add an Image Texture node. Move it to where you like and left click to place it.

  • Use the 'Open' button to load your desired diffuse texture from your computer.

    • Make sure it is the correct size. For important assets we recommend 1024x1024 or less, for smaller assets use 512x512 or less.

  • Connect the yellow 'Color' dot on the 'Image Texture' node to the Yellow color dot on the 'Color' Parameter on the 'Principled BSDF' node.

Adding a Normal Map Texture

  • Either add another 'Image Texture' Node, or select the previous one and use 'Shift + D' to duplicate it.

  • Use the 'Open' button to load your desired normal map texture from your computer.

    • Make sure the texture resolution is as small as possible. For important assets we recommend 1024x1024 or less, for smaller assets use 512x512 or less.

  • Add a 'Vector/Normal Map' mode from the Add menu or 'Shift + A' hotkey.

  • Connect the Yellow 'Color' dot on the 'Image Texture' node to the Yellow color dot on the 'Color' Parameter on the 'Normal Map' node.

  • Connect the purple Color dot on the 'Normal Map' node to the Purple color dot on the 'Normal' Parameter on the 'Principled BSDF' node.

  • Change the 'Color Space' parametter from sRGB to 'Non-Color'.

Metallic and Smoothness

GLB/GLTF has specific requirements for texture use much like the Unity Standard Materials shader.

When it comes to Smoothness, GLB actually uses Roughness instead. So White on the texture makes the asset not smooth, and Black on the texture is very smooth and polished.

Both Metallic and Roughness are combined into one texture :

  • Roughness - Green channel.

  • Metallic - Blue channel.

With your textures created in your texture creation tool (such as photoshop or substance Painter) :

  • Load the Image Texture node with your Roughness Metallic texture.

  • Add a 'Converter/Separate Color' node and connect your image texture

  • Make sure to set the Roughness/Metallic node 'Color Space' parameter to 'Non-Color'.

  • Connect the Green channel to Roughness

  • Connect the Blue Channel to Metallic.

Using Alpha as transparency

It is possible to use transparency but this is best done with Backface culling enabled. If Backface Culling is disabled you will have semi translucent results even where it should be solid.

Double Sided materials

If you want your material to show the texture on the front and the back, you can enable/disable Backface Culling to do so. You can find this setting in the Material properties / Settings section.

Emissive textures

It is possible to use emissive textures on your asset but the bloom effect within Mona (the glow effect on Unity materials with high emissive strength) will not be applied for now. That said you can use the emissive channel to apply bright areas on your asset.

You can either change the color property, or set the Color parameter to its own emissive texture.

Summary

As always it is better to use less textures as possible, both in number and in filesize. So if you can use a parameter on its own rather than a texture channel, don't use the texture to create the result.

These are just a couple of examples of using the Node graph in Blender to setup your textures to export as GLB.

Last updated