TA/Unity2020. 7. 7. 11:33

// Pass to render object as a shadow caster

Pass{

Name "Caster"

Tags{ "LightMode" = "ShadowCaster" }

 

CGPROGRAM

#pragma vertex vert

#pragma fragment frag

#pragma target 2.0

#pragma multi_compile_shadowcaster

#pragma multi_compile_instancing // allow instanced shadow pass for most of the shaders

#include "UnityCG.cginc"

 

struct v2f {

V2F_SHADOW_CASTER;

float2  uv : TEXCOORD1;

UNITY_VERTEX_OUTPUT_STEREO

};

 

uniform fixed4 _MainTex_ST;

 

v2f vert(appdata_base v)

{

v2f o;

UNITY_SETUP_INSTANCE_ID(v);

UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);

TRANSFER_SHADOW_CASTER_NORMALOFFSET(o)

o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);

return o;

}

 

uniform sampler2D _MainTex;

uniform fixed _Cutoff;

 

 

float4 frag(v2f i) : SV_Target

{

fixed4 texcol = tex2D(_MainTex, i.uv);

clip(texcol.a - _Cutoff);

 

SHADOW_CASTER_FRAGMENT(i)

}

ENDCG

}

Posted by 프리랜서 디자이너