Standard shader with halfLambert lighting.

How can I use halfLambert lighting (or any custom lighting) while also being able to still use the smoothness and metallic properties?

When I implement a custom lighting model for this using a simple surface shader, I can’t use smoothness and metallic anymore. Is there any way to add them to the lighting model?

Solved it by going through the builtin shader source code. Put the code below in a .cginc file (for example standardShader.cginc), include the file in a surface shader and change the lighting model to Standard1 like so:

#include "standardShader.cginc"

#pragma surface surf Standard1 fullforwardshadows
#pragma target 3.0

Include file:

#include "UnityPBSLighting.cginc"

half4 UNITY_BRDF_PBS1(half3 diffColor, half3 specColor, half oneMinusReflectivity, half smoothness, float3 normal, float3 viewDir, UnityLight light, UnityIndirect gi)
{
    float perceptualRoughness = SmoothnessToPerceptualRoughness(smoothness);
    float3 halfDir = Unity_SafeNormalize(float3(light.dir) + viewDir);

    half nv = abs(dot(normal, viewDir));
    float nl = nv; // saturate(dot(normal, light.dir));
    float nh = saturate(dot(normal, halfDir));
    half lh = saturate(dot(light.dir, halfDir));

    half diffuseTerm = DisneyDiffuse(nv, nl, lh, perceptualRoughness) * nl;
    float roughness = PerceptualRoughnessToRoughness(perceptualRoughness);

    roughness = max(roughness, 0.002);

    float V = SmithJointGGXVisibilityTerm(nl, nv, roughness);
    float D = GGXTerm(nh, roughness);
    float specularTerm = V * D * UNITY_PI;

    specularTerm = max(0, specularTerm * nl);

    half surfaceReduction;

    surfaceReduction = 1.0 / (roughness * roughness + 1.0);

    specularTerm *= any(specColor) ? 1.0 : 0.0;

    half grazingTerm = saturate(smoothness + (1 - oneMinusReflectivity));
    half3 color = diffColor * (gi.diffuse + light.color * diffuseTerm)
        + specularTerm * light.color * FresnelTerm(specColor, lh)
        + surfaceReduction * gi.specular * FresnelLerp(specColor, grazingTerm, nv);

    return half4(color, 1);
}

inline half4 LightingStandard1(SurfaceOutputStandard s, float3 viewDir, UnityGI gi)
{
    s.Normal = normalize(s.Normal);

    half oneMinusReflectivity;
    half3 specColor;

    s.Albedo = DiffuseAndSpecularFromMetallic(s.Albedo, s.Metallic, specColor, oneMinusReflectivity);

    half outputAlpha;

    s.Albedo = PreMultiplyAlpha(s.Albedo, s.Alpha, oneMinusReflectivity, /*out*/ outputAlpha);

    half4 c = UNITY_BRDF_PBS1(s.Albedo, specColor, oneMinusReflectivity, s.Smoothness, s.Normal, viewDir, gi.light, gi.indirect);

    c.a = outputAlpha;

    return c;
}

inline void LightingStandard1_GI(SurfaceOutputStandard s, UnityGIInput data, inout UnityGI gi)
{
    Unity_GlossyEnvironmentData g = UnityGlossyEnvironmentSetup(s.Smoothness, data.worldViewDir, s.Normal, lerp(unity_ColorSpaceDielectricSpec.rgb, s.Albedo, s.Metallic));
    gi = UnityGlobalIllumination(data, s.Occlusion, s.Normal, g);
}