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.
156 lines
4.7 KiB
156 lines
4.7 KiB
// Forward pass
|
|
Pass
|
|
{
|
|
Name "${VFXHDRPForwardPassName}"
|
|
Tags { "LightMode"="${VFXHDRPForwardPassName}"}
|
|
|
|
${VFXStencilForward}
|
|
|
|
HLSLPROGRAM
|
|
#pragma target 4.5
|
|
|
|
#define UNITY_MATERIAL_LIT
|
|
${VFXHDRPForwardDefines}
|
|
#pragma multi_compile USE_FPTL_LIGHTLIST USE_CLUSTERED_LIGHTLIST
|
|
#pragma multi_compile_fragment PUNCTUAL_SHADOW_LOW PUNCTUAL_SHADOW_MEDIUM PUNCTUAL_SHADOW_HIGH
|
|
#pragma multi_compile_fragment DIRECTIONAL_SHADOW_LOW DIRECTIONAL_SHADOW_MEDIUM DIRECTIONAL_SHADOW_HIGH
|
|
#pragma multi_compile_fragment AREA_SHADOW_MEDIUM AREA_SHADOW_HIGH
|
|
#if VFX_MATERIAL_TYPE_SIX_WAY_SMOKE
|
|
#pragma multi_compile _ PROBE_VOLUMES_L1 PROBE_VOLUMES_L2
|
|
#else
|
|
#pragma multi_compile_fragment _ PROBE_VOLUMES_L1 PROBE_VOLUMES_L2
|
|
#endif
|
|
#pragma multi_compile _ DEBUG_DISPLAY
|
|
//#pragma enable_d3d11_debug_symbols
|
|
|
|
${VFXIncludeRP("VFXLitVaryings.template")}
|
|
${VFXIncludeRP("VFXVertexProbeSampling.template"),VFX_MATERIAL_TYPE_SIX_WAY_SMOKE}
|
|
|
|
struct ps_input
|
|
{
|
|
float4 pos : SV_POSITION;
|
|
|
|
${VFXHDRPLitDeclareVaryings}
|
|
|
|
#if USE_FLIPBOOK_INTERPOLATION
|
|
float4 uv : TEXCOORD1;
|
|
#else
|
|
#if USE_FLIPBOOK_ARRAY_LAYOUT
|
|
float3 uv : TEXCOORD1;
|
|
#else
|
|
float2 uv : TEXCOORD1;
|
|
#endif
|
|
#endif
|
|
#if USE_SOFT_PARTICLE || USE_ALPHA_TEST || USE_FLIPBOOK_INTERPOLATION || VFX_FEATURE_MOTION_VECTORS_FORWARD || (VFX_MATERIAL_TYPE_SIX_WAY_SMOKE && VFX_SIX_WAY_USE_ONE_EMISSIVE_CHANNEL)
|
|
// x: inverse soft particles fade distance
|
|
// y: alpha threshold
|
|
// z: frame blending factor
|
|
// w: emissive multiplier
|
|
VFX_OPTIONAL_INTERPOLATION float4 builtInInterpolants : TEXCOORD2;
|
|
#endif
|
|
|
|
#if USE_FLIPBOOK_MOTIONVECTORS
|
|
// x: motion vector scale u
|
|
// y: motion vector scale v
|
|
VFX_OPTIONAL_INTERPOLATION float2 builtInInterpolants2 : TEXCOORD3;
|
|
#endif
|
|
|
|
VFX_OPTIONAL_INTERPOLATION float3 normal : TEXCOORD4;
|
|
#if USE_NORMAL_MAP || USE_NORMAL_BENDING || SHADERGRAPH_NEEDS_TANGENT_FORWARD || VFX_MATERIAL_TYPE_SIX_WAY_SMOKE
|
|
VFX_OPTIONAL_INTERPOLATION float3 tangent : TEXCOORD5;
|
|
#endif
|
|
#if USE_NORMAL_BENDING
|
|
float2 bentFactors : TEXCOORD6;
|
|
#endif
|
|
|
|
#if VFX_FEATURE_MOTION_VECTORS_FORWARD
|
|
VFX_DECLARE_MOTION_VECTORS_STORAGE(7,8)
|
|
#endif
|
|
|
|
float3 posWS : TEXCOORD9; // Needed for fog
|
|
|
|
${VFXAdditionalInterpolantsDeclaration}
|
|
|
|
UNITY_VERTEX_OUTPUT_STEREO
|
|
};
|
|
|
|
${VFXHDRPLitVaryingsMacros}
|
|
|
|
#if VFX_MATERIAL_TYPE_SIX_WAY_SMOKE
|
|
${VFXVertexProbeVaryingsMacros}
|
|
#endif
|
|
|
|
#define VFX_VARYING_PS_INPUTS ps_input
|
|
#define VFX_VARYING_POSCS pos
|
|
#define VFX_VARYING_INVSOFTPARTICLEFADEDISTANCE builtInInterpolants.x
|
|
#define VFX_VARYING_ALPHATHRESHOLD builtInInterpolants.y
|
|
#define VFX_VARYING_FRAMEBLEND builtInInterpolants.z
|
|
#define VFX_VARYING_MOTIONVECTORSCALE builtInInterpolants2.xy
|
|
#define VFX_VARYING_UV uv
|
|
#define VFX_VARYING_NORMAL normal
|
|
#if USE_NORMAL_MAP || USE_NORMAL_BENDING || SHADERGRAPH_NEEDS_TANGENT_FORWARD || VFX_MATERIAL_TYPE_SIX_WAY_SMOKE
|
|
#define VFX_VARYING_TANGENT tangent
|
|
#endif
|
|
#if USE_NORMAL_BENDING
|
|
#define VFX_VARYING_BENTFACTORS bentFactors
|
|
#endif
|
|
#define VFX_VARYING_POSWS posWS
|
|
|
|
#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
|
|
|
|
${VFXVertexProbeDeclareFunctions}
|
|
|
|
${VFXBegin:VFXVertexAdditionalProcess}
|
|
${VFXHDRPLitFillVaryings}
|
|
${VFXVertexProbeFillVaryings}
|
|
${VFXEnd}
|
|
|
|
|
|
${VFXInclude("Shaders/ParticlePlanarPrimitives/Pass.template")}
|
|
#define SHADERPASS SHADERPASS_FORWARD
|
|
${VFXIncludeRP("VFXLit.template")}
|
|
|
|
${SHADERGRAPH_PIXEL_CODE_FORWARD}
|
|
|
|
#pragma fragment frag
|
|
void frag(ps_input i
|
|
, out float4 outColor : SV_Target0
|
|
#if USE_DOUBLE_SIDED
|
|
, bool frontFace : SV_IsFrontFace
|
|
#endif
|
|
#if VFX_FEATURE_MOTION_VECTORS_FORWARD
|
|
, out float4 outMotionVector : SV_Target1
|
|
#endif
|
|
)
|
|
{
|
|
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
|
VFXTransformPSInputs(i);
|
|
VFX_FRAG_SETUP_INSTANCE_ID(i);
|
|
|
|
${VFXComputeNormalWS}
|
|
|
|
#ifdef VFX_SHADERGRAPH
|
|
${VFXAdditionalInterpolantsPreparation}
|
|
${SHADERGRAPH_PIXEL_CALL_FORWARD}
|
|
|
|
${VFXIncludeRP("VFXSGSurfaceData.template")}
|
|
outColor = VFXGetPixelOutputForwardShaderGraph(i, surface, builtinEmissiveColor, builtinOpacity);
|
|
#else
|
|
#if USE_DOUBLE_SIDED
|
|
outColor = VFXGetPixelOutputForward(i,normalWS,uvData, frontFace);
|
|
#else
|
|
outColor = VFXGetPixelOutputForward(i,normalWS,uvData, true);
|
|
#endif
|
|
#endif
|
|
|
|
#if VFX_FEATURE_MOTION_VECTORS_FORWARD
|
|
${VFXComputeOutputMotionVector}
|
|
outMotionVector = encodedMotionVector;
|
|
outMotionVector.a = outColor.a < i.VFX_VARYING_ALPHATHRESHOLD ? 0.0f : 1.0f; //Independant clipping for motion vector pass
|
|
#endif
|
|
}
|
|
ENDHLSL
|
|
}
|