Unity 4 shader error

Hey guys, I am currently working on a bunch of shaders and there is one thing I have not been able to work out.
When dealing with directional lights I use:

float3 directionalPos = mul(_World2Object, _WorldSpaceLightPos0).xyz;
output.lightDirection = mul(rotation, directionalPos);

and when using point lights:
float3 pointPos = float3(_WorldSpaceLightPos0 - mul(_Object2World, input.vertex).xyz);
output.lightDirection = mul(rotation, pointPos);

This works perfectly fine on my netbook which is locked to shader model 1, but on my main computer the point lights throw the errors:

Shader warning in ‘Custom/normalTest’: Program ‘vert’, incorrect number of arguments to numeric-type constructor (compiling for d3d11) at line 33
Shader warning in ‘Custom/normalTest’: No subshaders can run on this graphics card

Removing mul(_Object2World, input.vertex).xyz); removed the problem but then my point lights will not work.

I’ve spent a good few days trying to solve this and am a little lost, Does anyone have any idea as to the problem? or if you have a sample non surface shader that works with dx11 mode I can figure it out from there.

Much appreciated, here is the the current testing code:

Shader "Custom/normalTest" {
    Properties {
        _MainTex ("Base (RGB)", 2D) = "white" {}
        _BumpMap ("Bump", 2D) = "bump" {}
        _Color ("Diffuse Material Color", Color) = (1,1,1,1) 
    }
    SubShader {
        Tags { "RenderType"="Opaque"  }
        LOD 200
 
        Pass {
 			Tags { "LightMode" = "ForwardBase" }  //for first light
 
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
 			
         	uniform float4 _Color;
            uniform float4 _LightColor0; //only variable not built in
 
            sampler2D _MainTex;
            sampler2D _BumpMap;
            float4 _MainTex_ST; //_ST for tiling
            float4 _BumpMap_ST;
 
            struct vertexInput
            {
                float4 vertex : POSITION;
                float3 normal : NORMAL;
                float4 texcoord : TEXCOORD0;
                float4 tangent : TANGENT;
 
            }; 
 
            struct vertexOutput
            {
                float4 pos : POSITION;
                float4 tex : TEXCOORD0;
				float4 posWorld : TEXCOORD2;
				float3 lightDirection : TEXCOORD3;
 
            };
 
            vertexOutput vert (vertexInput input)
            {
				
				vertexOutput output;
                float3 binormal = cross( input.normal, input.tangent.xyz ) * input.tangent.w; //calculate binormal (perpendicular to tangent)
				float3x3 rotation = float3x3( input.tangent.xyz, binormal, input.normal ); //convert objectspace to screenspace
				float3 directionalPos = mul(_World2Object, _WorldSpaceLightPos0).xyz; //object space position of dir light
				
				//comment out this line for working shader, but require for point lights
        		float3 pointPos  = float3(_WorldSpaceLightPos0 - mul(_Object2World, input.vertex).xyz);//object space position of point light
				
				//lerp commented out for working shader
				//float3 objSpaceLightPos = float3(lerp(directionalPos.xyz,pointPos.xyz,_WorldSpaceLightPos0.w));//determine which light to use (directional.w=0)
				
                output.lightDirection = mul(rotation, pointPos); //pointPos for point, directionalPos for directional lights
                output.pos = mul( UNITY_MATRIX_MVP, input.vertex); 
                output.tex = input.texcoord;  
                return output;
            }
 
            float4 frag(vertexOutput input) : COLOR  
            { 
                float4 c = tex2D (_MainTex,  _MainTex_ST.xy * input.tex.xy + _MainTex_ST.zw);  
                
                float4 n =  tex2D (_BumpMap, _BumpMap_ST.xy * input.tex.xy + _BumpMap_ST.zw); 
				fixed3 unpackedNormal;
				unpackedNormal.xy = n.wy * 2 - 1;
				unpackedNormal.z = sqrt(1 - unpackedNormal.x*unpackedNormal.x - unpackedNormal.y * unpackedNormal.y);
 
                float3 lightColor = UNITY_LIGHTMODEL_AMBIENT.xyz;
 
                float diff = saturate (dot (unpackedNormal, normalize(input.lightDirection)));   
                lightColor += _LightColor0.rgb * (diff); 
                c.rgb = lightColor * c.rgb * 2;
                return c;
 
            } 
 
            ENDCG
        }
    }
   //FallBack "Diffuse"
    }

Thanks for any assistance :slight_smile:

incorrect number of arguments to numeric-type constructor
This means that you are converting from float4 to float3 without specifying which variables to keep.
For example: float3(_WorldSpaceLightPos0.xyz) will work because we tell unity to drop the w component.
It’s something that comes up when writing shaders for directX 11
Also make sure you update to the latest version of unity.