Ambient lighting and Built-in Reflective Shaders

It seems like the built-in reflective shaders don’t take into account ambient lighting. I’m curious if there’s a specific reason this isn’t done by default. Seems like ambient should always be assumed part of the lighting calculation.

I rewrote the Reflective Diffuse shader to this, and this gives the desired effect:

Shader "Reflective/Diffuse With Ambient" {
	Properties {
		_Color ("Main Color", Color) = (1,1,1,1)
		_ReflectColor ("Reflection Color", Color) = (1,1,1,0.5)
		_MainTex ("Base (RGB) RefStrength (A)", 2D) = "white" {} 
		_Cube ("Reflection Cubemap", Cube) = "_Skybox" { TexGen CubeReflect }
	}
	SubShader {
		LOD 200
		Tags { "RenderType"="Opaque" }
		Pass {
			Blend AppSrcAdd AppDstAdd
			Tags {"LightMode" = "PixelOrNone"}
			Color [_PPLAmbient]
			SetTexture [_MainTex] {constantColor [_Color] Combine texture * primary DOUBLE, constant}
		}
		UsePass "Reflective/VertexLit/BASE"
		UsePass "Diffuse/PPL"
	} 
	FallBack "Reflective/VertexLit", 1
}

Edit: Killed the main texture alpha influencing the alpha component of the ambient pass.

I’ve noticed this, too. I assumed it was because environment maps are supposed to include ambient light. Either version could be useful, depending on your plans.

The environment map isn’t used for any lighting calculation though. It’s just added to the Vertex or Diffuse Lighting. The problem is that there needs to be an ambient pass that samples the materials main texture, otherwise anywhere the material isn’t lit it’ll just show 100% reflection (well somewhere between black and 100% reflection depending on the reflection strength) and none of the main texture.

Good point. That does seem like an oversight, then.