Specular Map for custom shader?

Hi, I wrote a shader that uses Vertex Lit for specular. I need to add a specular map so some parts of the model will not have specular on it. Is there a snippet of code that I can drop into my script to add a Specular map? I have found a few scripts online, but they all incorporate other parts of a shader (like bump map, etc.) mixed in with the code, so I cannot figure out what part refers to specular mapping.

Thanks for the help in advance! :smiley:

You usually need this line in surface shader (BlinnPhong instead of Lambert):

#pragma surface surf BlinnPhong

And then these extra lines in the shader:

fixed4 specTex = tex2D(_SpecMap, IN.uv_SpecMap);
o.Gloss = specTex.r;
o.Specular = _Shininess * specTex.g;

Also search helps: Add specular map to shader - Unity Answers