Ive written a clipping unlit surface shader for something Im working on. It works great except that I get that annoying “shader wants normals” error. I don’t use the normals. How can I tell shaderlab that they aren’t necessary for this shader?
just FYI, I found that the s.Albedo value in the lighting shader function was at double the correct intensity. i.e. //c.rgb = s.Albedo; //should be: c.rgb = s.Albedo*0.5f;
also, best way to write shader that doesn’t interact with lighting is to make a vertex/fragment shader, not surface.
also, in your shader you really interact with lighting - try to light your model by more than 1 light source and you’ll show over-lighting effect. so you can just ignore light function (return;) and write color to emission in frag method or use amient color instead.
In addition to use a NoLighting shader function, you might also like to add noforwardadd, so that point lights do not affect the albedo. The Emission control ignores forward add passes, so that is a workaround that accomplishes the same thing, except the additional pass still takes place with 0s in the Albedo, resulting in 0 in the additive output.
For anyone else that comes across this problem and is trying to make this work, the best solution that I found was to add a “noambient” pragma to @FlyingOstriche’s solution. This makes it so that the lighting function uses just the base colors as intended
This should provide a good look for an unlit material. The reason that the colors were blown out in earlier solutions was because the ambient light was being added to the final output after the lighting function. “noforwardadd” could also be used, though I doubt its very necessary.