You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
1.8 KiB
71 lines
1.8 KiB
#pragma target 4.5
|
|
#define UNITY_MATERIAL_LIT
|
|
#pragma multi_compile _ WRITE_NORMAL_BUFFER
|
|
|
|
struct ps_input
|
|
{
|
|
SV_POSITION_QUALIFIERS float4 pos : SV_POSITION;
|
|
float2 uv : TEXCOORD1;
|
|
float4 posWS : TEXCOORD2;
|
|
float4 sphereInfo : TEXCOORD3;
|
|
|
|
UNITY_VERTEX_OUTPUT_STEREO
|
|
|
|
VFX_VERTEX_OUTPUT_INSTANCE_INDEX
|
|
};
|
|
|
|
#define VFX_VARYING_PS_INPUTS ps_input
|
|
#define VFX_VARYING_POSCS pos
|
|
#define VFX_VARYING_UV uv
|
|
#define VFX_VARYING_POSWS posWS.xyz
|
|
#define VFX_VARYING_SPHERECENTER sphereInfo.xyz
|
|
#define VFX_VARYING_SPHERERADIUS sphereInfo.w
|
|
|
|
#ifdef WRITE_NORMAL_BUFFER
|
|
#define VFX_VARYING_SMOOTHNESS posWS.w
|
|
#endif
|
|
|
|
${VFXBegin:VFXVertexAdditionalProcess}
|
|
${VFXHDRPLitFillVaryings}
|
|
${VFXEnd}
|
|
|
|
${VFXInclude("Shaders/ParticleSpheres/Pass.template")}
|
|
#define SHADERPASS SHADERPASS_DEPTH_ONLY
|
|
${VFXIncludeRP("VFXLit.template")}
|
|
|
|
#if VFX_PASSDEPTH == VFX_PASSDEPTH_SELECTION
|
|
int _ObjectId;
|
|
int _PassValue;
|
|
#elif VFX_PASSDEPTH == VFX_PASSDEPTH_PICKING
|
|
float4 _SelectionID;
|
|
#endif
|
|
|
|
#pragma fragment frag
|
|
void frag(ps_input i
|
|
#if defined(WRITE_NORMAL_BUFFER) && VFX_PASSDEPTH == VFX_PASSDEPTH_ACTUAL
|
|
, out float4 outNormalBuffer : SV_Target0
|
|
#else
|
|
, out float4 outColor : SV_Target
|
|
#endif
|
|
, out float oDepth : DEPTH_OFFSET_SEMANTIC)
|
|
{
|
|
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
|
VFXTransformPSInputs(i);
|
|
float3 normalWS;
|
|
VFXClipSphereAndGetDepthOffsetAndNormal(oDepth, normalWS, i);
|
|
|
|
#if VFX_PASSDEPTH == VFX_PASSDEPTH_SELECTION
|
|
outColor = float4(_ObjectId, _PassValue, 1.0, 1.0);
|
|
#elif VFX_PASSDEPTH == VFX_PASSDEPTH_PICKING
|
|
outColor = _SelectionID;
|
|
#elif VFX_PASSDEPTH == VFX_PASSDEPTH_ACTUAL
|
|
#ifdef WRITE_NORMAL_BUFFER
|
|
VFXUVData uvData = (VFXUVData)0;
|
|
VFXComputePixelOutputToNormalBuffer(i,normalWS,uvData,outNormalBuffer);
|
|
#else
|
|
outColor = (float4)0;
|
|
#endif
|
|
#else
|
|
#error VFX_PASSDEPTH undefined
|
|
#endif
|
|
}
|