glTF-Blender-IO
glTF-Blender-IO copied to clipboard
RoughnessFactor not being generated during export
When setting up a material with a Roughness texture connected to a MixRGB node (multiplying by a color value), the resulting export has no RoughnessFactor defined.
To Reproduce Steps to reproduce the behavior:
- Open the included .blend
- Look at the Shader Editor (confirm the material setup is sound)
- Export the scene as a .glTF
- Open the resulting .glTF and observe the lack of RoughnessFactor. The ocean part of the sphere should appear slightly glossy, as opposed to the matte finish it would have without the MixRGB node. Instead, it remains matte.
Expected behavior According to the Blender manual, the MixRGB node set to Multiply should generate a RoughnessFactor.
Screenshots
.blend file/ .gltf Attached below.
Version
- OS: Windows 11
- Blender Version: Release 3.1.2
- Exporter Version: 1.8.19
Roughness is a scalar, so the exporter is expecting scalar multiplication: a Math node (Add > Converter > Math) set to Multiply. Use this instead (note the value is 0.35).
Also even if you were doing a color, the exporter expects a MixRGB node set to Multiply with a Fac of 1 (although it doesn't actually check that). The factor should go in the other socket.
(About your setup: Fac is a lerp factor between Color1
and Color1 * Color2
. In general this is not a product unless Fac=1, but in your case since Color2=0, it's lerp(Color1, 0, Fac) = (1-Fac)*Color1
, so it is actually equivalent to multiplying by 0.35.)
The manual should be updated.
So, no issue here. Tagging as documentation, this may need an update, or additionnal explaination about factors (scalar/color)