So I recently decided to rewrite some of my shader code because the objects were weren’t working correctly and some post effects such as AO we’re being applied to the object. To do this I started afresh with a new surface shader and then began adding in code to bring the standard shader inline with my old custom shader.
Unfortuantely in the last step it broke. The effect I’m trying to replicate is to make all back faces an unlit white, so that when the object is cut in half it doesn’t appear hollow. To do this I simply create a custom lighting function that simply returns white (or in this case _OutlineColor, which is currently white). I then change the pragma line to use my Custom lighting rather than Standard lighting, however upon doing so the backfaces are no longer visible.
In the images below the object on the left (blue) is using the old shader, and the object on the right (red) is using the new shader.
Standard Lighting vs. Custom Lighting (the blue light is from the object that cuts the boxes in half).
Here is the shader code: New, Old. (Don’t worry about the second pass or the code within the main pass that discards pixels, I know this isn’t affecting the shader because I tried removing that code and the shader still didn’t work.
The first pass of both shaders is where the back faces are drawn - the second pass works fine.
Does anyone have any idea what’s wrong? (note this is deferred lighting)