                 // Lambertian reflectance.
                 const float3 lightCol = _LightColor0.rgb * LIGHT_ATTENUATION(i);
                 const float nDotL = saturate(dot(normal, lightDir));
+
 #if defined(_DIFFUSEMODE_SQURED_HALF_LEMBERT)
                 const float3 diffuse = lightCol * sq(nDotL * 0.5 + 0.5);
 #elif defined(_DIFFUSEMODE_HALF_LEMBERT)
                 const float3 diffuse = lightCol * (nDotL * 0.5 + 0.5);
-#else
+#elif defined(_DIFFUSEMODE_LEMBERT)
                 const float3 diffuse = lightCol * nDotL;
+#else
+                const float3 diffuse = float3(1.0, 1.0, 1.0);
 #endif  // defined(_DIFFUSEMODE_SQURED_HALF_LEMBERT)
 
                 // Specular reflection.
 #ifdef _SPECULARMODE_HALF_VECTOR
                 const float3 specular = pow(max(0.0, dot(normalize(lightDir + viewDir), normal)), _SpecularPower) * _SpecularColor.xyz * lightCol;
-#else
+#elif _SPECULARMODE_ORIGINAL
                 const float3 specular = pow(max(0.0, dot(reflect(-lightDir, normal), viewDir)), _SpecularPower) * _SpecularColor.xyz * lightCol;
+#else
+                const float3 specular = float3(0.0, 0.0, 0.0);
 #endif  // _SPECULARMODE_HALF_VECTOR
 
                 // Ambient color.
 #ifdef _AMBIENTMODE_SH9
-                const float3 ambient = ShadeSH9(half4(normal, 1.0));
-#else
+                const float3 ambient = ShadeSH9(half4(UnityObjectToWorldNormal(normal), 1.0));
+#elif _AMBIENTMODE_LEGACY
                 const float3 ambient = UNITY_LIGHTMODEL_AMBIENT.rgb;
+#else
+                const float3 ambient = float3(0.0, 0.0, 0.0);
 #endif  // _AMBIENTMODE_SH9
 
 #ifdef _ENABLE_REFLECTION_PROBE
-                const half3 refDir = UnityObjectToWorldNormal(reflect(-viewDir, normal));
-                const half4 refColor = getRefProbeColor(refDir);
+                const half4 refColor = getRefProbeColor(UnityObjectToWorldNormal(reflect(-viewDir, normal)));
                 const float4 col = float4((diffuse + ambient) * lerp(_Color.rgb, refColor.rgb, _RefProbeBlendCoeff) + specular, _Color.a);
 #else
                 // Output color.

             * @param [in] p  Position of the tip of the ray.
             * @return Signed Distance to the objects.
             */
            float dist(float3 p)
            {
                return sdSphere(p, 0.5);
            }

                static const float2 kh = k * 0.0001;

                return normalize(
                    k.xyy * sdf(p + kh.xyy)
                        + k.yyx * sdf(p + kh.yyx)
                        + k.yxy * sdf(p + kh.yxy)
                        + k.xxx * sdf(p + kh.xxx));

#else
                // Naive normal calculation.
