Unity-Technologies/usd-unity-sdk

On import, roughness is hard coded to read from the R texture channel (USDU-223)

jcowles opened this issue · 2 comments

The roughness value in a texture can be declared in USD to come from any channel, for example, in this asset it comes from the alpha channel:
image

However, the roughness combiner shader is hard coded to only read from the R channel:
image

The issue is in CombineAndConverRoughness.shader and the CombineRoughness C# function.

Repro case (rename to .usdz):
test-roughness.usdz.zip

This is the expected output - the top text should have roughness 0.0, next 0.3, next 0.6. The bottom three text lines have the same roughness, but set as constants.

Note that the .tga is sRGB gamma encoded to 2.2, so when decoded to linear space, the values should be 0.0, 0.3 and 0.6.

There's actually two bugs here:

  1. The texture is not packed correctly
  2. Because this test asset uses multiple channels from a single texture, we should get 3 roughness textures in Unity, but instead we only get 1

Problem 1:
image

Problem 2:
image