PBRMaterial Albedo Color RGB in Playground Code Different than RGB Shown in Inspector and on Object

@YouJ All the PBR workflow (the computation) expects the colors to be in linear space, the problem being that when colors are authored you are working in sRGB space because of the computer screen you are working with => everything would be a lot easier if the monitor would work in linear space…

So, when you pick a color like (0.373, 0.008, 0.122) in your color picker, it is in sRGB space because you can’t do otherwise, it is displayed by your screen.

Now, in Babylon, the PBR colors you set must be in linear space for the material to work as intended. So, when you do:

plastic.albedoColor = new BABYLON.Color3(0.373, 0.008, 0.122);

You are giving a color in linear space and Babylon uses it as being in linear space.

But as you most probably chose this color from a color picker it is wrong, because (0.373, 0.008, 0.122) is in sRGB space then. You must convert it to linear space before passing it to Babylon.

To do that:

plastic.albedoColor = new BABYLON.Color3(0.373, 0.008, 0.122).toLinearSpace();

Now the color displayed by the sphere matches the color you picked from the color picker:

7 Likes