0
$\begingroup$

I'm looking to export a GLB from Blender to eventually upload into Unity. Unity reads the materials very differently than Blender exports it. Unity wants the textures to be packed into specific channels, Metallic in RED, Smoothness in the ALPHA etc. but when I export my model as a GLB from Blender it automatically creates a "Separate RGB" node and assigns the Metallic into the Blue channel and the roughness into the Green channel. This won't look right in Unity, how do I go about overriding this so that I can pack the textures myself? I do use Substance Painter and can use the preset "Unity Universal Render Pipeline (Metallic Standard)" which works perfectly but again Blender will override my setup and mix things around. Thanks in advance!

$\endgroup$
1
  • $\begingroup$ Can you solve it with a Swizzle Node in Unity's Shader Graph? $\endgroup$ Sep 29 at 0:16
0
$\begingroup$

Blender glTF exporter adhere to glTF standard, and stores in the red channel whatever texture you connect to a custom node group that has to be named "glTF Settings" with an input named "Occlusion"; in the green channel whatever texture plugged into the roughness input of a BSDF Shader; in the blue channel whatever texture plugged into the metallic input of the BSDF Shader.

So you can Hack this setup forcing it to save your textures in a way that Unity will adopt correctly (i.e. plug your metallic texture into the occlusion custom node group).

Another way is to use the compositor to import the generated glTF texture, swap its channels as desired and save the swapped image to overwrite the texture. Probably you will have to invert the roughness to smoothness.

Don't forget to use "NonColor" texture node color space and a straight unpremultiplied alpha channel (like PNG RGBA does).

https://docs.blender.org/manual/en/latest/addons/import_export/scene_gltf2.html?highlight=gltf

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.