It’s my understanding that surface shaders should use the ambient light color from Edit->Render
Settings unless you explicitly use the “noambient” keyword. However, I’ve run into the following problem:
- I set up an empty scene with 2 cubes in front of the camera. No lights.
- I assign a different material to each cube. Left cube’s material uses the standard Unity diffuse shader. No texture.
- I use a basic custom shader for the right cube’s material that simply outputs a color. I set that color as white.
- I ramp the ambient color to pure red. As expected, the left cube paints in red, since there are no other lights. The right cube using my custom shader paints in black.
This is my shader:
Shader "Custom/TestShader" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf Lambert
sampler2D _MainTex;
fixed4 _Color;
struct Input {
float2 uv_MainTex;
};
void surf (Input IN, inout SurfaceOutput o) {
o.Albedo = _Color.rgb;
o.Alpha = _Color.a;
}
ENDCG
}
FallBack "Diffuse"
}
Is there something else I’m missing?