【Unity】Surface + Vertex Shader
Surface Shader の頂点処理を差し込む場合は pragma の最後に指定してやれば良い
#pragma surface surf Lambert vertex:vert
Shader "SurfaceVert"
{
Properties
{
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
}
SubShader
{
Tags { "RenderType"="Opaque" }
CGPROGRAM
#pragma surface surf Lambert vertex:vert
struct Input
{
float2 uv_MainTex;
};
sampler2D _MainTex;
half _Glossiness;
half _Metallic;
fixed4 _Color;
void vert (inout appdata_full v)
{
// 頂点処理
}
void surf (Input IN, inout SurfaceOutput o)
{
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
o.Metallic = _Metallic;
o.Smoothness = _Glossiness;
o.Alpha = c.a;
}
ENDCG
}
}