
各頂点のx座標を3、y座標を3増やすような頂点シェーダを書いてみます。
おまじないを省いたコード
Shader "Custom/MyVertexShader3" {
v.vertex.x += 3;
v.vertex.z += 3;
}
おまじないを含んだコード
Shader "Custom/MyVertexShader3" {
Properties {
_DiffuseColor("Diffuse Color", Color) = (1.0, 1.0, 1.0)
}
SubShader {
Tags { "RenderType"="Opaque" }
CGPROGRAM
#pragma surface surf Lambert vertex:vert
struct Input {
float4 color: COLOR;
};
float3 _DiffuseColor;
void vert(inout appdata_full v) {
v.vertex.x += 3;
v.vertex.z += 3;
}
void surf(Input IN, inout SurfaceOutput o) {
o.Albedo = _DiffuseColor;
}
ENDCG
}
FallBack "Diffuse"
}