Cycles base_color parameter BUG?

76 views
Skip to first unread message

aurora

unread,
Jan 21, 2023, 12:43:19 AM1/21/23
to gaffer-dev
I got a simple USD with a cube and a cycles bsdf shader assigned.
Shade "base_color" parameter set to a red color.
Shader load fine in Gaffer but on inspection I see no base_color parameter. On render cube  is the default 0.8 grey.

If a texture is assigned to the base color, cube renders textured... still can see the parameter.
ShaderQuery and ShaderTweaks cant see the parameter either.

Is this a bug?

Here is the usd file

A

Screenshot from 2023-01-20 21-31-19.png


aurora

unread,
Jan 21, 2023, 1:57:08 AM1/21/23
to gaffer-dev
Here is a USD file with texture connected to the base_color parameter:

simple_shader_with_texture.usda

aurora

unread,
Jan 21, 2023, 2:09:51 AM1/21/23
to gaffer-dev
Ah... I see where the problem may lay... its Blender not Gaffer.

Blender stores RGB and Alpha for color parameters:

float4 inputs:base_color = (0.53920454, 0.121217735, 0.5191846, 0.5191846)

Gaffer expects just RGB:

color3f inputs:base_color = (0.53920454, 0.121217735, 0.5191846)

¯\_(ツ)_/¯

A

John Haddon

unread,
Jan 23, 2023, 7:36:35 AM1/23/23
to gaffe...@googlegroups.com
On Sat, Jan 21, 2023 at 7:09 AM aurora <auro...@gmail.com> wrote:
Ah... I see where the problem may lay... its Blender not Gaffer.

Yep, this looks like a Blender export bug to me. In the Cycles source code it is clear that `base_color` is a `color` (RGB) and not a `float4` (RGBA). It also seems bogus that the alpha that Blender is writing out is just a copy of the B.

Regardless, I've opened a PR to fix the loading on the Gaffer side, since we should be able to load `float4` parameters, and there might be cases where they are legitimate : https://github.com/ImageEngine/cortex/pull/1327.

In the same Cycles source code, you can see that `BSDF` is capitalised, which is why Gaffer also gets upset about the lower case `bsdf` in the `simple_shader.usda` (but not by the upper case `BSDF` in the `simple_shader_with_texture.usda`. With the above fix and with the `BSDF` fixed, I am able to render your cube.

Is there some way we can get these bugs reported to the Blender team? There's a danger with USD that everyone ends up writing their own unique flavours, and ideally we'd have as few workarounds as possible for this sort of thing...

Cheers...
John


aurora

unread,
Jan 23, 2023, 9:33:02 AM1/23/23
to gaffer-dev
Thank you John. Wasn't expecting you to take action. I also think Blender export should be fixed instead. I actually started pocking the Blender guys for it. I really dont see the use of Alpha in color values like Base color or SSS color... even within Cycles.
Cheers!

aurora

unread,
Jan 23, 2023, 6:10:56 PM1/23/23
to gaffer-dev
Seems like Blender is working a new version of BSDF:
Reply all
Reply to author
Forward
0 new messages