forward shadows shader

hi!

i need shadows in forward rendering.
so i added “fullforwardshadows” to the normal-BumpedSpec shader. but i get some errors.

Shader error in 'Forw_shad': Program 'frag_surf', Maximum texture indirection of 4 exceeded; 5 indirections needed to compile program at line 11
Shader warning in 'Forw_shad': Program 'frag_surf', implicit cast from "float3" to "float2" at line 52
Shader warning in 'Forw_shad': Program 'frag_surf', implicit cast from "float3" to "float2" at line 53
Shader warning in 'Forw_shad': Program 'frag_surf', implicit cast from "float3" to "float2" at line 54
Shader warning in 'Forw_shad': Program 'frag_surf', implicit cast from "float3" to "float2" at line 55

the shader:

Shader "Forw_shad" {
Properties {
	_Color ("Main Color", Color) = (1,1,1,1)
	_MainTex ("Base (RGB)", 2D) = "white" {}
	_BumpMap ("Normalmap", 2D) = "bump" {}
}

SubShader {
	Tags { "RenderType"="Opaque" }
	LOD 300

CGPROGRAM
#pragma surface surf Lambert fullforwardshadows

sampler2D _MainTex;
sampler2D _BumpMap;
fixed4 _Color;

struct Input {
	float2 uv_MainTex;
	float2 uv_BumpMap;
};

void surf (Input IN, inout SurfaceOutput o) {
	fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
	o.Albedo = c.rgb;
	o.Alpha = c.a;
	o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap));
}
ENDCG  
}

FallBack "Diffuse"
}

ty!

I think you’ll need to remove the uv_bumpmap entry in the struct or up the target to 3.0 with
#pragma target 3.0

#pragma target 3.0 <= that works
no SM2 support?

Does your shader work with SM2? the hardsurface one?

another problem with multiple lights.
looks like as if the second (left) light is wrong positioned?
…no problems with deferred

It is not in a wrong position, but it is ignored. Don’t know why they changed this (or of they even did it on purpose), but right now you only get one lights shadows in forward lighting.

so where does the right shadow come from?

it has the right “form” but should be far more on the left side : )

Looks like it applies it with offset to light0 not the light thats casting the shadow

right! how to fix that : /?

bump… bug?

did you tried other quallity settings? I guess you have just 1 pixel light source.