I don’t know why this shader wont compile. The error is in line where I try to set world position in posWorld.
Shader "Custom/Phong" {
Properties {
}
SubShader {
pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
struct Input
{
float4 pos : POSITION;
float3 n : NORMAL;
float2 tex : TEXCOORD0;
};
struct Output
{
float4 pos : SV_POSITION;
float4 posWorld : TEXCOORD0;
};
Output vert(Input i)
{
Output o;
o.pos = mul(UNITY_MATRIX_MVP, i.pos);
o.posWorld = mul(_Object2World, i.pos): // this line wont compile
return o;
}
float4 frag(Output i) : COLOR
{
return float4(1.0, 1.0, 1.0, 1.0);
}
ENDCG
}
}
FallBack "Diffuse"
}