---
description: >-
  This page goes into how to create GLB Materials in Blender including ways to
  optimise texture to export as glbs...
---

# GLB Considerations

{% embed url="https://youtu.be/-f1gJOuN2jY" %}
Glb Materials in Blender Video Tutorial...
{% endembed %}

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.&#x20;

For more information you can go to the [Blender documentation](https://docs.blender.org/manual/en/latest/addons/import_export/scene_gltf2.html).

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. &#x20;

* 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.

<figure><img src="https://3438761929-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MkgZbQzoznBJC_ld633%2Fuploads%2FFTSRi5yIEH4FTw1BvEGm%2Fimage.png?alt=media&#x26;token=b8f87aaf-6fc3-439d-a3bc-d526be20ab94" alt=""><figcaption><p>Blender Shader Graph...</p></figcaption></figure>

## 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.

<figure><img src="https://3438761929-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MkgZbQzoznBJC_ld633%2Fuploads%2FdpCYzxlbkhKBGjtDx5wf%2Fimage.png?alt=media&#x26;token=623e2a71-a5bb-48a1-83f1-e4beb5cf57a5" alt=""><figcaption><p>Adding a Diffuse and Normal Map...</p></figcaption></figure>

### Adding a Diffuse Texture&#x20;

* 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.&#x20;
  * 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 :&#x20;

* Roughness - Green channel.
* Metallic - Blue channel.&#x20;

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.

<figure><img src="https://3438761929-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MkgZbQzoznBJC_ld633%2Fuploads%2FgsyY6DAF4fjJHiyR4i3m%2Fimage.png?alt=media&#x26;token=e31186b2-3556-475e-bdad-e35909794b4f" alt=""><figcaption><p>Adding a Roughness/Metallic texture to keep with the GLTF 2.0 standards...</p></figcaption></figure>

## Using Alpha as transparency

It is possible to use transparency by setting the 'Materials Properties / Settings / Blend Mode' to 'Alpha Blend' shown below with the green box under 'Backface Culling'.

It is best to have Backface Culling _enabled_. If Backface Culling is disabled you will have semi translucent results even where it should be solid.

<figure><img src="https://3438761929-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MkgZbQzoznBJC_ld633%2Fuploads%2FAPSdDPocwcjV6m5ngc9c%2Fimage.png?alt=media&#x26;token=bbcc7ffa-ecb5-407b-87f3-73f2a6d18de4" alt=""><figcaption><p>Enable transparency by Setting the 'Blend Mode' to 'Alpha Blend' and enable 'Backface Culling'.</p></figcaption></figure>

If you are having issues with your assets transparency as one material, you may need to split the Transparency and Opaque areas of your asset into two separate materials.

## 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.

<figure><img src="https://3438761929-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MkgZbQzoznBJC_ld633%2Fuploads%2F8tuxWHykyaSDssWnXYHW%2Fimage.png?alt=media&#x26;token=2a94904e-c893-4b1a-8f7a-655196f53b0d" alt=""><figcaption><p>Enable / Disable Backface culling</p></figcaption></figure>

## 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.

<figure><img src="https://3438761929-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MkgZbQzoznBJC_ld633%2Fuploads%2F5G56XgcsQceMuFLT8OfF%2Fimage.png?alt=media&#x26;token=a2fc8c1a-029a-4012-b07e-027424a7877a" alt=""><figcaption><p>Using a texture or color for emissive...</p></figcaption></figure>

## Mirrored Polygons & Overlapping UVs

Depending on how you are creating and optimising your asset you may be using Mirrored assets and/or Overlapping UVs. If these assets are placed in Unity you may find there are some issues with the mirrored/overlapped UV polygons as a GLB, whereas an FBX would work without issue.

One approach around this is :&#x20;

* Import your asset as an FBX into Unity so that the mirrored/overlapping UV polygons look correct.
* Add the GLTFast Package, this is covered in [useful-unity-packages](../resources/useful-unity-packages "mention").
* Export the FBX as a GLB from the 'Gameobject / Export GLTF / GLTF-Binary (.GLB)' menu.
*   Import this GLB into Blender and update all the Maps with your original textures, as exporting from Unity as GLB seems to reduce the quality of the textures.

    * _Make sure to update the 'Color Space' property to 'Non-Color'_ in the texture node on the Normal, Metallic/Roughness, and Emissive texture. This can be found under the Shading category at the top.

    <figure><img src="https://3438761929-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MkgZbQzoznBJC_ld633%2Fuploads%2FSAo6AZZxbhlhgDmzJcpK%2Fimage.png?alt=media&#x26;token=5b7e2c12-98ed-4ba2-87b8-a1bc142be8c1" alt=""><figcaption><p>Make sure the Color Space property is set correctly...</p></figcaption></figure>
* Reimport your asset into Unity to see the result.

<figure><img src="https://3438761929-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MkgZbQzoznBJC_ld633%2Fuploads%2F7qkxHuVkCrCpNriI8e7U%2Fimage.png?alt=media&#x26;token=24fcb1f0-55ee-4476-9d95-befa3d4e762c" alt=""><figcaption><p>Results of GLBs with Mirrored / Overlapping UV polygons...</p></figcaption></figure>

## Troubleshooting

#### Materials don't look right...

A common issue is that in some cases the material doesn't look correct in comparison to the settings of the material. eg. The material looks matte where the roughness/metallic settings imply otherwise.\
Make sure that the Specularity parameter is set to non zero in Blender, this may apply to other parameters as well.

#### Opacity looks broken...

A pretty common issue is with Opacity settings making the asset look broken. First, make sure that the Opacity Blend Mode is set to Alpha Blend, and that Backface Culling is on. If this still doesn't work, you may need to separate the opaque material and the transparent material into two differnt materials so there are no conflicts between the two material types.

## 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.
