Here is the barebones shader I started with:
Shader "OMD/_Good"
{
Properties
{
_MainTexture("Main map", 2D) = "gray" {}
}
SubShader
{
Pass
{
Tags
{
"Queue"="Transparent"
"IgnoreProjector"="True"
"RenderType"="Transparent"
}
Blend SrcAlpha One
AlphaTest Greater .01
ColorMask RGB
Cull Off
Lighting Off
ZWrite Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma fragmentoption ARB_precision_hint_fastest
#pragma target 3.0
#pragma multi_compile_particles
#include "UnityCG.cginc"
sampler2D _MainTexture;
float4 _MainTexture_ST;
struct vertexToFragment
{
float4 vertex : POSITION;
float4 color : COLOR;
float2 texcoord : TEXCOORD0;
};
vertexToFragment vert (vertexToFragment v)
{
vertexToFragment o;
o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
o.color = v.color;
o.texcoord = TRANSFORM_TEX(v.texcoord,_MainTexture);
return o;
}
fixed4 frag (vertexToFragment i) : COLOR
{
return float4(1.0,1.0,1.0,1.0);
}
ENDCG
}
}
SubShader
{
Pass
{
}
}
}
Then I realized that I’ll need normals which are apparently available in
that “appdata_full” thing. After looking at a few examples I tried to incorporate
it into the shader above:
struct vertexToFragment
{
float3 worldNormal;
float4 vertexColor;
float3 worldPos;
};
void vert (inout appdata_full a, out vertexToFragment v)
{
v.worldNormal = mul( _Object2World, float4( a.normal, 0.0 ) ).xyz;
v.vertexColor = a.color;
v.worldPos = a.vertex.xyz;
}
The result is a shader compile error:
What does this mean and how could I fix it?