Transparency / Diffuse with Vertex Color + Lighting

So I’m trying to get a shader to work that will act like the default Transparent/Diffuse shader, which is able to be lit by point lights - but also support accepting a vertex color to change the tint.

This is so I can have multiple objects with the same material but vary the tints slightly, and still have them be affected by lighting.

Here is a shader that is transparent and has the Vertex color, but isn’t lit. Is it possible to modify this to be lit, or modify the Transparent/Diffuse shader to also accept vertex colors?

I’m very much a n00b with shader code.

Thanks!

Shader "Ferr/Unlit Transparent Textured Vertex Color" {
	Properties {
		_MainTex("Texture (RGBA)", 2D) = "white" {}
	}
	SubShader {
		Tags { "Queue"="Transparent" "RenderType"="Transparent"  }
		Blend SrcAlpha OneMinusSrcAlpha

		LOD 200
		
		Pass {
			CGPROGRAM
			#pragma vertex   vert
			#pragma fragment frag
			#include "UnityCG.cginc"

			sampler2D _MainTex;
			float4    _MainTex_ST;

			struct VS_OUT {
				float4 position : SV_POSITION;
				float4 color    : COLOR;
				float2 uv       : TEXCOORD0;
			};

			VS_OUT vert (appdata_full input) {
				VS_OUT result;
				result.position = mul (UNITY_MATRIX_MVP, input.vertex);
				result.uv       = TRANSFORM_TEX (input.texcoord, _MainTex);
				result.color    = input.color;

				return result;
			}

			half4 frag (VS_OUT input) : COLOR {
				half4 color = tex2D(_MainTex, input.uv);
				return color * input.color;
			}
			ENDCG
		}
	}
}

I’m not even sure if this is possible or practical, I’d like to be able to lighten/darken my 2d terrain layers, but still accept normal lighting. I suppose I can create an instance of each material at runtime and modify the colors, or just create separate materials for each shade, but then I won’t be able to batch them.

Would a custom shader solve any of this, or is a vertex colored shader that accepts normal lighting simply not possible?

Thanks,
Jesse

Take a look at this page which implements a shader that handles multiple light sources:

http://en.wikibooks.org/wiki/Cg_Programming/Unity/Multiple_Lights

It should have the information you need. Also you can change the brightness of a texture by modifying the final calculated color for each pixel (like double it for brightness or half it to darken it).