影 - saitocastel1900/UnityShader GitHub Wiki

  • コンパイラとマクロを指定するだけでOK
Shader "Unlit/ShadeUnlitShader"
{
    Properties
    {
        _MainColor ("Main Color", Color) = (1,1,1,1)
        _DiffuseShader ("Diffuse Shader", Range(0,1)) = 0.5
    }
    SubShader
    {
        Pass {}
        Pass
        {
            Tags
            {
                "LightMode"="ShadowCaster"
            }
            LOD 100

            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            #pragma multi_compile_shadowcaster

            #include "UnityCG.cginc"

            struct v2f
            {
                V2F_SHADOW_CASTER;
            };

            v2f vert(appdata_base v)
            {
                v2f o;

                TRANSFER_SHADOW_CASTER_NORMALOFFSET(o);
                return o;
            }

            fixed4 frag(v2f i) : SV_Target
            {
                SHADOW_CASTER_FRAGMENT(i)
            }
            ENDCG
        }
    }
}

キャプチャ