Hi, I’m trying to achieve essentially the inverse of a diffuse shader. Lit areas are black, and unlit are white.
I attempted to modify the existing Mobile Diffuse shader with the hope of inverting a color value, but at 4,360 lines of code, i could not find the correct spot.
Also worth noting it will be used for iOS (OpenGL ES 2.0)

This is per-pixel so it’s not very efficient. it also requires a directional light. but it works.
It’s modified from http://en.wikibooks.org/wiki/GLSL_Programming/Unity/Diffuse_Reflection
The only change is on the definition of color at the end of the main() function which is the inverse of each color value.
Shader "RH/InvertDiffuse" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
}
SubShader {
Pass {
Tags { "LightMode" = "ForwardBase" } // make sure that all uniforms are correctly set
GLSLPROGRAM
uniform vec4 _Color; // shader property specified by users
// The following built-in uniforms are also defined in "UnityCG.glslinc",
// i.e. one could also #include "UnityCG.glslinc" (except _LightColor0)
uniform mat4 _Object2World; // model matrix
uniform mat4 _World2Object; // inverse model matrix
uniform vec4 _WorldSpaceLightPos0; // direction to or position of light source
uniform vec4 _LightColor0; // color of light source (from "Lighting.cginc")
varying vec4 color; // the diffuse lighting computed in the vertex shader
#ifdef VERTEX
void main()
{
mat4 modelMatrix = _Object2World;
mat4 modelMatrixInverse = _World2Object; // unity_Scale.w is unnecessary because we normalize vectors
vec3 normalDirection = normalize(vec3(vec4(gl_Normal, 0.0) * modelMatrixInverse));
vec3 lightDirection = normalize(vec3(_WorldSpaceLightPos0));
vec3 diffuseReflection = vec3(_LightColor0) * vec3(_Color)
* max(0.0, dot(normalDirection, lightDirection));
color = vec4(1.0-diffuseReflection.x,1.0-diffuseReflection.y,1.0-diffuseReflection.z, 1.0);
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}
#endif
#ifdef FRAGMENT
void main()
{
gl_FragColor = color;
}
#endif
ENDGLSL
}
}
// The definition of a fallback shader should be commented out during development:
// Fallback "Diffuse"
}
I believe you would get this effect by multiplying the normal’s x y and z values by -1, no?