diff --git a/com.unity.render-pipelines.universal/CHANGELOG.md b/com.unity.render-pipelines.universal/CHANGELOG.md index c9812f7fc52..42a5a8a3b56 100644 --- a/com.unity.render-pipelines.universal/CHANGELOG.md +++ b/com.unity.render-pipelines.universal/CHANGELOG.md @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Move Assets/Create/Rendering/Universal Render Pipeline/Forward Renderer to Assets/Create/Rendering/URP Forward Renderer - Removing unused temporary depth buffers for Depth of Field and Panini Projection. - Optimized the Bokeh Depth of Field shader on mobile by using half precision floats. +- Added Depth and DepthNormals passes to particles shaders. ### Fixed - Fixed an issue where ShadowCaster2D was generating garbage when running in the editor. [case 1304158](https://issuetracker.unity3d.com/product/unity/issues/guid/1304158/) diff --git a/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesDepthNormalsPass.hlsl b/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesDepthNormalsPass.hlsl new file mode 100644 index 00000000000..3d68e460889 --- /dev/null +++ b/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesDepthNormalsPass.hlsl @@ -0,0 +1,101 @@ +#ifndef UNIVERSAL_PARTICLES_LIT_DEPTH_NORMALS_PASS_INCLUDED +#define UNIVERSAL_PARTICLES_LIT_DEPTH_NORMALS_PASS_INCLUDED + +#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + +VaryingsDepthNormalsParticle DepthNormalsVertex(AttributesDepthNormalsParticle input) +{ + VaryingsDepthNormalsParticle output = (VaryingsDepthNormalsParticle)0; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + VertexPositionInputs vertexInput = GetVertexPositionInputs(input.vertex.xyz); + VertexNormalInputs normalInput = GetVertexNormalInputs(input.normal, input.tangent); + + half3 viewDirWS = GetWorldSpaceViewDir(vertexInput.positionWS); + #if !SHADER_HINT_NICE_QUALITY + viewDirWS = SafeNormalize(viewDirWS); + #endif + + #if defined(_NORMALMAP) + output.normalWS = half4(normalInput.normalWS, viewDirWS.x); + output.tangentWS = half4(normalInput.tangentWS, viewDirWS.y); + output.bitangentWS = half4(normalInput.bitangentWS, viewDirWS.z); + #else + output.normalWS = normalInput.normalWS; + output.viewDirWS = viewDirWS; + #endif + + output.clipPos = vertexInput.positionCS; + + #if defined(_ALPHATEST_ON) + output.color = GetParticleColor(input.color); + #endif + + #if defined(_ALPHATEST_ON) || defined(_NORMALMAP) + #if defined(_FLIPBOOKBLENDING_ON) + #if defined(UNITY_PARTICLE_INSTANCING_ENABLED) + GetParticleTexcoords(output.texcoord, output.texcoord2AndBlend, input.texcoords.xyxy, 0.0); + #else + GetParticleTexcoords(output.texcoord, output.texcoord2AndBlend, input.texcoords, input.texcoordBlend); + #endif + #else + GetParticleTexcoords(output.texcoord, input.texcoords.xy); + #endif + #endif + + return output; +} + +half4 DepthNormalsFragment(VaryingsDepthNormalsParticle input) : SV_TARGET +{ + UNITY_SETUP_INSTANCE_ID(input); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); + + // Inputs... + #if defined(_ALPHATEST_ON) || defined(_NORMALMAP) + float2 uv = input.texcoord; + + #if defined(_FLIPBOOKBLENDING_ON) + float3 blendUv = input.texcoord2AndBlend; + #else + float3 blendUv = float3(0,0,0); + #endif + #endif + + // Check if we need to discard... + #if defined(_ALPHATEST_ON) + half4 vertexColor = input.color; + half4 baseColor = _BaseColor; + half4 albedo = BlendTexture(TEXTURE2D_ARGS(_BaseMap, sampler_BaseMap), uv, blendUv) * baseColor; + + half4 colorAddSubDiff = half4(0, 0, 0, 0); + #if defined(_COLORADDSUBDIFF_ON) + colorAddSubDiff = _BaseColorAddSubDiff; + #endif + + albedo = MixParticleColor(albedo, vertexColor, colorAddSubDiff); + AlphaDiscard(albedo.a, _Cutoff); + #endif + + // Normals... + #ifdef _NORMALMAP + half3 normalTS = SampleNormalTS(uv, blendUv, TEXTURE2D_ARGS(_BumpMap, sampler_BumpMap), _BumpScale); + float3 normalWS = TransformTangentToWorld(normalTS, half3x3(input.tangentWS.xyz, input.bitangentWS.xyz, input.normalWS.xyz)); + #else + float3 normalWS = input.normalWS; + #endif + + // Output... + #if defined(_GBUFFER_NORMALS_OCT) + float2 octNormalWS = PackNormalOctQuadEncode(normalWS); // values between [-1, +1], must use fp32 on Nintendo Switch. + float2 remappedOctNormalWS = saturate(octNormalWS * 0.5 + 0.5); // values between [ 0, 1] + half3 packedNormalWS = PackFloat2To888(remappedOctNormalWS); // values between [ 0, 1] + return half4(packedNormalWS, 0.0); + #else + return half4(NormalizeNormalPerPixel(normalWS), 0.0); + #endif +} + +#endif // UNIVERSAL_PARTICLES_LIT_DEPTH_NORMALS_PASS_INCLUDED diff --git a/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesDepthNormalsPass.hlsl.meta b/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesDepthNormalsPass.hlsl.meta new file mode 100644 index 00000000000..a6366493a4c --- /dev/null +++ b/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesDepthNormalsPass.hlsl.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 637c27b6fe6224a06b2b066769d0a6e6 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesDepthOnlyPass.hlsl b/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesDepthOnlyPass.hlsl new file mode 100644 index 00000000000..548e095990c --- /dev/null +++ b/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesDepthOnlyPass.hlsl @@ -0,0 +1,63 @@ +#ifndef UNIVERSAL_PARTICLES_LIT_DEPTH_ONLY_PASS_INCLUDED +#define UNIVERSAL_PARTICLES_LIT_DEPTH_ONLY_PASS_INCLUDED + +#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + +VaryingsDepthOnlyParticle DepthOnlyVertex(AttributesDepthOnlyParticle input) +{ + VaryingsDepthOnlyParticle output = (VaryingsDepthOnlyParticle)0; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + VertexPositionInputs vertexInput = GetVertexPositionInputs(input.vertex.xyz); + output.clipPos = vertexInput.positionCS; + + #if defined(_ALPHATEST_ON) + output.color = GetParticleColor(input.color); + + #if defined(_FLIPBOOKBLENDING_ON) + #if defined(UNITY_PARTICLE_INSTANCING_ENABLED) + GetParticleTexcoords(output.texcoord, output.texcoord2AndBlend, input.texcoords.xyxy, 0.0); + #else + GetParticleTexcoords(output.texcoord, output.texcoord2AndBlend, input.texcoords, input.texcoordBlend); + #endif + #else + GetParticleTexcoords(output.texcoord, input.texcoords.xy); + #endif + #endif + + return output; +} + +half4 DepthOnlyFragment(VaryingsDepthOnlyParticle input) : SV_TARGET +{ + UNITY_SETUP_INSTANCE_ID(input); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); + + // Check if we need to discard... + #if defined(_ALPHATEST_ON) + float2 uv = input.texcoord; + half4 vertexColor = input.color; + half4 baseColor = _BaseColor; + + #if defined(_FLIPBOOKBLENDING_ON) + float3 blendUv = input.texcoord2AndBlend; + #else + float3 blendUv = float3(0,0,0); + #endif + + half4 albedo = BlendTexture(TEXTURE2D_ARGS(_BaseMap, sampler_BaseMap), uv, blendUv) * baseColor; + half4 colorAddSubDiff = half4(0, 0, 0, 0); + #if defined (_COLORADDSUBDIFF_ON) + colorAddSubDiff = _BaseColorAddSubDiff; + #endif + + albedo = MixParticleColor(albedo, vertexColor, colorAddSubDiff); + AlphaDiscard(albedo.a, _Cutoff); + #endif + + return 0; +} + +#endif // UNIVERSAL_PARTICLES_LIT_DEPTH_ONLY_PASS_INCLUDED diff --git a/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesDepthOnlyPass.hlsl.meta b/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesDepthOnlyPass.hlsl.meta new file mode 100644 index 00000000000..1b74d8cd2cd --- /dev/null +++ b/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesDepthOnlyPass.hlsl.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: e9795406c7fc049d2b125cce47405fa9 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesInput.hlsl b/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesInput.hlsl index 9a0c738a14e..5004c8f6b8f 100644 --- a/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesInput.hlsl +++ b/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesInput.hlsl @@ -5,19 +5,19 @@ struct AttributesParticle { - float4 vertex : POSITION; - half4 color : COLOR; + float4 vertex : POSITION; + half4 color : COLOR; #if defined(_FLIPBOOKBLENDING_ON) && !defined(UNITY_PARTICLE_INSTANCING_ENABLED) - float4 texcoords : TEXCOORD0; - float texcoordBlend : TEXCOORD1; + float4 texcoords : TEXCOORD0; + float texcoordBlend : TEXCOORD1; #else - float2 texcoords : TEXCOORD0; + float2 texcoords : TEXCOORD0; #endif #if !defined(PARTICLES_EDITOR_META_PASS) - float3 normal : NORMAL; - float4 tangent : TANGENT; + float3 normal : NORMAL; + float4 tangent : TANGENT; #endif UNITY_VERTEX_INPUT_INSTANCE_ID }; @@ -59,4 +59,91 @@ struct VaryingsParticle UNITY_VERTEX_OUTPUT_STEREO }; +struct AttributesDepthOnlyParticle +{ + float4 vertex : POSITION; + + #if defined(_ALPHATEST_ON) + half4 color : COLOR; + + #if defined(_FLIPBOOKBLENDING_ON) && !defined(UNITY_PARTICLE_INSTANCING_ENABLED) + float4 texcoords : TEXCOORD0; + float texcoordBlend : TEXCOORD1; + #else + float2 texcoords : TEXCOORD0; + #endif + #endif + UNITY_VERTEX_INPUT_INSTANCE_ID +}; + +struct VaryingsDepthOnlyParticle +{ + float4 clipPos : SV_POSITION; + + #if defined(_ALPHATEST_ON) + float2 texcoord : TEXCOORD0; + half4 color : COLOR; + + #if defined(_FLIPBOOKBLENDING_ON) + float3 texcoord2AndBlend : TEXCOORD5; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO +}; + +struct AttributesDepthNormalsParticle +{ + float4 vertex : POSITION; + + #if defined(_ALPHATEST_ON) + half4 color : COLOR; + #endif + + #if defined(_ALPHATEST_ON) || defined(_NORMALMAP) + #if defined(_FLIPBOOKBLENDING_ON) && !defined(UNITY_PARTICLE_INSTANCING_ENABLED) + float4 texcoords : TEXCOORD0; + float texcoordBlend : TEXCOORD1; + #else + float2 texcoords : TEXCOORD0; + #endif + #endif + + float3 normal : NORMAL; + float4 tangent : TANGENT; + + UNITY_VERTEX_INPUT_INSTANCE_ID +}; + + +struct VaryingsDepthNormalsParticle +{ + float4 clipPos : SV_POSITION; + + #if defined(_ALPHATEST_ON) + half4 color : COLOR; + #endif + + #if defined(_ALPHATEST_ON) || defined(_NORMALMAP) + float2 texcoord : TEXCOORD0; + + #if defined(_FLIPBOOKBLENDING_ON) + float3 texcoord2AndBlend : TEXCOORD5; + #endif + #endif + + #if defined(_NORMALMAP) + float4 normalWS : TEXCOORD2; // xyz: normal, w: viewDir.x + float4 tangentWS : TEXCOORD3; // xyz: tangent, w: viewDir.y + float4 bitangentWS : TEXCOORD4; // xyz: bitangent, w: viewDir.z + #else + float3 normalWS : TEXCOORD2; + float3 viewDirWS : TEXCOORD3; + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO +}; + #endif // UNIVERSAL_PARTICLES_INPUT_INCLUDED diff --git a/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesLit.shader b/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesLit.shader index 6508b8f29a2..c31b094a94a 100644 --- a/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesLit.shader +++ b/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesLit.shader @@ -91,7 +91,7 @@ Shader "Universal Render Pipeline/Particles/Lit" // ------------------------------------- // Particle Keywords #pragma shader_feature_local_fragment _ _ALPHAPREMULTIPLY_ON _ALPHAMODULATE_ON - #pragma shader_feature_local_fragment _ALPHATEST_ON + #pragma shader_feature_local_fragment _ _ALPHATEST_ON #pragma shader_feature_local_fragment _ _COLOROVERLAY_ON _COLORCOLOR_ON _COLORADDSUBDIFF_ON #pragma shader_feature_local _FLIPBOOKBLENDING_ON #pragma shader_feature_local _SOFTPARTICLES_ON @@ -172,6 +172,69 @@ Shader "Universal Render Pipeline/Particles/Lit" ENDHLSL } // ------------------------------------------------------------------ + // Depth Only pass. + Pass + { + Name "DepthOnly" + Tags{"LightMode" = "DepthOnly"} + + ZWrite On + ColorMask 0 + Cull[_Cull] + + HLSLPROGRAM + #pragma target 2.0 + + // ------------------------------------- + // Material Keywords + #pragma shader_feature_local _ _ALPHATEST_ON + #pragma shader_feature_local _ _FLIPBOOKBLENDING_ON + #pragma shader_feature_local_fragment _ _COLOROVERLAY_ON _COLORCOLOR_ON _COLORADDSUBDIFF_ON + + // ------------------------------------- + // Unity defined keywords + #pragma multi_compile_instancing + #pragma instancing_options procedural:ParticleInstancingSetup + + #pragma vertex DepthOnlyVertex + #pragma fragment DepthOnlyFragment + + #include "Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesLitInput.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesDepthOnlyPass.hlsl" + ENDHLSL + } + // This pass is used when drawing to a _CameraNormalsTexture texture + Pass + { + Name "DepthNormals" + Tags{"LightMode" = "DepthNormals"} + + ZWrite On + Cull[_Cull] + + HLSLPROGRAM + #pragma target 2.0 + + // ------------------------------------- + // Material Keywords + #pragma shader_feature_local _ _NORMALMAP + #pragma shader_feature_local _ _FLIPBOOKBLENDING_ON + #pragma shader_feature_local _ _ALPHATEST_ON + #pragma shader_feature_local_fragment _ _COLOROVERLAY_ON _COLORCOLOR_ON _COLORADDSUBDIFF_ON + + // ------------------------------------- + // Unity defined keywords + #pragma multi_compile_instancing + #pragma instancing_options procedural:ParticleInstancingSetup + + #pragma vertex DepthNormalsVertex + #pragma fragment DepthNormalsFragment + + #include "Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesLitInput.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesDepthNormalsPass.hlsl" + ENDHLSL + } + // ------------------------------------------------------------------ // Scene view outline pass. Pass { diff --git a/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesSimpleLit.shader b/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesSimpleLit.shader index 3168371a197..de9620fd213 100644 --- a/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesSimpleLit.shader +++ b/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesSimpleLit.shader @@ -182,6 +182,69 @@ Shader "Universal Render Pipeline/Particles/Simple Lit" ENDHLSL } // ------------------------------------------------------------------ + // Depth Only pass. + Pass + { + Name "DepthOnly" + Tags{"LightMode" = "DepthOnly"} + + ZWrite On + ColorMask 0 + Cull[_Cull] + + HLSLPROGRAM + #pragma target 2.0 + + // ------------------------------------- + // Material Keywords + #pragma shader_feature_local _ _ALPHATEST_ON + #pragma shader_feature_local _ _FLIPBOOKBLENDING_ON + #pragma shader_feature_local_fragment _ _COLOROVERLAY_ON _COLORCOLOR_ON _COLORADDSUBDIFF_ON + + // ------------------------------------- + // Unity defined keywords + #pragma multi_compile_instancing + #pragma instancing_options procedural:ParticleInstancingSetup + + #pragma vertex DepthOnlyVertex + #pragma fragment DepthOnlyFragment + + #include "Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesSimpleLitInput.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesDepthOnlyPass.hlsl" + ENDHLSL + } + // This pass is used when drawing to a _CameraNormalsTexture texture + Pass + { + Name "DepthNormals" + Tags{"LightMode" = "DepthNormals"} + + ZWrite On + Cull[_Cull] + + HLSLPROGRAM + #pragma target 2.0 + + // ------------------------------------- + // Material Keywords + #pragma shader_feature_local _ _NORMALMAP + #pragma shader_feature_local _ _FLIPBOOKBLENDING_ON + #pragma shader_feature_local _ _ALPHATEST_ON + #pragma shader_feature_local_fragment _ _COLOROVERLAY_ON _COLORCOLOR_ON _COLORADDSUBDIFF_ON + + // ------------------------------------- + // Unity defined keywords + #pragma multi_compile_instancing + #pragma instancing_options procedural:ParticleInstancingSetup + + #pragma vertex DepthNormalsVertex + #pragma fragment DepthNormalsFragment + + #include "Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesSimpleLitInput.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesDepthNormalsPass.hlsl" + ENDHLSL + } + // ------------------------------------------------------------------ // Scene view outline pass. Pass { diff --git a/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesSimpleLitInput.hlsl b/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesSimpleLitInput.hlsl index 99fa0ab8b27..8b2e1e39629 100644 --- a/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesSimpleLitInput.hlsl +++ b/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesSimpleLitInput.hlsl @@ -30,6 +30,8 @@ TEXTURE2D(_SpecGlossMap); SAMPLER(sampler_SpecGlossMap); #define CAMERA_NEAR_FADE _CameraFadeParams.x #define CAMERA_INV_FADE_DISTANCE _CameraFadeParams.y +#define _BumpScale 1.0 + half4 SampleAlbedo(float2 uv, float3 blendUv, half4 color, float4 particleColor, float4 projectedPosition, TEXTURE2D_PARAM(albedoMap, sampler_albedoMap)) { half4 albedo = BlendTexture(TEXTURE2D_ARGS(albedoMap, sampler_albedoMap), uv, blendUv) * color; diff --git a/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesUnlit.shader b/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesUnlit.shader index f17f7dbd8ef..4109b1dd621 100644 --- a/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesUnlit.shader +++ b/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesUnlit.shader @@ -100,6 +100,104 @@ Shader "Universal Render Pipeline/Particles/Unlit" ENDHLSL } // ------------------------------------------------------------------ + // Depth Only pass. + Pass + { + Name "DepthOnly" + Tags{"LightMode" = "DepthOnly"} + + ZWrite On + ColorMask 0 + Cull[_Cull] + + HLSLPROGRAM + #pragma target 2.0 + + // ------------------------------------- + // Material Keywords + #pragma shader_feature_local _ _ALPHATEST_ON + #pragma shader_feature_local _ _FLIPBOOKBLENDING_ON + #pragma shader_feature_local_fragment _ _COLOROVERLAY_ON _COLORCOLOR_ON _COLORADDSUBDIFF_ON + + // ------------------------------------- + // Unity defined keywords + #pragma multi_compile_instancing + #pragma instancing_options procedural:ParticleInstancingSetup + + #pragma vertex DepthOnlyVertex + #pragma fragment DepthOnlyFragment + + #include "Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesUnlitInput.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesDepthOnlyPass.hlsl" + ENDHLSL + } + // This pass is used when drawing to a _CameraNormalsTexture texture + Pass + { + Name "DepthNormals" + Tags{"LightMode" = "DepthNormals"} + + ZWrite On + Cull[_Cull] + + HLSLPROGRAM + #pragma target 2.0 + + // ------------------------------------- + // Material Keywords + #pragma shader_feature_local _ _NORMALMAP + #pragma shader_feature_local _ _FLIPBOOKBLENDING_ON + #pragma shader_feature_local _ _ALPHATEST_ON + #pragma shader_feature_local_fragment _ _COLOROVERLAY_ON _COLORCOLOR_ON _COLORADDSUBDIFF_ON + + // ------------------------------------- + // Unity defined keywords + #pragma multi_compile_instancing + #pragma instancing_options procedural:ParticleInstancingSetup + + #pragma vertex DepthNormalsVertex + #pragma fragment DepthNormalsFragment + + #include "Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesUnlitInput.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesDepthNormalsPass.hlsl" + ENDHLSL + } + // Same as DepthNormals pass, but used for deferred renderer and forwardOnly materials. + Pass + { + Name "DepthNormalsOnly" + Tags{"LightMode" = "DepthNormalsOnly"} + + ZWrite On + Cull[_Cull] + + HLSLPROGRAM + #pragma exclude_renderers gles gles3 glcore + #pragma target 4.5 + + #pragma vertex DepthNormalsVertex + #pragma fragment DepthNormalsFragment + + // ------------------------------------- + // Material Keywords + #pragma shader_feature_local _ _NORMALMAP + #pragma shader_feature_local _ _ALPHATEST_ON + #pragma shader_feature_local_fragment _ _COLOROVERLAY_ON _COLORCOLOR_ON _COLORADDSUBDIFF_ON + + // ------------------------------------- + // Unity defined keywords + #pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT // forward-only variant + + //-------------------------------------- + // GPU Instancing + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + + #include "Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesUnlitInput.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesDepthNormalsPass.hlsl" + ENDHLSL + } + // ------------------------------------------------------------------ // Scene view outline pass. Pass { diff --git a/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesUnlitInput.hlsl b/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesUnlitInput.hlsl index efd906dbdb4..23541de9652 100644 --- a/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesUnlitInput.hlsl +++ b/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesUnlitInput.hlsl @@ -26,6 +26,8 @@ CBUFFER_END #define CAMERA_NEAR_FADE _CameraFadeParams.x #define CAMERA_INV_FADE_DISTANCE _CameraFadeParams.y +#define _BumpScale 1.0 + half4 SampleAlbedo(float2 uv, float3 blendUv, half4 color, float4 particleColor, float4 projectedPosition, TEXTURE2D_PARAM(albedoMap, sampler_albedoMap)) { half4 albedo = BlendTexture(TEXTURE2D_ARGS(albedoMap, sampler_albedoMap), uv, blendUv) * color;