Reproduce SpatialMaterial color in ShaderMaterial

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Aelios25

I noticed that if you create a SpatialMaterial with a given albedo color, and a ShaderMaterial with the same albedo in the fragment function, objects colors are not exactly the same, as you can see in the screenshoot below.

Colors not matching

In this picture, both SpatialMaterial (left) aldebo and ShaderMaterial (right) aldebo are set to (0.5, 0.5, 0) with alpha set to 1.

Which others parameters should be set in the shader to reproduce exactly the same color, that I am missing ?

:bust_in_silhouette: Reply From: Fgico

Might be specularity or roughness I’m not sure
but you can convert an extisting spatial material to a shader through the material dropdown menu and see it for yourself or use that as a starting point to write your custom shader if that’s what you need

Nice tip, thanks. Adding the color as a hint_color shader param did the trick.

Aelios25 | 2020-12-20 16:45