96 lines
2.5 KiB
Plaintext
96 lines
2.5 KiB
Plaintext
struct ps_input
|
|
{
|
|
float4 pos : SV_POSITION;
|
|
#if IS_TRANSPARENT_PARTICLE
|
|
#if defined (SHADER_API_PSSL) || defined(SHADER_API_GAMECORE)
|
|
/*noperspective (see case 1237742)*/ float pixelOffset : TEXCOORD0; // for AA
|
|
#else
|
|
noperspective float pixelOffset : TEXCOORD0; // for AA
|
|
#endif
|
|
#endif
|
|
#if VFX_NEEDS_COLOR_INTERPOLATOR
|
|
VFX_OPTIONAL_INTERPOLATION float4 color : COLOR0;
|
|
#endif
|
|
#if USE_SOFT_PARTICLE || USE_ALPHA_TEST || USE_EXPOSURE_WEIGHT || VFX_FEATURE_MOTION_VECTORS_FORWARD
|
|
VFX_OPTIONAL_INTERPOLATION float3 builtInInterpolants : TEXCOORD1;
|
|
#endif
|
|
#if VFX_NEEDS_POSWS_INTERPOLATOR
|
|
float3 posWS : TEXCOORD2;
|
|
#endif
|
|
|
|
#if VFX_FEATURE_MOTION_VECTORS_FORWARD
|
|
VFX_DECLARE_MOTION_VECTORS_STORAGE(3,4)
|
|
#endif
|
|
|
|
UNITY_VERTEX_OUTPUT_STEREO
|
|
|
|
VFX_VERTEX_OUTPUT_INSTANCE_INDEX
|
|
|
|
};
|
|
|
|
struct ps_output
|
|
{
|
|
float4 color : SV_Target0;
|
|
#if VFX_FEATURE_MOTION_VECTORS_FORWARD
|
|
float4 motionVector : 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
|
|
#if IS_TRANSPARENT_PARTICLE
|
|
#define VFX_VARYING_PIXELOFFSET pixelOffset
|
|
#endif
|
|
#if VFX_NEEDS_POSWS_INTERPOLATOR
|
|
#define VFX_VARYING_POSWS posWS
|
|
#endif
|
|
#if USE_EXPOSURE_WEIGHT
|
|
#define VFX_VARYING_EXPOSUREWEIGHT builtInInterpolants.z
|
|
#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/ParticleLinesSW/Pass.template")}
|
|
|
|
#pragma fragment frag
|
|
ps_output frag(ps_input i)
|
|
{
|
|
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
|
ps_output o = (ps_output)0;
|
|
VFXTransformPSInputs(i);
|
|
|
|
#if VFX_USE_GRAPH_VALUES
|
|
uint instanceActiveIndex = i.VFX_VARYINGS_INSTANCE_ACTIVE_INDEX;
|
|
${VFXLoadGraphValues}
|
|
#endif
|
|
|
|
${VFXApplyColor}
|
|
|
|
// Line AA
|
|
#if IS_TRANSPARENT_PARTICLE
|
|
o.color.a *= 1.0f - abs(i.pixelOffset);
|
|
#endif
|
|
|
|
o.color = VFXApplyPreExposure(o.color, i);
|
|
o.color = VFXApplyAO(o.color,i);
|
|
o.color = VFXApplyFog(o.color,i);
|
|
VFXClipFragmentColor(o.color.a,i);
|
|
o.color.a = saturate(o.color.a);
|
|
o.color = VFXTransformFinalColor(o.color,i);
|
|
|
|
#if VFX_FEATURE_MOTION_VECTORS_FORWARD
|
|
${VFXComputeOutputMotionVector}
|
|
o.motionVector = encodedMotionVector;
|
|
o.motionVector.a = o.color.a < i.VFX_VARYING_ALPHATHRESHOLD ? 0.0f : 1.0f; //Independant clipping for motion vector pass
|
|
#endif
|
|
|
|
return o;
|
|
}
|