glTF-Blender-IO icon indicating copy to clipboard operation
glTF-Blender-IO copied to clipboard

RoughnessFactor not being generated during export

Open j-conrad opened this issue 2 years ago • 2 comments

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:

  1. Open the included .blend
  2. Look at the Shader Editor (confirm the material setup is sound)
  3. Export the scene as a .glTF
  4. 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 image

.blend file/ .gltf Attached below.

Version

  • OS: Windows 11
  • Blender Version: Release 3.1.2
  • Exporter Version: 1.8.19

RoughnessFactor_Earth.zip

j-conrad avatar May 26 '22 23:05 j-conrad

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.

scurest avatar May 27 '22 03:05 scurest

So, no issue here. Tagging as documentation, this may need an update, or additionnal explaination about factors (scalar/color)

julienduroure avatar May 27 '22 07:05 julienduroure