Input values for Specular Standard Shader?

Hallo everyone,

I just want to make sure I understand which input values the Standard (Specular) shader expects when in Linear Rendering mode.

As an example, say I want to make a surface’s specular reflectance 50% at facing angle. If I were to use a constant color with the “Specular” color swatch, I would set it to RGB 128 128 128.

What surprises me is that when I author that very same color (RGB 128 128 128) as a texture in Photoshop and feed that into the shader, the result is identical.

I always assumed that Unity would linearize all sRGB textures. So in my case I thought Unity would degamma the texture color to RGB 56 56 56 and shade with that, making the surface in effect about 22% reflective. At least this is how I am used to working with offline renderers like V-Ray and mental ray. These linearize all texture inputs that are assumed to have been authored perceptually in sRGB space.

Can someone explain this Unity behaviour to me?

That very same question also goes for the Smoothness channel. Same thing there.

Last, but not least I found that even setting the Specular value to black doesn’t completely disable specular reflections. Is this the correct intended behaviour? If so, why? Because it’s physically correct?

Thanks a lot for any help!

Sean

Anyone?

The value in the color picker is handled in the same way as textures; they’re converted via sRGB from 128 to ~0.22 when passed to the shader. Even the metallic slider value is gamma corrected.

The glossiness / smoothness value slider isn’t gamma corrected, but it’s also stored in the alpha channel of the metallic texture and alpha isn’t affected by sRGB.

I think it’s an intended part of the physically based shading, but I havent yet yet tracked down where exactly it’s happening. It could be an artifact of something trying to prevent a divide by zero someplace, but really even chalk dust has a little specular.

1 Like

bgolus, thanks a lot for your input! That makes things clearer for me!

Strange, that even the Metallic channel is being linearized. I guess the Unity developers assumed that Metallic textures would typically be authored perceptually and not numerically by the artist, meaning that if an artist wanted to make some part a surface 50% metallic, he wouldn’t go into the color picker in Photoshop and set it manually to 128 128 128, but would choose a color that looked 50% to him. In the latter case, texture linearization would indeed be required.
I always thought people would author a Metallic texture numerically.

Anyhow, thanks again!

I think the expectations is that artists are going to select random numbers until they get something that looks like what they want rather than knowing they want something that’s 50% metal (which is something that doesn’t really exist in the real world), or that artists are using color swatches provided to them by their tech artists (which is how many AAA studios operate). Unity even includes some basic swatches as images in their documentation.

Yes, I guess that’s how most artists proceed.

It’s just not very intuitive and consistent to linearize the Metallic slot and not the Smoothness slot. Both are percentage values.