struct ps_input { float4 pos : SV_POSITION; float3 offsets : TEXCOORD0; #if VFX_NEEDS_COLOR_INTERPOLATOR nointerpolation float4 color : COLOR0; #endif #if USE_SOFT_PARTICLE || USE_ALPHA_TEST || VFX_FEATURE_MOTION_VECTORS_FORWARD // x: inverse soft particles fade distance // y: alpha threshold nointerpolation float2 builtInInterpolants : TEXCOORD1; #endif #if USE_FLIPBOOK_MOTIONVECTORS // x: motion vectors scale X // y: motion vectors scale Y nointerpolation float2 builtInInterpolants2 : TEXCOORD2; #endif nointerpolation uint faceID : TEXCOORD3; #if VFX_NEEDS_POSWS_INTERPOLATOR float3 posWS : TEXCOORD4; #endif #if USE_UV_SCALE_BIAS nointerpolation float4 scaleBias : TEXCOORD5; #endif #if USE_FLIPBOOK #if USE_FLIPBOOK_ARRAY_LAYOUT nointerpolation float flipBookSize : TEXCOORD6; #else nointerpolation float4 flipBookSize : TEXCOORD6; #endif // x: texIndex // y: texIndexBlend nointerpolation float2 texIndices : TEXCOORD7; #endif #if VFX_FEATURE_MOTION_VECTORS_FORWARD VFX_DECLARE_MOTION_VECTORS_STORAGE(7, 8) #endif VFX_VERTEX_OUTPUT_INSTANCE_INDEX UNITY_VERTEX_OUTPUT_STEREO }; struct ps_output { float4 color : SV_Target0; #if VFX_FEATURE_MOTION_VECTORS_FORWARD float4 outMotionVector : SV_Target1; #endif }; #define VFX_VARYING_PS_INPUTS ps_input #define VFX_VARYING_POSCS pos #define VFX_VARYING_COLOR color.rgb #define VFX_VARYING_ALPHA color.a #define VFX_VARYING_INVSOFTPARTICLEFADEDISTANCE builtInInterpolants.x #define VFX_VARYING_ALPHATHRESHOLD builtInInterpolants.y #define VFX_VARYING_OFFSETS offsets #define VFX_VARYING_FACEID faceID #if VFX_NEEDS_POSWS_INTERPOLATOR #define VFX_VARYING_POSWS posWS #endif #if USE_UV_SCALE_BIAS #define VFX_VARYING_UV_SCALE scaleBias.xy #define VFX_VARYING_UV_BIAS scaleBias.zw #endif #if USE_FLIPBOOK #define VFX_VARYING_TEXINDEX texIndices.x #if USE_FLIPBOOK_INTERPOLATION #define VFX_VARYING_TEXINDEXBLEND texIndices.y #endif #if USE_FLIPBOOK_ARRAY_LAYOUT #define VFX_VARYING_FLIPBOOKSIZE flipBookSize #else #define VFX_VARYING_FLIPBOOKSIZE flipBookSize.xy #define VFX_VARYING_INVFLIPBOOKSIZE flipBookSize.zw #endif #endif #if USE_FLIPBOOK_MOTIONVECTORS #define VFX_VARYING_MOTIONVECTORSCALE builtInInterpolants2.xy #endif #if VFX_FEATURE_MOTION_VECTORS_FORWARD #define VFX_VARYING_VELOCITY_CPOS VFX_DECLARE_MOTION_VECTORS_VARYING_NONJITTER #define VFX_VARYING_VELOCITY_CPOS_PREVIOUS VFX_DECLARE_MOTION_VECTORS_VARYING_PREVIOUS #endif ${VFXPassForwardDefine} ${VFXInclude("Shaders/ParticleHexahedron/Pass.template")} #pragma fragment frag ps_output frag(ps_input i) { #if VFX_USE_GRAPH_VALUES uint instanceActiveIndex = i.VFX_VARYINGS_INSTANCE_ACTIVE_INDEX; ${VFXLoadGraphValues} #endif UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); ps_output o = (ps_output)0; VFXTransformPSInputs(i); o.color = VFXGetFragmentColor(i); o.color *= VFXGetTextureColorWithProceduralUV(VFX_SAMPLER(mainTexture),i,VFXCubeGetUV(i)); o.color = VFXApplyFog(o.color,i); VFXClipFragmentColor(o.color.a,i); #if VFX_FEATURE_MOTION_VECTORS_FORWARD ${VFXComputeOutputMotionVector} o.outMotionVector = encodedMotionVector; o.outMotionVector.a = o.color.a < i.VFX_VARYING_ALPHATHRESHOLD ? 0.0f : 1.0f; //Independant clipping for motion vector pass #endif ${VFXUnlitDebugDisplay} return o; }