Albedo Hash color code use

I’m trying to use hash code in albedo but it doesn’t work.
can anyone tells me what the attribute is used for hashcode in albedo instead of using color rgb

  let pushButton = scene.getMaterialByName('Button');
  // pushButton.albedoColor = new BABYLON.Color3(211/255, 63/255, 5/255);

when i put this color code it changes the orginal value to another value why???

Depending on which you want.

RGB:

Hex:

but my issue is when i use this color code

pushButton.albedoColor = new BABYLON.Color3(211/255, 63/255, 5/255);

and when i debug the code, i found other color code applies on that material.
i’m not getting this color code in albedo rgb (211,63,5)

You probably have to convert this to linear space to get the result you are expecting. By default these colors are in gamma space if I am not mistaken.

pushButton.albedoColor = new BABYLON.Color3(211/255, 63/255, 5/255).toLinearSpace()

If you want to use FromHexColor method, you would have to convert it as well.

pushButton.albedoColor = BABYLON.Color3.FromHexString(“hexcode”).toLinearSpace()

2 Likes

@nogalo thanks it works

1 Like