Still see reflections when Smoothness & Metallic set to 0

I am just playing around with the basic Unity shader but I can’t get it to completely turn of reflections. If Smoothness and Metallic are set to 0 I would expect to see no reflections at all in the sphere but yet I do, how does one stop that?

Shader "Custom/Test" {
    Properties {
        _Color ("Color", Color) = (1,1,1,1)
        _MainTex ("Albedo (RGB)", 2D) = "white" {}
        _Glossiness ("Smoothness", Range(0,1)) = 0.5
        _Metallic ("Metallic", Range(0,1)) = 0.0
    }
    SubShader {
        Tags { "RenderType"="Opaque" }
        LOD 200

        CGPROGRAM
        // Physically based Standard lighting model, and enable shadows on all light types
        #pragma surface surf Standard fullforwardshadows

        // Use shader model 3.0 target, to get nicer looking lighting
        #pragma target 3.0

        sampler2D _MainTex;

        struct Input {
            float2 uv_MainTex;
        };

        half _Glossiness;
        half _Metallic;
        fixed4 _Color;

        // Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
        // See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
        // #pragma instancing_options assumeuniformscaling
        UNITY_INSTANCING_BUFFER_START(Props)
            // put more per-instance properties here
        UNITY_INSTANCING_BUFFER_END(Props)

        void surf (Input IN, inout SurfaceOutputStandard o) {
            // Albedo comes from a texture tinted by color
            fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
            o.Albedo = c.rgb;
            // Metallic and smoothness come from slider variables
            o.Metallic = 0;    // _Metallic;
            o.Smoothness = 0;    // _Glossiness;
            o.Alpha = c.a;
        }
        ENDCG
    }
    FallBack "Diffuse"
}

The shader above gives this result:

The GGX specular model unity uses clamps the smoothness at a minimum value, so you’d have to use an alternate lighting model.

A metallic of zero does not mean zero specular, it means a specular color of RGB 56, 56, 56. If you want to remove reflections entirely, use the StandardSpecular lighting model and use a specular color of RGB 0, 0, 0.

Do you know why they clamped it at this minimum value rather than just having a metallic of 56/255 be the current result?

The specular color isn’t “clamped”. Metallic in the default metallic setup Standard material is just a lerp factor used for determining the albedo and specular colors from the diffuse texture. Full metallic means use the diffuse texture’s color as the specular color, and black for albedo. A metallic of zero means use the default average specularity for real world dielectric (non-metal) materials, which is roughly 56/255 in gamma space.

1 Like

So physically correct, but not really what people sometimes want when they set smoothness and metallic to 0, which is no specular response what so ever. (This comes up a lot for people with terrain shaders).

Physically correct*, but doesn’t account for macro scale self occlusion / reflection shadowing which makes everything look like it’s glowing where you’re not using screen space reflections unless you have a lot of localized reflection probes. This is especially problematic for terrain and forward rendering since usually it’s one probe for the entire terrain, hence the need to crush the specular.

  • ish.