forked from BilalY/Rasagar
58 lines
1.1 KiB
Plaintext
58 lines
1.1 KiB
Plaintext
|
// Shadow pass
|
||
|
Pass
|
||
|
{
|
||
|
Name ${VFXPassShadow}
|
||
|
Tags { "LightMode"=${VFXPassShadow} }
|
||
|
|
||
|
ZClip [_ZClip]
|
||
|
ZWrite On
|
||
|
Blend Off
|
||
|
|
||
|
HLSLPROGRAM
|
||
|
#pragma target 4.5
|
||
|
|
||
|
struct ps_input
|
||
|
{
|
||
|
SV_POSITION_QUALIFIERS float4 pos : SV_POSITION;
|
||
|
float2 uv : TEXCOORD0;
|
||
|
float3 posWS : TEXCOORD1;
|
||
|
float4 sphereInfo : TEXCOORD2;
|
||
|
|
||
|
UNITY_VERTEX_OUTPUT_STEREO
|
||
|
|
||
|
VFX_VERTEX_OUTPUT_INSTANCE_INDEX
|
||
|
};
|
||
|
|
||
|
struct ps_output
|
||
|
{
|
||
|
float depth : DEPTH_OFFSET_SEMANTIC;
|
||
|
};
|
||
|
|
||
|
#define VFX_VARYING_PS_INPUTS ps_input
|
||
|
#define VFX_VARYING_POSCS pos
|
||
|
#define VFX_VARYING_UV uv
|
||
|
#define VFX_VARYING_POSWS posWS
|
||
|
#define VFX_VARYING_SPHERECENTER sphereInfo.xyz
|
||
|
#define VFX_VARYING_SPHERERADIUS sphereInfo.w
|
||
|
|
||
|
${VFXBegin:VFXVertexAdditionalProcess}
|
||
|
float3 posWS = TransformPositionVFXToWorld(vPos);
|
||
|
VFXApplyShadowBias(o.VFX_VARYING_POSCS, posWS);
|
||
|
${VFXEnd}
|
||
|
|
||
|
${VFXPassShadowDefine}
|
||
|
${VFXInclude("Shaders/ParticleSpheres/Pass.template")}
|
||
|
|
||
|
#pragma fragment frag
|
||
|
ps_output frag(ps_input i)
|
||
|
{
|
||
|
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
||
|
VFXTransformPSInputs(i);
|
||
|
ps_output o = (ps_output)0;
|
||
|
float3 dummy;
|
||
|
VFXClipSphereAndGetDepthOffsetAndNormal(o.depth,dummy,i);
|
||
|
return o;
|
||
|
}
|
||
|
ENDHLSL
|
||
|
}
|