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.
115 lines
3.0 KiB
115 lines
3.0 KiB
Pass
|
|
{
|
|
Name "${VFXHDRPForwardPassName}"
|
|
Tags { "LightMode"="${VFXHDRPForwardPassName}"}
|
|
${VFXStencilForward}
|
|
|
|
HLSLPROGRAM
|
|
#pragma target 4.5
|
|
|
|
#define UNITY_MATERIAL_LIT
|
|
#define LIGHTLOOP_TILE_PASS
|
|
${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
|
|
#pragma multi_compile_fragment PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2
|
|
#pragma multi_compile _ DEBUG_DISPLAY
|
|
|
|
${VFXIncludeRP("VFXLitVaryings.template")}
|
|
|
|
struct ps_input
|
|
{
|
|
float4 pos : SV_POSITION;
|
|
|
|
${VFXHDRPLitDeclareVaryings}
|
|
|
|
#if USE_SOFT_PARTICLE || USE_ALPHA_TEST || VFX_FEATURE_MOTION_VECTORS_FORWARD
|
|
// x: inverse soft particles fade distance
|
|
// y: alpha threshold
|
|
nointerpolation float3 builtInInterpolants : TEXCOORD1;
|
|
#endif
|
|
|
|
#if HDRP_NEEDS_UVS
|
|
nointerpolation uint faceID : TEXCOORD2;
|
|
#endif
|
|
|
|
float3 offsets : TEXCOORD3;
|
|
nointerpolation float3 rotX : TEXCOORD4;
|
|
nointerpolation float3 rotY : TEXCOORD5;
|
|
|
|
float3 posWS : TEXCOORD8; // Needed for fog
|
|
|
|
${VFXAdditionalInterpolantsDeclaration}
|
|
|
|
UNITY_VERTEX_OUTPUT_STEREO
|
|
};
|
|
|
|
struct ps_output
|
|
{
|
|
float4 color : SV_Target0;
|
|
};
|
|
|
|
${VFXHDRPLitVaryingsMacros}
|
|
|
|
#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_OFFSETS offsets
|
|
#define VFX_VARYING_ROTX rotX
|
|
#define VFX_VARYING_ROTY rotY
|
|
#if HDRP_NEEDS_UVS
|
|
#define VFX_VARYING_FACEID faceID
|
|
#endif
|
|
#define VFX_VARYING_POSWS posWS
|
|
|
|
${VFXBegin:VFXVertexAdditionalProcess}
|
|
${VFXHDRPLitFillVaryings}
|
|
${VFXEnd}
|
|
|
|
${VFXInclude("Shaders/ParticleHexahedron/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
|
|
)
|
|
{
|
|
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
|
VFXTransformPSInputs(i);
|
|
|
|
#if VFX_USE_GRAPH_VALUES
|
|
uint instanceActiveIndex = i.VFX_VARYINGS_INSTANCE_ACTIVE_INDEX;
|
|
${VFXLoadGraphValues}
|
|
#endif
|
|
|
|
#if !USE_DOUBLE_SIDED
|
|
const bool frontFace = true;
|
|
#endif
|
|
const float faceMul = frontFace ? 1.0f : -1.0f;
|
|
|
|
float3 normalWS;
|
|
const VFXUVData uvData = GetUVData(i,VFXCubeGetUV(i));
|
|
|
|
#if USE_NORMAL_MAP
|
|
float3 n = SampleNormalMap(VFX_SAMPLER(normalMap),uvData);
|
|
normalWS = VFXCubeTransformNormalTS(i,n,frontFace);
|
|
normalWS = lerp(VFXCubeGetLocalNormal(i) * faceMul,normalWS,i.materialProperties.z);
|
|
#else
|
|
normalWS = VFXCubeGetLocalNormal(i) * faceMul;
|
|
#endif
|
|
normalWS = VFXCubeTransformNormalWS(i,normalWS);
|
|
normalWS = normalize(normalWS);
|
|
|
|
outColor = VFXGetPixelOutputForward(i,normalWS,uvData, true);
|
|
}
|
|
ENDHLSL
|
|
}
|