// Made with Amplify Shader Editor v1.9.8.1 // Available at the Unity Asset Store - http://u3d.as/y3X Shader "HDRPLitDistortionDimensionalFracture" { Properties { [HideInInspector] _AlphaCutoff("Alpha Cutoff ", Range(0, 1)) = 0.5 _DistortionSpeed1("DistortionSpeed", Float) = 0.5 _Normals("Normals", 2D) = "white" {} _CloudTiling("Cloud Tiling", Vector) = (1,1,0,0) _DistortionTile("DistortionTile", Vector) = (1,1,0,0) _TextureSample1("Texture Sample 1", 2D) = "white" {} _TextureSample4("Texture Sample 1", 2D) = "white" {} _CloudDirection("Cloud Direction", Float) = 1 _CloudColor("Cloud Color", Color) = (0,1,0.7772009,0) _CloudBrightness("Cloud Brightness", Float) = 3.62 _DistortValue("DistortValue", Float) = 1 _EmissionPower("Emission Power", Float) = 11.31 _GrayScalePower("Gray Scale Power", Float) = 0 _Bias("Bias", Float) = -0.78 _Scale("Scale", Float) = 2 _VignetteMask("VignetteMask", 2D) = "white" {} _Power("Power", Float) = 2.42 _CausticsSpeed("CausticsSpeed", Float) = 2 _CausticsScale("CausticsScale", Float) = 5 _CausticsStrength("CausticsStrength", Float) = 1 [HideInInspector] _texcoord( "", 2D ) = "white" {} [HideInInspector] _RenderQueueType("Render Queue Type", Float) = 5 [HideInInspector][ToggleUI] _AddPrecomputedVelocity("Add Precomputed Velocity", Float) = 1 //[HideInInspector] _ShadowMatteFilter("Shadow Matte Filter", Float) = 2.006836 [HideInInspector] _StencilRef("Stencil Ref", Int) = 0 // StencilUsage.Clear [HideInInspector] _StencilWriteMask("Stencil Write Mask", Int) = 3 // StencilUsage.RequiresDeferredLighting | StencilUsage.SubsurfaceScattering [HideInInspector] _StencilRefDepth("Stencil Ref Depth", Int) = 0 // Nothing [HideInInspector] _StencilWriteMaskDepth("Stencil Write Mask Depth", Int) = 8 // StencilUsage.TraceReflectionRay [HideInInspector] _StencilRefMV("Stencil Ref MV", Int) = 32 // StencilUsage.ObjectMotionVector [HideInInspector] _StencilWriteMaskMV("Stencil Write Mask MV", Int) = 32 // StencilUsage.ObjectMotionVector [HideInInspector] _StencilRefDistortionVec("Stencil Ref Distortion Vec", Int) = 2 // StencilUsage.DistortionVectors [HideInInspector] _StencilWriteMaskDistortionVec("Stencil Write Mask Distortion Vec", Int) = 2 // StencilUsage.DistortionVectors [HideInInspector] _StencilWriteMaskGBuffer("Stencil Write Mask GBuffer", Int) = 3 // StencilUsage.RequiresDeferredLighting | StencilUsage.SubsurfaceScattering [HideInInspector] _StencilRefGBuffer("Stencil Ref GBuffer", Int) = 2 // StencilUsage.RequiresDeferredLighting [HideInInspector] _ZTestGBuffer("ZTest GBuffer", Int) = 4 [HideInInspector][ToggleUI] _RequireSplitLighting("Require Split Lighting", Float) = 0 [HideInInspector][ToggleUI] _ReceivesSSR("Receives SSR", Float) = 1 [HideInInspector] _SurfaceType("Surface Type", Float) = 0 [HideInInspector] _BlendMode("Blend Mode", Float) = 0 [HideInInspector] _SrcBlend("Src Blend", Float) = 1 [HideInInspector] _DstBlend("Dst Blend", Float) = 0 [HideInInspector] _AlphaSrcBlend("Alpha Src Blend", Float) = 1 [HideInInspector] _AlphaDstBlend("Alpha Dst Blend", Float) = 0 [HideInInspector][ToggleUI] _ZWrite("ZWrite", Float) = 1 [HideInInspector][ToggleUI] _TransparentZWrite("Transparent ZWrite", Float) = 0 [HideInInspector] _CullMode("Cull Mode", Float) = 2 [HideInInspector] _TransparentSortPriority("Transparent Sort Priority", Float) = 0 [HideInInspector][ToggleUI] _EnableFogOnTransparent("Enable Fog", Float) = 1 [HideInInspector] _CullModeForward("Cull Mode Forward", Float) = 2 // This mode is dedicated to Forward to correctly handle backface then front face rendering thin transparent [HideInInspector][Enum(UnityEngine.Rendering.HighDefinition.TransparentCullMode)] _TransparentCullMode("_TransparentCullMode", Int) = 2 // Back culling by default [HideInInspector] _ZTestDepthEqualForOpaque("ZTest Depth Equal For Opaque", Int) = 4 // Less equal [HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _ZTestTransparent("ZTest Transparent", Int) = 4 // Less equal [HideInInspector][ToggleUI] _TransparentBackfaceEnable("Transparent Backface Enable", Float) = 0 [HideInInspector][ToggleUI] _AlphaCutoffEnable("Alpha Cutoff Enable", Float) = 1 [HideInInspector][ToggleUI] _UseShadowThreshold("Use Shadow Threshold", Float) = 0 [HideInInspector][ToggleUI] _DoubleSidedEnable("Double Sided Enable", Float) = 1 [HideInInspector][Enum(Flip, 0, Mirror, 1, None, 2)] _DoubleSidedNormalMode("Double Sided Normal Mode", Float) = 2 [HideInInspector] _DoubleSidedConstants("DoubleSidedConstants", Vector) = (1,1,-1,0) [HideInInspector] _DistortionEnable("_DistortionEnable",Float) = 0 [HideInInspector] _DistortionOnly("_DistortionOnly",Float) = 0 //_TessPhongStrength( "Tess Phong Strength", Range( 0, 1 ) ) = 0.5 //_TessValue( "Tess Max Tessellation", Range( 1, 32 ) ) = 16 //_TessMin( "Tess Min Distance", Float ) = 10 //_TessMax( "Tess Max Distance", Float ) = 25 //_TessEdgeLength ( "Tess Edge length", Range( 2, 50 ) ) = 16 //_TessMaxDisp( "Tess Max Displacement", Float ) = 25 [HideInInspector][ToggleUI] _TransparentWritingMotionVec("Transparent Writing MotionVec", Float) = 0 [HideInInspector][Enum(UnityEngine.Rendering.HighDefinition.OpaqueCullMode)] _OpaqueCullMode("_OpaqueCullMode", Int) = 2 // Back culling by default [HideInInspector][ToggleUI] _SupportDecals("Support Decals", Float) = 1 [HideInInspector][ToggleUI] _ReceivesSSRTransparent("Receives SSR Transparent", Float) = 0 [HideInInspector] _EmissionColor("Color", Color) = (1, 1, 1) [HideInInspector] _UnlitColorMap_MipInfo("_UnlitColorMap_MipInfo", Vector) = (0, 0, 0, 0) [HideInInspector][Enum(Auto, 0, On, 1, Off, 2)] _DoubleSidedGIMode("Double sided GI mode", Float) = 0 //DoubleSidedGIMode added in api 12x and higher } SubShader { LOD 0 Tags { "RenderPipeline"="HDRenderPipeline" "RenderType"="Opaque" "Queue"="Geometry" } HLSLINCLUDE #pragma target 4.5 #pragma exclude_renderers glcore gles gles3 ps4 ps5 #define SUPPORT_GLOBAL_MIP_BIAS 1 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Filtering.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" #ifndef ASE_TESS_FUNCS #define ASE_TESS_FUNCS float4 FixedTess( float tessValue ) { return tessValue; } float CalcDistanceTessFactor (float4 vertex, float minDist, float maxDist, float tess, float4x4 o2w, float3 cameraPos ) { float3 wpos = mul(o2w,vertex).xyz; float dist = distance (wpos, cameraPos); float f = clamp(1.0 - (dist - minDist) / (maxDist - minDist), 0.01, 1.0) * tess; return f; } float4 CalcTriEdgeTessFactors (float3 triVertexFactors) { float4 tess; tess.x = 0.5 * (triVertexFactors.y + triVertexFactors.z); tess.y = 0.5 * (triVertexFactors.x + triVertexFactors.z); tess.z = 0.5 * (triVertexFactors.x + triVertexFactors.y); tess.w = (triVertexFactors.x + triVertexFactors.y + triVertexFactors.z) / 3.0f; return tess; } float CalcEdgeTessFactor (float3 wpos0, float3 wpos1, float edgeLen, float3 cameraPos, float4 scParams ) { float dist = distance (0.5 * (wpos0+wpos1), cameraPos); float len = distance(wpos0, wpos1); float f = max(len * scParams.y / (edgeLen * dist), 1.0); return f; } float DistanceFromPlaneASE (float3 pos, float4 plane) { return dot (float4(pos,1.0f), plane); } bool WorldViewFrustumCull (float3 wpos0, float3 wpos1, float3 wpos2, float cullEps, float4 planes[6] ) { float4 planeTest; planeTest.x = (( DistanceFromPlaneASE(wpos0, planes[0]) > -cullEps) ? 1.0f : 0.0f ) + (( DistanceFromPlaneASE(wpos1, planes[0]) > -cullEps) ? 1.0f : 0.0f ) + (( DistanceFromPlaneASE(wpos2, planes[0]) > -cullEps) ? 1.0f : 0.0f ); planeTest.y = (( DistanceFromPlaneASE(wpos0, planes[1]) > -cullEps) ? 1.0f : 0.0f ) + (( DistanceFromPlaneASE(wpos1, planes[1]) > -cullEps) ? 1.0f : 0.0f ) + (( DistanceFromPlaneASE(wpos2, planes[1]) > -cullEps) ? 1.0f : 0.0f ); planeTest.z = (( DistanceFromPlaneASE(wpos0, planes[2]) > -cullEps) ? 1.0f : 0.0f ) + (( DistanceFromPlaneASE(wpos1, planes[2]) > -cullEps) ? 1.0f : 0.0f ) + (( DistanceFromPlaneASE(wpos2, planes[2]) > -cullEps) ? 1.0f : 0.0f ); planeTest.w = (( DistanceFromPlaneASE(wpos0, planes[3]) > -cullEps) ? 1.0f : 0.0f ) + (( DistanceFromPlaneASE(wpos1, planes[3]) > -cullEps) ? 1.0f : 0.0f ) + (( DistanceFromPlaneASE(wpos2, planes[3]) > -cullEps) ? 1.0f : 0.0f ); return !all (planeTest); } float4 DistanceBasedTess( float4 v0, float4 v1, float4 v2, float tess, float minDist, float maxDist, float4x4 o2w, float3 cameraPos ) { float3 f; f.x = CalcDistanceTessFactor (v0,minDist,maxDist,tess,o2w,cameraPos); f.y = CalcDistanceTessFactor (v1,minDist,maxDist,tess,o2w,cameraPos); f.z = CalcDistanceTessFactor (v2,minDist,maxDist,tess,o2w,cameraPos); return CalcTriEdgeTessFactors (f); } float4 EdgeLengthBasedTess( float4 v0, float4 v1, float4 v2, float edgeLength, float4x4 o2w, float3 cameraPos, float4 scParams ) { float3 pos0 = mul(o2w,v0).xyz; float3 pos1 = mul(o2w,v1).xyz; float3 pos2 = mul(o2w,v2).xyz; float4 tess; tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams); tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams); tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams); tess.w = (tess.x + tess.y + tess.z) / 3.0f; return tess; } float4 EdgeLengthBasedTessCull( float4 v0, float4 v1, float4 v2, float edgeLength, float maxDisplacement, float4x4 o2w, float3 cameraPos, float4 scParams, float4 planes[6] ) { float3 pos0 = mul(o2w,v0).xyz; float3 pos1 = mul(o2w,v1).xyz; float3 pos2 = mul(o2w,v2).xyz; float4 tess; if (WorldViewFrustumCull(pos0, pos1, pos2, maxDisplacement, planes)) { tess = 0.0f; } else { tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams); tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams); tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams); tess.w = (tess.x + tess.y + tess.z) / 3.0f; } return tess; } #endif //ASE_TESS_FUNCS ENDHLSL Pass { Name "Forward Unlit" Tags { "LightMode"="ForwardOnly" } Blend [_SrcBlend] [_DstBlend], [_AlphaSrcBlend] [_AlphaDstBlend] Blend 1 One OneMinusSrcAlpha Blend 2 One [_DstBlend2] Blend 3 One [_DstBlend2] Blend 4 One OneMinusSrcAlpha Cull [_CullModeForward] ZTest [_ZTestDepthEqualForOpaque] ZWrite [_ZWrite] ColorMask [_ColorMaskTransparentVel] 1 Stencil { Ref [_StencilRef] WriteMask [_StencilWriteMask] Comp Always Pass Replace } HLSLPROGRAM #pragma multi_compile_instancing #pragma instancing_options renderinglayer #define ASE_VERSION 19801 #define ASE_SRP_VERSION -1 #define REQUIRE_OPAQUE_TEXTURE 1 #pragma shader_feature _SURFACE_TYPE_TRANSPARENT #pragma shader_feature_local _ALPHATEST_ON #pragma multi_compile _ DEBUG_DISPLAY #pragma multi_compile _ DOTS_INSTANCING_ON #pragma vertex Vert #pragma fragment Frag #if (defined(_TRANSPARENT_WRITES_MOTION_VEC) || defined(_TRANSPARENT_REFRACTIVE_SORT)) && defined(_SURFACE_TYPE_TRANSPARENT) #define _WRITE_TRANSPARENT_MOTION_VECTOR #endif #define SHADERPASS SHADERPASS_FORWARD_UNLIT #define SUPPORT_GLOBAL_MIP_BIAS 1 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" #if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT #define LIGHTLOOP_DISABLE_TILE_AND_CLUSTER #define HAS_LIGHTLOOP #define SHADOW_OPTIMIZE_REGISTER_USAGE 1 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonLighting.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowContext.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/HDShadow.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/PunctualLightCommon.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/HDShadowLoop.hlsl" #endif CBUFFER_START( UnityPerMaterial ) float4 _VignetteMask_ST; float4 _CloudColor; float2 _DistortionTile; float2 _CloudTiling; float _CausticsScale; float _CausticsSpeed; float _CausticsStrength; float _DistortValue; float _DistortionSpeed1; float _GrayScalePower; float _Bias; float _Scale; float _Power; float _CloudDirection; float _CloudBrightness; float _EmissionPower; float4 _EmissionColor; float _RenderQueueType; #ifdef _ADD_PRECOMPUTED_VELOCITY float _AddPrecomputedVelocity; #endif #ifdef _ENABLE_SHADOW_MATTE float _ShadowMatteFilter; #endif float _StencilRef; float _StencilWriteMask; float _StencilRefDepth; float _StencilWriteMaskDepth; float _StencilRefMV; float _StencilWriteMaskMV; float _StencilRefDistortionVec; float _StencilWriteMaskDistortionVec; float _StencilWriteMaskGBuffer; float _StencilRefGBuffer; float _ZTestGBuffer; float _RequireSplitLighting; float _ReceivesSSR; float _SurfaceType; float _BlendMode; float _SrcBlend; float _DstBlend; float _DstBlend2; float _AlphaSrcBlend; float _AlphaDstBlend; float _ZWrite; float _TransparentZWrite; float _CullMode; float _TransparentSortPriority; float _EnableFogOnTransparent; float _CullModeForward; float _TransparentCullMode; float _ZTestDepthEqualForOpaque; float _ZTestTransparent; float _TransparentBackfaceEnable; float _AlphaCutoffEnable; float _AlphaCutoff; float _UseShadowThreshold; float _DoubleSidedEnable; float _DoubleSidedNormalMode; float4 _DoubleSidedConstants; float _EnableBlendModePreserveSpecularLighting; #ifdef ASE_TESSELLATION float _TessPhongStrength; float _TessValue; float _TessMin; float _TessMax; float _TessEdgeLength; float _TessMaxDisp; #endif CBUFFER_END sampler2D _Normals; sampler2D _VignetteMask; sampler2D _TextureSample4; sampler2D _TextureSample1; #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/Unlit.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" #define ASE_NEEDS_FRAG_SCREEN_POSITION #define ASE_NEEDS_FRAG_WORLD_VIEW_DIR #define ASE_NEEDS_VERT_NORMAL struct VertexInput { float3 positionOS : POSITION; float3 normalOS : NORMAL; float4 ase_texcoord : TEXCOORD0; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct VertexOutput { float4 positionCS : SV_Position; float4 clipPosV : TEXCOORD0; float3 positionRWS : TEXCOORD1; float4 ase_texcoord2 : TEXCOORD2; float4 ase_texcoord3 : TEXCOORD3; UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO }; float2 voronoihash79( float2 p ) { p = float2( dot( p, float2( 127.1, 311.7 ) ), dot( p, float2( 269.5, 183.3 ) ) ); return frac( sin( p ) *43758.5453); } float voronoi79( float2 v, float time, inout float2 id, inout float2 mr, float smoothness, inout float2 smoothId ) { float2 n = floor( v ); float2 f = frac( v ); float F1 = 8.0; float F2 = 8.0; float2 mg = 0; for ( int j = -2; j <= 2; j++ ) { for ( int i = -2; i <= 2; i++ ) { float2 g = float2( i, j ); float2 o = voronoihash79( n + g ); o = ( sin( time + o * 6.2831 ) * 0.5 + 0.5 ); float2 r = f - g - o; float d = 0.5 * dot( r, r ); if( d v) { TessellationFactors o; float4 tf = 1; float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; #if (SHADEROPTIONS_CAMERA_RELATIVE_RENDERING != 0) float3 cameraPos = 0; #else float3 cameraPos = _WorldSpaceCameraPos; #endif #if defined(ASE_FIXED_TESSELLATION) tf = FixedTess( tessValue ); #elif defined(ASE_DISTANCE_TESSELLATION) tf = DistanceBasedTess(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), cameraPos ); #elif defined(ASE_LENGTH_TESSELLATION) tf = EdgeLengthBasedTess(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), edgeLength, GetObjectToWorldMatrix(), cameraPos, _ScreenParams ); #elif defined(ASE_LENGTH_CULL_TESSELLATION) tf = EdgeLengthBasedTessCull(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), cameraPos, _ScreenParams, _FrustumPlanes ); #endif o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; return o; } [domain("tri")] [partitioning("fractional_odd")] [outputtopology("triangle_cw")] [patchconstantfunc("TessellationFunction")] [outputcontrolpoints(3)] VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) { return patch[id]; } [domain("tri")] VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) { VertexInput o = (VertexInput) 0; o.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; o.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; #if defined(ASE_PHONG_TESSELLATION) float3 pp[3]; for (int i = 0; i < 3; ++i) pp[i] = o.positionOS.xyz - patch[i].normalOS * (dot(o.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); float phongStrength = _TessPhongStrength; o.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.positionOS.xyz; #endif UNITY_TRANSFER_INSTANCE_ID(patch[0], o); return VertexFunction(o); } #else VertexOutput Vert ( VertexInput v ) { return VertexFunction( v ); } #endif #ifdef UNITY_VIRTUAL_TEXTURING #define VT_BUFFER_TARGET SV_Target1 #define EXTRA_BUFFER_TARGET SV_Target2 #else #define EXTRA_BUFFER_TARGET SV_Target1 #endif void Frag( VertexOutput packedInput, out float4 outColor : SV_Target0 #ifdef UNITY_VIRTUAL_TEXTURING ,out float4 outVTFeedback : VT_BUFFER_TARGET #endif #ifdef _DEPTHOFFSET_ON , out float outputDepth : DEPTH_OFFSET_SEMANTIC #endif ) { UNITY_SETUP_INSTANCE_ID( packedInput ); UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( packedInput ); float3 PositionRWS = packedInput.positionRWS; float3 V = GetWorldSpaceNormalizeViewDir( packedInput.positionRWS ); float4 ClipPos = packedInput.clipPosV; float4 ScreenPos = ComputeScreenPos( packedInput.clipPosV, _ProjectionParams.x ); FragInputs input; ZERO_INITIALIZE(FragInputs, input); input.tangentToWorld = k_identity3x3; input.positionSS = packedInput.positionCS; input.positionRWS = PositionRWS; PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); SurfaceDescription surfaceDescription = (SurfaceDescription)0; float time79 = ( _CausticsSpeed * _TimeParameters.x ); float2 voronoiSmoothId79 = 0; float2 coords79 = packedInput.ase_texcoord2.xy * _CausticsScale; float2 id79 = 0; float2 uv79 = 0; float voroi79 = voronoi79( coords79, time79, id79, uv79, 0, voronoiSmoothId79 ); float temp_output_86_0 = ( voroi79 * _CausticsStrength ); float4 ase_grabScreenPos = ASE_ComputeGrabScreenPos( ScreenPos ); float4 ase_grabScreenPosNorm = ase_grabScreenPos / ase_grabScreenPos.w; float DistortValue31 = _DistortValue; float2 temp_cast_0 = (( _TimeParameters.x * _DistortionSpeed1 )).xx; float2 texCoord28 = packedInput.ase_texcoord2.xy * _DistortionTile + temp_cast_0; float3 Normals32 = UnpackNormalScale( tex2D( _Normals, texCoord28 ), 1.0f ); float4 fetchOpaqueVal46 = ASEHDSampleSceneColor(( (ase_grabScreenPosNorm).xyzw + float4( ( DistortValue31 * Normals32 ) , 0.0 ) ).xy.xy, 0.0, 1.0); float4 temp_output_52_0 = saturate( ( fetchOpaqueVal46 / float4( 1,1,1,0 ) ) ); float grayscale55 = dot(temp_output_52_0.rgb, float3(0.299,0.587,0.114)); float4 temp_cast_4 = (grayscale55).xxxx; float4 lerpResult58 = lerp( temp_output_52_0 , temp_cast_4 , _GrayScalePower); float3 ase_normalWS = packedInput.ase_texcoord3.xyz; float fresnelNdotV23 = dot( ase_normalWS, V ); float fresnelNode23 = ( _Bias + _Scale * pow( 1.0 - fresnelNdotV23, _Power ) ); float temp_output_70_0 = ( 1.0 - fresnelNode23 ); float2 uv_VignetteMask = packedInput.ase_texcoord2.xy * _VignetteMask_ST.xy + _VignetteMask_ST.zw; float2 texCoord101 = packedInput.ase_texcoord2.xy * float2( 0.17,0.14 ) + float2( 0,0 ); float4 temp_output_94_0 = ( ( temp_output_70_0 * tex2D( _VignetteMask, uv_VignetteMask ) ) * tex2D( _TextureSample4, texCoord101 ) ); float4 temp_output_102_0 = ( temp_output_94_0 * 0.29 ); float2 temp_cast_5 = (( _CloudDirection * _TimeParameters.x )).xx; float2 texCoord42 = packedInput.ase_texcoord2.xy * _CloudTiling + temp_cast_5; float4 tex2DNode45 = tex2D( _TextureSample1, texCoord42 ); float4 clampResult51 = clamp( ( temp_output_102_0 * tex2DNode45 ) , float4( 0,0,0,0 ) , float4( 0.2150944,0.2150944,0.2150944,0 ) ); float4 temp_output_71_0 = ( ( lerpResult58 + ( ( clampResult51 * _CloudBrightness ) * _CloudColor ) ) * _EmissionPower ); float4 temp_output_75_0 = ( temp_output_71_0 * temp_output_70_0 ); surfaceDescription.Color = ( temp_output_86_0 * temp_output_71_0 ).rgb; surfaceDescription.Emission = temp_output_75_0.rgb; surfaceDescription.Alpha = temp_output_102_0.r; surfaceDescription.AlphaClipThreshold = _AlphaCutoff; surfaceDescription.ShadowTint = float4( 0, 0 ,0 ,1 ); float2 Distortion = float2 ( 0, 0 ); float DistortionBlur = 0; surfaceDescription.VTPackedFeedback = float4(1.0f,1.0f,1.0f,1.0f); SurfaceData surfaceData; BuiltinData builtinData; GetSurfaceAndBuiltinData(surfaceDescription, input, V, posInput, surfaceData, builtinData); BSDFData bsdfData = ConvertSurfaceDataToBSDFData( input.positionSS.xy, surfaceData ); #if defined(_ENABLE_SHADOW_MATTE) bsdfData.color *= GetScreenSpaceAmbientOcclusion(input.positionSS.xy); #endif #ifdef DEBUG_DISPLAY if (_DebugLightingMode >= DEBUGLIGHTINGMODE_DIFFUSE_LIGHTING && _DebugLightingMode <= DEBUGLIGHTINGMODE_EMISSIVE_LIGHTING) { if (_DebugLightingMode != DEBUGLIGHTINGMODE_EMISSIVE_LIGHTING) { builtinData.emissiveColor = 0.0; } else { bsdfData.color = 0.0; } } #endif float4 outResult = ApplyBlendMode(bsdfData.color * GetDeExposureMultiplier() + builtinData.emissiveColor * GetCurrentExposureMultiplier(), builtinData.opacity); outResult = EvaluateAtmosphericScattering(posInput, V, outResult); #ifdef DEBUG_DISPLAY int bufferSize = int(_DebugViewMaterialArray[0].x); for (int index = 1; index <= bufferSize; index++) { int indexMaterialProperty = int(_DebugViewMaterialArray[index].x); if (indexMaterialProperty != 0) { float3 result = float3(1.0, 0.0, 1.0); bool needLinearToSRGB = false; GetPropertiesDataDebug(indexMaterialProperty, result, needLinearToSRGB); GetVaryingsDataDebug(indexMaterialProperty, input, result, needLinearToSRGB); GetBuiltinDataDebug(indexMaterialProperty, builtinData, posInput, result, needLinearToSRGB); GetSurfaceDataDebug(indexMaterialProperty, surfaceData, result, needLinearToSRGB); GetBSDFDataDebug(indexMaterialProperty, bsdfData, result, needLinearToSRGB); if (!needLinearToSRGB) result = SRGBToLinear(max(0, result)); outResult = float4(result, 1.0); } } if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_TRANSPARENCY_OVERDRAW) { float4 result = _DebugTransparencyOverdrawWeight * float4(TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_A); outResult = result; } #endif outColor = outResult; #ifdef _DEPTHOFFSET_ON outputDepth = posInput.deviceDepth; #endif #ifdef UNITY_VIRTUAL_TEXTURING outVTFeedback = builtinData.vtPackedFeedback; #endif } ENDHLSL } Pass { Name "ShadowCaster" Tags { "LightMode"="ShadowCaster" } Cull [_CullMode] ZWrite On ZClip [_ZClip] ColorMask 0 HLSLPROGRAM #pragma multi_compile_instancing #pragma instancing_options renderinglayer #define ASE_VERSION 19801 #define ASE_SRP_VERSION -1 #pragma shader_feature _SURFACE_TYPE_TRANSPARENT #pragma shader_feature_local _ALPHATEST_ON #pragma multi_compile _ DOTS_INSTANCING_ON #pragma vertex Vert #pragma fragment Frag #if (defined(_TRANSPARENT_WRITES_MOTION_VEC) || defined(_TRANSPARENT_REFRACTIVE_SORT)) && defined(_SURFACE_TYPE_TRANSPARENT) #define _WRITE_TRANSPARENT_MOTION_VECTOR #endif #define SHADERPASS SHADERPASS_SHADOWS #define SUPPORT_GLOBAL_MIP_BIAS 1 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" #define ASE_NEEDS_FRAG_WORLD_VIEW_DIR #define ASE_NEEDS_VERT_NORMAL struct VertexInput { float3 positionOS : POSITION; float3 normalOS : NORMAL; float4 ase_texcoord : TEXCOORD0; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct VertexOutput { float4 positionCS : SV_Position; float4 clipPosV : TEXCOORD0; float3 positionRWS : TEXCOORD1; float4 ase_texcoord2 : TEXCOORD2; float4 ase_texcoord3 : TEXCOORD3; UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO }; CBUFFER_START( UnityPerMaterial ) float4 _VignetteMask_ST; float4 _CloudColor; float2 _DistortionTile; float2 _CloudTiling; float _CausticsScale; float _CausticsSpeed; float _CausticsStrength; float _DistortValue; float _DistortionSpeed1; float _GrayScalePower; float _Bias; float _Scale; float _Power; float _CloudDirection; float _CloudBrightness; float _EmissionPower; float4 _EmissionColor; float _RenderQueueType; #ifdef _ADD_PRECOMPUTED_VELOCITY float _AddPrecomputedVelocity; #endif #ifdef _ENABLE_SHADOW_MATTE float _ShadowMatteFilter; #endif float _StencilRef; float _StencilWriteMask; float _StencilRefDepth; float _StencilWriteMaskDepth; float _StencilRefMV; float _StencilWriteMaskMV; float _StencilRefDistortionVec; float _StencilWriteMaskDistortionVec; float _StencilWriteMaskGBuffer; float _StencilRefGBuffer; float _ZTestGBuffer; float _RequireSplitLighting; float _ReceivesSSR; float _SurfaceType; float _BlendMode; float _SrcBlend; float _DstBlend; float _DstBlend2; float _AlphaSrcBlend; float _AlphaDstBlend; float _ZWrite; float _TransparentZWrite; float _CullMode; float _TransparentSortPriority; float _EnableFogOnTransparent; float _CullModeForward; float _TransparentCullMode; float _ZTestDepthEqualForOpaque; float _ZTestTransparent; float _TransparentBackfaceEnable; float _AlphaCutoffEnable; float _AlphaCutoff; float _UseShadowThreshold; float _DoubleSidedEnable; float _DoubleSidedNormalMode; float4 _DoubleSidedConstants; float _EnableBlendModePreserveSpecularLighting; #ifdef ASE_TESSELLATION float _TessPhongStrength; float _TessValue; float _TessMin; float _TessMax; float _TessEdgeLength; float _TessMaxDisp; #endif CBUFFER_END sampler2D _VignetteMask; sampler2D _TextureSample4; #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/Unlit.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" struct SurfaceDescription { float Alpha; float AlphaClipThreshold; }; void BuildSurfaceData(FragInputs fragInputs, SurfaceDescription surfaceDescription, float3 V, out SurfaceData surfaceData) { ZERO_INITIALIZE(SurfaceData, surfaceData); #ifdef WRITE_NORMAL_BUFFER surfaceData.normalWS = fragInputs.tangentToWorld[2]; #endif } void GetSurfaceAndBuiltinData(SurfaceDescription surfaceDescription, FragInputs fragInputs, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData) { #ifdef LOD_FADE_CROSSFADE LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); #endif #if _ALPHATEST_ON DoAlphaTest(surfaceDescription.Alpha, surfaceDescription.AlphaClipThreshold); #endif #if _DEPTHOFFSET_ON ApplyDepthOffsetPositionInput(V, surfaceDescription.DepthOffset, GetViewForwardDir(), GetWorldToHClipMatrix(), posInput); #endif BuildSurfaceData(fragInputs, surfaceDescription, V, surfaceData); ZERO_INITIALIZE (BuiltinData, builtinData); builtinData.opacity = surfaceDescription.Alpha; #if defined(DEBUG_DISPLAY) builtinData.renderingLayers = GetMeshRenderingLayerMask(); #endif #ifdef _ALPHATEST_ON builtinData.alphaClipTreshold = surfaceDescription.AlphaClipThreshold; #endif #if _DEPTHOFFSET_ON builtinData.depthOffset = surfaceDescription.DepthOffset; #endif ApplyDebugToBuiltinData(builtinData); } VertexOutput VertexFunction( VertexInput inputMesh ) { VertexOutput o; UNITY_SETUP_INSTANCE_ID(inputMesh); UNITY_TRANSFER_INSTANCE_ID(inputMesh, o); UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o ); float3 ase_normalWS = TransformObjectToWorldNormal( inputMesh.normalOS ); o.ase_texcoord2.xyz = ase_normalWS; o.ase_texcoord3.xy = inputMesh.ase_texcoord.xy; //setting value to unused interpolator channels and avoid initialization warnings o.ase_texcoord2.w = 0; o.ase_texcoord3.zw = 0; #ifdef ASE_ABSOLUTE_VERTEX_POS float3 defaultVertexValue = inputMesh.positionOS.xyz; #else float3 defaultVertexValue = float3( 0, 0, 0 ); #endif float3 vertexValue = defaultVertexValue ; #ifdef ASE_ABSOLUTE_VERTEX_POS inputMesh.positionOS.xyz = vertexValue; #else inputMesh.positionOS.xyz += vertexValue; #endif inputMesh.normalOS = inputMesh.normalOS ; float3 positionRWS = TransformObjectToWorld(inputMesh.positionOS); o.positionCS = TransformWorldToHClip(positionRWS); o.clipPosV = o.positionCS; o.positionRWS = positionRWS; return o; } #if defined(ASE_TESSELLATION) struct VertexControl { float3 positionOS : INTERNALTESSPOS; float3 normalOS : NORMAL; float4 ase_texcoord : TEXCOORD0; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct TessellationFactors { float edge[3] : SV_TessFactor; float inside : SV_InsideTessFactor; }; VertexControl Vert ( VertexInput v ) { VertexControl o; UNITY_SETUP_INSTANCE_ID(v); UNITY_TRANSFER_INSTANCE_ID(v, o); o.positionOS = v.positionOS; o.normalOS = v.normalOS; o.ase_texcoord = v.ase_texcoord; return o; } TessellationFactors TessellationFunction (InputPatch v) { TessellationFactors o; float4 tf = 1; float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; #if (SHADEROPTIONS_CAMERA_RELATIVE_RENDERING != 0) float3 cameraPos = 0; #else float3 cameraPos = _WorldSpaceCameraPos; #endif #if defined(ASE_FIXED_TESSELLATION) tf = FixedTess( tessValue ); #elif defined(ASE_DISTANCE_TESSELLATION) tf = DistanceBasedTess(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), cameraPos ); #elif defined(ASE_LENGTH_TESSELLATION) tf = EdgeLengthBasedTess(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), edgeLength, GetObjectToWorldMatrix(), cameraPos, _ScreenParams ); #elif defined(ASE_LENGTH_CULL_TESSELLATION) tf = EdgeLengthBasedTessCull(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), cameraPos, _ScreenParams, _FrustumPlanes ); #endif o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; return o; } [domain("tri")] [partitioning("fractional_odd")] [outputtopology("triangle_cw")] [patchconstantfunc("TessellationFunction")] [outputcontrolpoints(3)] VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) { return patch[id]; } [domain("tri")] VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) { VertexInput o = (VertexInput) 0; o.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; o.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; #if defined(ASE_PHONG_TESSELLATION) float3 pp[3]; for (int i = 0; i < 3; ++i) pp[i] = o.positionOS.xyz - patch[i].normalOS * (dot(o.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); float phongStrength = _TessPhongStrength; o.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.positionOS.xyz; #endif UNITY_TRANSFER_INSTANCE_ID(patch[0], o); return VertexFunction(o); } #else VertexOutput Vert ( VertexInput v ) { return VertexFunction( v ); } #endif void Frag( VertexOutput packedInput #ifdef WRITE_MSAA_DEPTH , out float4 depthColor : SV_Target0 #ifdef WRITE_NORMAL_BUFFER , out float4 outNormalBuffer : SV_Target1 #endif #else #ifdef WRITE_NORMAL_BUFFER , out float4 outNormalBuffer : SV_Target0 #endif #endif #if defined(_DEPTHOFFSET_ON) , out float outputDepth : DEPTH_OFFSET_SEMANTIC #endif ) { UNITY_SETUP_INSTANCE_ID( packedInput ); UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( packedInput ); float3 PositionRWS = packedInput.positionRWS; float3 V = GetWorldSpaceNormalizeViewDir( packedInput.positionRWS ); float4 ClipPos = packedInput.clipPosV; float4 ScreenPos = ComputeScreenPos( packedInput.clipPosV, _ProjectionParams.x ); FragInputs input; ZERO_INITIALIZE(FragInputs, input); input.tangentToWorld = k_identity3x3; input.positionSS = packedInput.positionCS; input.positionRWS = PositionRWS; PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); SurfaceDescription surfaceDescription = (SurfaceDescription)0; float3 ase_normalWS = packedInput.ase_texcoord2.xyz; float fresnelNdotV23 = dot( ase_normalWS, V ); float fresnelNode23 = ( _Bias + _Scale * pow( 1.0 - fresnelNdotV23, _Power ) ); float temp_output_70_0 = ( 1.0 - fresnelNode23 ); float2 uv_VignetteMask = packedInput.ase_texcoord3.xy * _VignetteMask_ST.xy + _VignetteMask_ST.zw; float2 texCoord101 = packedInput.ase_texcoord3.xy * float2( 0.17,0.14 ) + float2( 0,0 ); float4 temp_output_94_0 = ( ( temp_output_70_0 * tex2D( _VignetteMask, uv_VignetteMask ) ) * tex2D( _TextureSample4, texCoord101 ) ); float4 temp_output_102_0 = ( temp_output_94_0 * 0.29 ); surfaceDescription.Alpha = temp_output_102_0.r; surfaceDescription.AlphaClipThreshold = _AlphaCutoff; SurfaceData surfaceData; BuiltinData builtinData; GetSurfaceAndBuiltinData(surfaceDescription,input, V, posInput, surfaceData, builtinData); #if defined(_DEPTHOFFSET_ON) outputDepth = posInput.deviceDepth; float bias = max(abs(ddx(posInput.deviceDepth)), abs(ddy(posInput.deviceDepth))) * _SlopeScaleDepthBias; outputDepth += bias; #endif #ifdef WRITE_MSAA_DEPTH depthColor = packedInput.vmesh.positionCS.z; depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); #endif #if defined(WRITE_NORMAL_BUFFER) EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); #endif #if (defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS)) || defined(WRITE_RENDERING_LAYER) DecalPrepassData decalPrepassData; #ifdef _DISABLE_DECALS ZERO_INITIALIZE(DecalPrepassData, decalPrepassData); #else decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; #endif decalPrepassData.renderingLayerMask = GetMeshRenderingLayerMask(); EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); #endif } ENDHLSL } Pass { Name "META" Tags { "LightMode"="Meta" } Cull Off HLSLPROGRAM #pragma multi_compile_instancing #pragma instancing_options renderinglayer #define ASE_VERSION 19801 #define ASE_SRP_VERSION -1 #define REQUIRE_OPAQUE_TEXTURE 1 #pragma shader_feature _SURFACE_TYPE_TRANSPARENT #pragma shader_feature_local _ALPHATEST_ON #pragma shader_feature EDITOR_VISUALIZATION #pragma multi_compile _ DOTS_INSTANCING_ON #pragma vertex Vert #pragma fragment Frag #define SHADERPASS SHADERPASS_LIGHT_TRANSPORT #define SCENEPICKINGPASS #define SUPPORT_GLOBAL_MIP_BIAS 1 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/PickingSpaceTransforms.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" CBUFFER_START( UnityPerMaterial ) float4 _VignetteMask_ST; float4 _CloudColor; float2 _DistortionTile; float2 _CloudTiling; float _CausticsScale; float _CausticsSpeed; float _CausticsStrength; float _DistortValue; float _DistortionSpeed1; float _GrayScalePower; float _Bias; float _Scale; float _Power; float _CloudDirection; float _CloudBrightness; float _EmissionPower; float4 _EmissionColor; float _RenderQueueType; #ifdef _ADD_PRECOMPUTED_VELOCITY float _AddPrecomputedVelocity; #endif #ifdef _ENABLE_SHADOW_MATTE float _ShadowMatteFilter; #endif float _StencilRef; float _StencilWriteMask; float _StencilRefDepth; float _StencilWriteMaskDepth; float _StencilRefMV; float _StencilWriteMaskMV; float _StencilRefDistortionVec; float _StencilWriteMaskDistortionVec; float _StencilWriteMaskGBuffer; float _StencilRefGBuffer; float _ZTestGBuffer; float _RequireSplitLighting; float _ReceivesSSR; float _SurfaceType; float _BlendMode; float _SrcBlend; float _DstBlend; float _DstBlend2; float _AlphaSrcBlend; float _AlphaDstBlend; float _ZWrite; float _TransparentZWrite; float _CullMode; float _TransparentSortPriority; float _EnableFogOnTransparent; float _CullModeForward; float _TransparentCullMode; float _ZTestDepthEqualForOpaque; float _ZTestTransparent; float _TransparentBackfaceEnable; float _AlphaCutoffEnable; float _AlphaCutoff; float _UseShadowThreshold; float _DoubleSidedEnable; float _DoubleSidedNormalMode; float4 _DoubleSidedConstants; float _EnableBlendModePreserveSpecularLighting; #ifdef ASE_TESSELLATION float _TessPhongStrength; float _TessValue; float _TessMin; float _TessMax; float _TessEdgeLength; float _TessMaxDisp; #endif CBUFFER_END sampler2D _Normals; sampler2D _VignetteMask; sampler2D _TextureSample4; sampler2D _TextureSample1; #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/Unlit.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" #define ASE_NEEDS_VERT_NORMAL struct VertexInput { float3 positionOS : POSITION; float3 normalOS : NORMAL; float4 uv0 : TEXCOORD0; float4 uv1 : TEXCOORD1; float4 uv2 : TEXCOORD2; float4 uv3 : TEXCOORD3; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct VertexOutput { float4 positionCS : SV_Position; #ifdef EDITOR_VISUALIZATION float2 VizUV : TEXCOORD0; float4 LightCoord : TEXCOORD1; #endif float4 ase_texcoord2 : TEXCOORD2; float4 ase_texcoord3 : TEXCOORD3; float4 ase_texcoord4 : TEXCOORD4; float4 ase_texcoord5 : TEXCOORD5; UNITY_VERTEX_INPUT_INSTANCE_ID }; float2 voronoihash79( float2 p ) { p = float2( dot( p, float2( 127.1, 311.7 ) ), dot( p, float2( 269.5, 183.3 ) ) ); return frac( sin( p ) *43758.5453); } float voronoi79( float2 v, float time, inout float2 id, inout float2 mr, float smoothness, inout float2 smoothId ) { float2 n = floor( v ); float2 f = frac( v ); float F1 = 8.0; float F2 = 8.0; float2 mg = 0; for ( int j = -2; j <= 2; j++ ) { for ( int i = -2; i <= 2; i++ ) { float2 g = float2( i, j ); float2 o = voronoihash79( n + g ); o = ( sin( time + o * 6.2831 ) * 0.5 + 0.5 ); float2 r = f - g - o; float d = 0.5 * dot( r, r ); if( d 0 ? 1.0e-4 : 0.0, 1.0 ); return o; } #if defined(ASE_TESSELLATION) struct VertexControl { float3 positionOS : INTERNALTESSPOS; float3 normalOS : NORMAL; float4 uv0 : TEXCOORD0; float4 uv1 : TEXCOORD1; float4 uv2 : TEXCOORD2; float4 uv3 : TEXCOORD3; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct TessellationFactors { float edge[3] : SV_TessFactor; float inside : SV_InsideTessFactor; }; VertexControl Vert ( VertexInput v ) { VertexControl o; UNITY_SETUP_INSTANCE_ID(v); UNITY_TRANSFER_INSTANCE_ID(v, o); o.positionOS = v.positionOS; o.normalOS = v.normalOS; o.uv0 = v.uv0; o.uv1 = v.uv1; o.uv2 = v.uv2; o.uv3 = v.uv3; return o; } TessellationFactors TessellationFunction (InputPatch v) { TessellationFactors o; float4 tf = 1; float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; #if (SHADEROPTIONS_CAMERA_RELATIVE_RENDERING != 0) float3 cameraPos = 0; #else float3 cameraPos = _WorldSpaceCameraPos; #endif #if defined(ASE_FIXED_TESSELLATION) tf = FixedTess( tessValue ); #elif defined(ASE_DISTANCE_TESSELLATION) tf = DistanceBasedTess(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), cameraPos ); #elif defined(ASE_LENGTH_TESSELLATION) tf = EdgeLengthBasedTess(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), edgeLength, GetObjectToWorldMatrix(), cameraPos, _ScreenParams ); #elif defined(ASE_LENGTH_CULL_TESSELLATION) tf = EdgeLengthBasedTessCull(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), cameraPos, _ScreenParams, _FrustumPlanes ); #endif o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; return o; } [domain("tri")] [partitioning("fractional_odd")] [outputtopology("triangle_cw")] [patchconstantfunc("TessellationFunction")] [outputcontrolpoints(3)] VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) { return patch[id]; } [domain("tri")] VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) { VertexInput o = (VertexInput) 0; o.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; o.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; o.uv0 = patch[0].uv0 * bary.x + patch[1].uv0 * bary.y + patch[2].uv0 * bary.z; o.uv1 = patch[0].uv1 * bary.x + patch[1].uv1 * bary.y + patch[2].uv1 * bary.z; o.uv2 = patch[0].uv2 * bary.x + patch[1].uv2 * bary.y + patch[2].uv2 * bary.z; o.uv3 = patch[0].uv3 * bary.x + patch[1].uv3 * bary.y + patch[2].uv3 * bary.z; #if defined(ASE_PHONG_TESSELLATION) float3 pp[3]; for (int i = 0; i < 3; ++i) pp[i] = o.positionOS.xyz - patch[i].normalOS * (dot(o.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); float phongStrength = _TessPhongStrength; o.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.positionOS.xyz; #endif UNITY_TRANSFER_INSTANCE_ID(patch[0], o); return VertexFunction(o); } #else VertexOutput Vert ( VertexInput v ) { return VertexFunction( v ); } #endif float4 Frag( VertexOutput packedInput ) : SV_Target { UNITY_SETUP_INSTANCE_ID( packedInput ); FragInputs input; ZERO_INITIALIZE( FragInputs, input ); input.tangentToWorld = k_identity3x3; input.positionSS = packedInput.positionCS; PositionInputs posInput = GetPositionInput( input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS ); float3 V = float3( 1.0, 1.0, 1.0 ); SurfaceDescription surfaceDescription = (SurfaceDescription)0; float time79 = ( _CausticsSpeed * _TimeParameters.x ); float2 voronoiSmoothId79 = 0; float2 coords79 = packedInput.ase_texcoord2.xy * _CausticsScale; float2 id79 = 0; float2 uv79 = 0; float voroi79 = voronoi79( coords79, time79, id79, uv79, 0, voronoiSmoothId79 ); float temp_output_86_0 = ( voroi79 * _CausticsStrength ); float4 screenPos = packedInput.ase_texcoord3; float4 ase_grabScreenPos = ASE_ComputeGrabScreenPos( screenPos ); float4 ase_grabScreenPosNorm = ase_grabScreenPos / ase_grabScreenPos.w; float DistortValue31 = _DistortValue; float2 temp_cast_0 = (( _TimeParameters.x * _DistortionSpeed1 )).xx; float2 texCoord28 = packedInput.ase_texcoord2.xy * _DistortionTile + temp_cast_0; float3 Normals32 = UnpackNormalScale( tex2D( _Normals, texCoord28 ), 1.0f ); float4 fetchOpaqueVal46 = ASEHDSampleSceneColor(( (ase_grabScreenPosNorm).xyzw + float4( ( DistortValue31 * Normals32 ) , 0.0 ) ).xy.xy, 0.0, 1.0); float4 temp_output_52_0 = saturate( ( fetchOpaqueVal46 / float4( 1,1,1,0 ) ) ); float grayscale55 = dot(temp_output_52_0.rgb, float3(0.299,0.587,0.114)); float4 temp_cast_4 = (grayscale55).xxxx; float4 lerpResult58 = lerp( temp_output_52_0 , temp_cast_4 , _GrayScalePower); float3 ase_positionWS = packedInput.ase_texcoord4.xyz; float3 ase_viewVectorWS = ( _WorldSpaceCameraPos.xyz - ase_positionWS ); float3 ase_viewDirWS = normalize( ase_viewVectorWS ); float3 ase_normalWS = packedInput.ase_texcoord5.xyz; float fresnelNdotV23 = dot( ase_normalWS, ase_viewDirWS ); float fresnelNode23 = ( _Bias + _Scale * pow( 1.0 - fresnelNdotV23, _Power ) ); float temp_output_70_0 = ( 1.0 - fresnelNode23 ); float2 uv_VignetteMask = packedInput.ase_texcoord2.xy * _VignetteMask_ST.xy + _VignetteMask_ST.zw; float2 texCoord101 = packedInput.ase_texcoord2.xy * float2( 0.17,0.14 ) + float2( 0,0 ); float4 temp_output_94_0 = ( ( temp_output_70_0 * tex2D( _VignetteMask, uv_VignetteMask ) ) * tex2D( _TextureSample4, texCoord101 ) ); float4 temp_output_102_0 = ( temp_output_94_0 * 0.29 ); float2 temp_cast_5 = (( _CloudDirection * _TimeParameters.x )).xx; float2 texCoord42 = packedInput.ase_texcoord2.xy * _CloudTiling + temp_cast_5; float4 tex2DNode45 = tex2D( _TextureSample1, texCoord42 ); float4 clampResult51 = clamp( ( temp_output_102_0 * tex2DNode45 ) , float4( 0,0,0,0 ) , float4( 0.2150944,0.2150944,0.2150944,0 ) ); float4 temp_output_71_0 = ( ( lerpResult58 + ( ( clampResult51 * _CloudBrightness ) * _CloudColor ) ) * _EmissionPower ); float4 temp_output_75_0 = ( temp_output_71_0 * temp_output_70_0 ); surfaceDescription.Color = ( temp_output_86_0 * temp_output_71_0 ).rgb; surfaceDescription.Emission = temp_output_75_0.rgb; surfaceDescription.Alpha = temp_output_102_0.r; surfaceDescription.AlphaClipThreshold = _AlphaCutoff; SurfaceData surfaceData; BuiltinData builtinData; GetSurfaceAndBuiltinData( surfaceDescription,input, V, posInput, surfaceData, builtinData ); BSDFData bsdfData = ConvertSurfaceDataToBSDFData( input.positionSS.xy, surfaceData ); LightTransportData lightTransportData = GetLightTransportData( surfaceData, builtinData, bsdfData ); float4 res = float4( 0.0, 0.0, 0.0, 1.0 ); UnityMetaInput metaInput; metaInput.Albedo = lightTransportData.diffuseColor.rgb; metaInput.Emission = lightTransportData.emissiveColor; #ifdef EDITOR_VISUALIZATION metaInput.VizUV = packedInput.VizUV; metaInput.LightCoord = packedInput.LightCoord; #endif res = UnityMetaFragment(metaInput); return res; } ENDHLSL } Pass { Name "SceneSelectionPass" Tags { "LightMode"="SceneSelectionPass" } Cull Off HLSLPROGRAM #pragma multi_compile_instancing #pragma instancing_options renderinglayer #define ASE_VERSION 19801 #define ASE_SRP_VERSION -1 #pragma shader_feature _SURFACE_TYPE_TRANSPARENT #pragma shader_feature_local _ALPHATEST_ON #pragma editor_sync_compilation #pragma multi_compile _ DOTS_INSTANCING_ON #pragma vertex Vert #pragma fragment Frag #define SHADERPASS SHADERPASS_DEPTH_ONLY #define SCENESELECTIONPASS 1 #define SUPPORT_GLOBAL_MIP_BIAS 1 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" int _ObjectId; int _PassValue; CBUFFER_START( UnityPerMaterial ) float4 _VignetteMask_ST; float4 _CloudColor; float2 _DistortionTile; float2 _CloudTiling; float _CausticsScale; float _CausticsSpeed; float _CausticsStrength; float _DistortValue; float _DistortionSpeed1; float _GrayScalePower; float _Bias; float _Scale; float _Power; float _CloudDirection; float _CloudBrightness; float _EmissionPower; float4 _EmissionColor; float _RenderQueueType; #ifdef _ADD_PRECOMPUTED_VELOCITY float _AddPrecomputedVelocity; #endif #ifdef _ENABLE_SHADOW_MATTE float _ShadowMatteFilter; #endif float _StencilRef; float _StencilWriteMask; float _StencilRefDepth; float _StencilWriteMaskDepth; float _StencilRefMV; float _StencilWriteMaskMV; float _StencilRefDistortionVec; float _StencilWriteMaskDistortionVec; float _StencilWriteMaskGBuffer; float _StencilRefGBuffer; float _ZTestGBuffer; float _RequireSplitLighting; float _ReceivesSSR; float _SurfaceType; float _BlendMode; float _SrcBlend; float _DstBlend; float _DstBlend2; float _AlphaSrcBlend; float _AlphaDstBlend; float _ZWrite; float _TransparentZWrite; float _CullMode; float _TransparentSortPriority; float _EnableFogOnTransparent; float _CullModeForward; float _TransparentCullMode; float _ZTestDepthEqualForOpaque; float _ZTestTransparent; float _TransparentBackfaceEnable; float _AlphaCutoffEnable; float _AlphaCutoff; float _UseShadowThreshold; float _DoubleSidedEnable; float _DoubleSidedNormalMode; float4 _DoubleSidedConstants; float _EnableBlendModePreserveSpecularLighting; #ifdef ASE_TESSELLATION float _TessPhongStrength; float _TessValue; float _TessMin; float _TessMax; float _TessEdgeLength; float _TessMaxDisp; #endif CBUFFER_END sampler2D _VignetteMask; sampler2D _TextureSample4; #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/PickingSpaceTransforms.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/Unlit.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" #define ASE_NEEDS_VERT_NORMAL struct VertexInput { float3 positionOS : POSITION; float3 normalOS : NORMAL; float4 ase_texcoord : TEXCOORD0; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct VertexOutput { float4 positionCS : SV_Position; float4 ase_texcoord : TEXCOORD0; float4 ase_texcoord1 : TEXCOORD1; float4 ase_texcoord2 : TEXCOORD2; UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO }; struct SurfaceDescription { float Alpha; float AlphaClipThreshold; }; void BuildSurfaceData(FragInputs fragInputs, SurfaceDescription surfaceDescription, float3 V, out SurfaceData surfaceData) { ZERO_INITIALIZE(SurfaceData, surfaceData); #ifdef WRITE_NORMAL_BUFFER surfaceData.normalWS = fragInputs.tangentToWorld[2]; #endif } void GetSurfaceAndBuiltinData(SurfaceDescription surfaceDescription, FragInputs fragInputs, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData) { #ifdef LOD_FADE_CROSSFADE LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); #endif #if _ALPHATEST_ON DoAlphaTest ( surfaceDescription.Alpha, surfaceDescription.AlphaClipThreshold ); #endif BuildSurfaceData(fragInputs, surfaceDescription, V, surfaceData); ZERO_INITIALIZE(BuiltinData, builtinData); builtinData.opacity = surfaceDescription.Alpha; #ifdef _ALPHATEST_ON builtinData.alphaClipTreshold = surfaceDescription.AlphaClipThreshold; #endif #if _DEPTHOFFSET_ON builtinData.depthOffset = surfaceDescription.DepthOffset; #endif ApplyDebugToBuiltinData(builtinData); } VertexOutput VertexFunction( VertexInput inputMesh ) { VertexOutput o; UNITY_SETUP_INSTANCE_ID(inputMesh); UNITY_TRANSFER_INSTANCE_ID(inputMesh, o); UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o ); float3 ase_positionWS = GetAbsolutePositionWS( TransformObjectToWorld( ( inputMesh.positionOS ).xyz ) ); o.ase_texcoord.xyz = ase_positionWS; float3 ase_normalWS = TransformObjectToWorldNormal( inputMesh.normalOS ); o.ase_texcoord1.xyz = ase_normalWS; o.ase_texcoord2.xy = inputMesh.ase_texcoord.xy; //setting value to unused interpolator channels and avoid initialization warnings o.ase_texcoord.w = 0; o.ase_texcoord1.w = 0; o.ase_texcoord2.zw = 0; #ifdef ASE_ABSOLUTE_VERTEX_POS float3 defaultVertexValue = inputMesh.positionOS.xyz; #else float3 defaultVertexValue = float3( 0, 0, 0 ); #endif float3 vertexValue = defaultVertexValue ; #ifdef ASE_ABSOLUTE_VERTEX_POS inputMesh.positionOS.xyz = vertexValue; #else inputMesh.positionOS.xyz += vertexValue; #endif inputMesh.normalOS = inputMesh.normalOS ; float3 positionRWS = TransformObjectToWorld(inputMesh.positionOS); o.positionCS = TransformWorldToHClip(positionRWS); return o; } #if defined(ASE_TESSELLATION) struct VertexControl { float3 positionOS : INTERNALTESSPOS; float3 normalOS : NORMAL; float4 ase_texcoord : TEXCOORD0; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct TessellationFactors { float edge[3] : SV_TessFactor; float inside : SV_InsideTessFactor; }; VertexControl Vert ( VertexInput v ) { VertexControl o; UNITY_SETUP_INSTANCE_ID(v); UNITY_TRANSFER_INSTANCE_ID(v, o); o.positionOS = v.positionOS; o.normalOS = v.normalOS; o.ase_texcoord = v.ase_texcoord; return o; } TessellationFactors TessellationFunction (InputPatch v) { TessellationFactors o; float4 tf = 1; float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; #if (SHADEROPTIONS_CAMERA_RELATIVE_RENDERING != 0) float3 cameraPos = 0; #else float3 cameraPos = _WorldSpaceCameraPos; #endif #if defined(ASE_FIXED_TESSELLATION) tf = FixedTess( tessValue ); #elif defined(ASE_DISTANCE_TESSELLATION) tf = DistanceBasedTess(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), cameraPos ); #elif defined(ASE_LENGTH_TESSELLATION) tf = EdgeLengthBasedTess(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), edgeLength, GetObjectToWorldMatrix(), cameraPos, _ScreenParams ); #elif defined(ASE_LENGTH_CULL_TESSELLATION) tf = EdgeLengthBasedTessCull(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), cameraPos, _ScreenParams, _FrustumPlanes ); #endif o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; return o; } [domain("tri")] [partitioning("fractional_odd")] [outputtopology("triangle_cw")] [patchconstantfunc("TessellationFunction")] [outputcontrolpoints(3)] VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) { return patch[id]; } [domain("tri")] VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) { VertexInput o = (VertexInput) 0; o.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; o.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; #if defined(ASE_PHONG_TESSELLATION) float3 pp[3]; for (int i = 0; i < 3; ++i) pp[i] = o.positionOS.xyz - patch[i].normalOS * (dot(o.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); float phongStrength = _TessPhongStrength; o.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.positionOS.xyz; #endif UNITY_TRANSFER_INSTANCE_ID(patch[0], o); return VertexFunction(o); } #else VertexOutput Vert ( VertexInput v ) { return VertexFunction( v ); } #endif void Frag( VertexOutput packedInput , out float4 outColor : SV_Target0 #ifdef _DEPTHOFFSET_ON , out float outputDepth : SV_Depth #endif ) { UNITY_SETUP_INSTANCE_ID( packedInput ); UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( packedInput ); FragInputs input; ZERO_INITIALIZE(FragInputs, input); input.tangentToWorld = k_identity3x3; input.positionSS = packedInput.positionCS; PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); float3 V = float3( 1.0, 1.0, 1.0 ); SurfaceData surfaceData; BuiltinData builtinData; SurfaceDescription surfaceDescription = (SurfaceDescription)0; float3 ase_positionWS = packedInput.ase_texcoord.xyz; float3 ase_viewVectorWS = ( _WorldSpaceCameraPos.xyz - ase_positionWS ); float3 ase_viewDirWS = normalize( ase_viewVectorWS ); float3 ase_normalWS = packedInput.ase_texcoord1.xyz; float fresnelNdotV23 = dot( ase_normalWS, ase_viewDirWS ); float fresnelNode23 = ( _Bias + _Scale * pow( 1.0 - fresnelNdotV23, _Power ) ); float temp_output_70_0 = ( 1.0 - fresnelNode23 ); float2 uv_VignetteMask = packedInput.ase_texcoord2.xy * _VignetteMask_ST.xy + _VignetteMask_ST.zw; float2 texCoord101 = packedInput.ase_texcoord2.xy * float2( 0.17,0.14 ) + float2( 0,0 ); float4 temp_output_94_0 = ( ( temp_output_70_0 * tex2D( _VignetteMask, uv_VignetteMask ) ) * tex2D( _TextureSample4, texCoord101 ) ); float4 temp_output_102_0 = ( temp_output_94_0 * 0.29 ); surfaceDescription.Alpha = temp_output_102_0.r; surfaceDescription.AlphaClipThreshold = _AlphaCutoff; GetSurfaceAndBuiltinData(surfaceDescription, input, V, posInput, surfaceData, builtinData); #ifdef _DEPTHOFFSET_ON outputDepth = posInput.deviceDepth; #endif outColor = float4( _ObjectId, _PassValue, 1.0, 1.0 ); } ENDHLSL } Pass { Name "DepthForwardOnly" Tags { "LightMode"="DepthForwardOnly" } Cull [_CullMode] ZWrite On Stencil { Ref [_StencilRefDepth] WriteMask [_StencilWriteMaskDepth] Comp Always Pass Replace } ColorMask 0 0 HLSLPROGRAM #pragma multi_compile_instancing #pragma instancing_options renderinglayer #define ASE_VERSION 19801 #define ASE_SRP_VERSION -1 #pragma shader_feature _SURFACE_TYPE_TRANSPARENT #pragma shader_feature_local _ALPHATEST_ON #pragma multi_compile _ WRITE_MSAA_DEPTH #pragma multi_compile _ DOTS_INSTANCING_ON #pragma vertex Vert #pragma fragment Frag #define SHADERPASS SHADERPASS_DEPTH_ONLY #define SUPPORT_GLOBAL_MIP_BIAS 1 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" CBUFFER_START( UnityPerMaterial ) float4 _VignetteMask_ST; float4 _CloudColor; float2 _DistortionTile; float2 _CloudTiling; float _CausticsScale; float _CausticsSpeed; float _CausticsStrength; float _DistortValue; float _DistortionSpeed1; float _GrayScalePower; float _Bias; float _Scale; float _Power; float _CloudDirection; float _CloudBrightness; float _EmissionPower; float4 _EmissionColor; float _RenderQueueType; #ifdef _ADD_PRECOMPUTED_VELOCITY float _AddPrecomputedVelocity; #endif #ifdef _ENABLE_SHADOW_MATTE float _ShadowMatteFilter; #endif float _StencilRef; float _StencilWriteMask; float _StencilRefDepth; float _StencilWriteMaskDepth; float _StencilRefMV; float _StencilWriteMaskMV; float _StencilRefDistortionVec; float _StencilWriteMaskDistortionVec; float _StencilWriteMaskGBuffer; float _StencilRefGBuffer; float _ZTestGBuffer; float _RequireSplitLighting; float _ReceivesSSR; float _SurfaceType; float _BlendMode; float _SrcBlend; float _DstBlend; float _DstBlend2; float _AlphaSrcBlend; float _AlphaDstBlend; float _ZWrite; float _TransparentZWrite; float _CullMode; float _TransparentSortPriority; float _EnableFogOnTransparent; float _CullModeForward; float _TransparentCullMode; float _ZTestDepthEqualForOpaque; float _ZTestTransparent; float _TransparentBackfaceEnable; float _AlphaCutoffEnable; float _AlphaCutoff; float _UseShadowThreshold; float _DoubleSidedEnable; float _DoubleSidedNormalMode; float4 _DoubleSidedConstants; float _EnableBlendModePreserveSpecularLighting; #ifdef ASE_TESSELLATION float _TessPhongStrength; float _TessValue; float _TessMin; float _TessMax; float _TessEdgeLength; float _TessMaxDisp; #endif CBUFFER_END sampler2D _VignetteMask; sampler2D _TextureSample4; #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/Unlit.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" #define ASE_NEEDS_FRAG_WORLD_VIEW_DIR #define ASE_NEEDS_VERT_NORMAL struct VertexInput { float3 positionOS : POSITION; float3 normalOS : NORMAL; float4 ase_texcoord : TEXCOORD0; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct VertexOutput { float4 positionCS : SV_Position; float4 clipPosV : TEXCOORD0; float3 positionRWS : TEXCOORD1; float4 ase_texcoord2 : TEXCOORD2; float4 ase_texcoord3 : TEXCOORD3; UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO }; struct SurfaceDescription { float Alpha; float AlphaClipThreshold; }; void BuildSurfaceData(FragInputs fragInputs, SurfaceDescription surfaceDescription, float3 V, out SurfaceData surfaceData) { ZERO_INITIALIZE(SurfaceData, surfaceData); #ifdef WRITE_NORMAL_BUFFER surfaceData.normalWS = fragInputs.tangentToWorld[2]; #endif } void GetSurfaceAndBuiltinData(SurfaceDescription surfaceDescription, FragInputs fragInputs, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData) { #ifdef LOD_FADE_CROSSFADE LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); #endif #if _ALPHATEST_ON DoAlphaTest ( surfaceDescription.Alpha, surfaceDescription.AlphaClipThreshold ); #endif #if _DEPTHOFFSET_ON ApplyDepthOffsetPositionInput(V, surfaceDescription.DepthOffset, GetViewForwardDir(), GetWorldToHClipMatrix(), posInput); #endif BuildSurfaceData(fragInputs, surfaceDescription, V, surfaceData); ZERO_INITIALIZE(BuiltinData, builtinData); builtinData.opacity = surfaceDescription.Alpha; #if defined(DEBUG_DISPLAY) builtinData.renderingLayers = GetMeshRenderingLayerMask(); #endif #ifdef _ALPHATEST_ON builtinData.alphaClipTreshold = surfaceDescription.AlphaClipThreshold; #endif #if _DEPTHOFFSET_ON builtinData.depthOffset = surfaceDescription.DepthOffset; #endif ApplyDebugToBuiltinData(builtinData); } VertexOutput VertexFunction( VertexInput inputMesh ) { VertexOutput o; UNITY_SETUP_INSTANCE_ID(inputMesh); UNITY_TRANSFER_INSTANCE_ID(inputMesh, o); UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o ); float3 ase_normalWS = TransformObjectToWorldNormal( inputMesh.normalOS ); o.ase_texcoord2.xyz = ase_normalWS; o.ase_texcoord3.xy = inputMesh.ase_texcoord.xy; //setting value to unused interpolator channels and avoid initialization warnings o.ase_texcoord2.w = 0; o.ase_texcoord3.zw = 0; #ifdef ASE_ABSOLUTE_VERTEX_POS float3 defaultVertexValue = inputMesh.positionOS.xyz; #else float3 defaultVertexValue = float3( 0, 0, 0 ); #endif float3 vertexValue = defaultVertexValue ; #ifdef ASE_ABSOLUTE_VERTEX_POS inputMesh.positionOS.xyz = vertexValue; #else inputMesh.positionOS.xyz += vertexValue; #endif inputMesh.normalOS = inputMesh.normalOS ; float3 positionRWS = TransformObjectToWorld(inputMesh.positionOS); o.positionCS = TransformWorldToHClip(positionRWS); o.clipPosV = o.positionCS; o.positionRWS = positionRWS; return o; } #if defined(ASE_TESSELLATION) struct VertexControl { float3 positionOS : INTERNALTESSPOS; float3 normalOS : NORMAL; float4 ase_texcoord : TEXCOORD0; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct TessellationFactors { float edge[3] : SV_TessFactor; float inside : SV_InsideTessFactor; }; VertexControl Vert ( VertexInput v ) { VertexControl o; UNITY_SETUP_INSTANCE_ID(v); UNITY_TRANSFER_INSTANCE_ID(v, o); o.positionOS = v.positionOS; o.normalOS = v.normalOS; o.ase_texcoord = v.ase_texcoord; return o; } TessellationFactors TessellationFunction (InputPatch v) { TessellationFactors o; float4 tf = 1; float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; #if (SHADEROPTIONS_CAMERA_RELATIVE_RENDERING != 0) float3 cameraPos = 0; #else float3 cameraPos = _WorldSpaceCameraPos; #endif #if defined(ASE_FIXED_TESSELLATION) tf = FixedTess( tessValue ); #elif defined(ASE_DISTANCE_TESSELLATION) tf = DistanceBasedTess(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), cameraPos ); #elif defined(ASE_LENGTH_TESSELLATION) tf = EdgeLengthBasedTess(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), edgeLength, GetObjectToWorldMatrix(), cameraPos, _ScreenParams ); #elif defined(ASE_LENGTH_CULL_TESSELLATION) tf = EdgeLengthBasedTessCull(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), cameraPos, _ScreenParams, _FrustumPlanes ); #endif o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; return o; } [domain("tri")] [partitioning("fractional_odd")] [outputtopology("triangle_cw")] [patchconstantfunc("TessellationFunction")] [outputcontrolpoints(3)] VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) { return patch[id]; } [domain("tri")] VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) { VertexInput o = (VertexInput) 0; o.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; o.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; #if defined(ASE_PHONG_TESSELLATION) float3 pp[3]; for (int i = 0; i < 3; ++i) pp[i] = o.positionOS.xyz - patch[i].normalOS * (dot(o.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); float phongStrength = _TessPhongStrength; o.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.positionOS.xyz; #endif UNITY_TRANSFER_INSTANCE_ID(patch[0], o); return VertexFunction(o); } #else VertexOutput Vert ( VertexInput v ) { return VertexFunction( v ); } #endif void Frag( VertexOutput packedInput #ifdef WRITE_MSAA_DEPTH , out float4 depthColor : SV_Target0 #ifdef WRITE_NORMAL_BUFFER , out float4 outNormalBuffer : SV_Target1 #endif #else #ifdef WRITE_NORMAL_BUFFER , out float4 outNormalBuffer : SV_Target0 #endif #endif #if defined(_DEPTHOFFSET_ON) && !defined(SCENEPICKINGPASS) , out float outputDepth : DEPTH_OFFSET_SEMANTIC #endif ) { UNITY_SETUP_INSTANCE_ID( packedInput ); UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( packedInput ); float3 PositionRWS = packedInput.positionRWS; float3 V = GetWorldSpaceNormalizeViewDir( packedInput.positionRWS ); float4 ClipPos = packedInput.clipPosV; float4 ScreenPos = ComputeScreenPos( packedInput.clipPosV, _ProjectionParams.x ); FragInputs input; ZERO_INITIALIZE(FragInputs, input); input.tangentToWorld = k_identity3x3; input.positionSS = packedInput.positionCS; input.positionRWS = PositionRWS; PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); SurfaceDescription surfaceDescription = (SurfaceDescription)0; float3 ase_normalWS = packedInput.ase_texcoord2.xyz; float fresnelNdotV23 = dot( ase_normalWS, V ); float fresnelNode23 = ( _Bias + _Scale * pow( 1.0 - fresnelNdotV23, _Power ) ); float temp_output_70_0 = ( 1.0 - fresnelNode23 ); float2 uv_VignetteMask = packedInput.ase_texcoord3.xy * _VignetteMask_ST.xy + _VignetteMask_ST.zw; float2 texCoord101 = packedInput.ase_texcoord3.xy * float2( 0.17,0.14 ) + float2( 0,0 ); float4 temp_output_94_0 = ( ( temp_output_70_0 * tex2D( _VignetteMask, uv_VignetteMask ) ) * tex2D( _TextureSample4, texCoord101 ) ); float4 temp_output_102_0 = ( temp_output_94_0 * 0.29 ); surfaceDescription.Alpha = temp_output_102_0.r; surfaceDescription.AlphaClipThreshold = _AlphaCutoff; SurfaceData surfaceData; BuiltinData builtinData; GetSurfaceAndBuiltinData(surfaceDescription, input, V, posInput, surfaceData, builtinData); #ifdef _DEPTHOFFSET_ON outputDepth = posInput.deviceDepth; #endif #ifdef WRITE_MSAA_DEPTH depthColor = packedInput.positionCS.z; #ifdef _ALPHATOMASK_ON depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); #endif #endif #if defined(WRITE_NORMAL_BUFFER) EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); #endif } ENDHLSL } Pass { Name "MotionVectors" Tags { "LightMode"="MotionVectors" } Cull [_CullMode] ZWrite On Stencil { Ref [_StencilRefMV] WriteMask [_StencilWriteMaskMV] Comp Always Pass Replace } HLSLPROGRAM #pragma multi_compile_instancing #pragma instancing_options renderinglayer #define ASE_VERSION 19801 #define ASE_SRP_VERSION -1 #pragma shader_feature _SURFACE_TYPE_TRANSPARENT #pragma shader_feature_local _ALPHATEST_ON #pragma multi_compile _ WRITE_MSAA_DEPTH #pragma multi_compile _ DOTS_INSTANCING_ON #pragma vertex Vert #pragma fragment Frag #if (defined(_TRANSPARENT_WRITES_MOTION_VEC) || defined(_TRANSPARENT_REFRACTIVE_SORT)) && defined(_SURFACE_TYPE_TRANSPARENT) #define _WRITE_TRANSPARENT_MOTION_VECTOR #endif #define SHADERPASS SHADERPASS_MOTION_VECTORS #define SUPPORT_GLOBAL_MIP_BIAS 1 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" CBUFFER_START( UnityPerMaterial ) float4 _VignetteMask_ST; float4 _CloudColor; float2 _DistortionTile; float2 _CloudTiling; float _CausticsScale; float _CausticsSpeed; float _CausticsStrength; float _DistortValue; float _DistortionSpeed1; float _GrayScalePower; float _Bias; float _Scale; float _Power; float _CloudDirection; float _CloudBrightness; float _EmissionPower; float4 _EmissionColor; float _RenderQueueType; #ifdef _ADD_PRECOMPUTED_VELOCITY float _AddPrecomputedVelocity; #endif #ifdef _ENABLE_SHADOW_MATTE float _ShadowMatteFilter; #endif float _StencilRef; float _StencilWriteMask; float _StencilRefDepth; float _StencilWriteMaskDepth; float _StencilRefMV; float _StencilWriteMaskMV; float _StencilRefDistortionVec; float _StencilWriteMaskDistortionVec; float _StencilWriteMaskGBuffer; float _StencilRefGBuffer; float _ZTestGBuffer; float _RequireSplitLighting; float _ReceivesSSR; float _SurfaceType; float _BlendMode; float _SrcBlend; float _DstBlend; float _DstBlend2; float _AlphaSrcBlend; float _AlphaDstBlend; float _ZWrite; float _TransparentZWrite; float _CullMode; float _TransparentSortPriority; float _EnableFogOnTransparent; float _CullModeForward; float _TransparentCullMode; float _ZTestDepthEqualForOpaque; float _ZTestTransparent; float _TransparentBackfaceEnable; float _AlphaCutoffEnable; float _AlphaCutoff; float _UseShadowThreshold; float _DoubleSidedEnable; float _DoubleSidedNormalMode; float4 _DoubleSidedConstants; float _EnableBlendModePreserveSpecularLighting; #ifdef ASE_TESSELLATION float _TessPhongStrength; float _TessValue; float _TessMin; float _TessMax; float _TessEdgeLength; float _TessMaxDisp; #endif CBUFFER_END sampler2D _VignetteMask; sampler2D _TextureSample4; #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/Unlit.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" #define ASE_NEEDS_FRAG_WORLD_VIEW_DIR #define ASE_NEEDS_VERT_NORMAL struct VertexInput { float3 positionOS : POSITION; float3 normalOS : NORMAL; float3 previousPositionOS : TEXCOORD4; float3 precomputedVelocity : TEXCOORD5; float4 ase_texcoord : TEXCOORD0; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct VertexOutput { float4 vmeshPositionCS : SV_Position; float3 vmeshInterp00 : TEXCOORD0; float3 vpassInterpolators0 : TEXCOORD1; //interpolators0 float3 vpassInterpolators1 : TEXCOORD2; //interpolators1 float4 ase_texcoord3 : TEXCOORD3; float4 ase_texcoord4 : TEXCOORD4; UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO }; struct SurfaceDescription { float Alpha; float AlphaClipThreshold; }; void BuildSurfaceData(FragInputs fragInputs, SurfaceDescription surfaceDescription, float3 V, out SurfaceData surfaceData) { ZERO_INITIALIZE(SurfaceData, surfaceData); #ifdef WRITE_NORMAL_BUFFER surfaceData.normalWS = fragInputs.tangentToWorld[2]; #endif } void GetSurfaceAndBuiltinData(SurfaceDescription surfaceDescription, FragInputs fragInputs, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData) { #ifdef LOD_FADE_CROSSFADE LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); #endif #if _ALPHATEST_ON DoAlphaTest ( surfaceDescription.Alpha, surfaceDescription.AlphaClipThreshold ); #endif #if _DEPTHOFFSET_ON ApplyDepthOffsetPositionInput(V, surfaceDescription.DepthOffset, GetViewForwardDir(), GetWorldToHClipMatrix(), posInput); #endif BuildSurfaceData(fragInputs, surfaceDescription, V, surfaceData); ZERO_INITIALIZE(BuiltinData, builtinData); builtinData.opacity = surfaceDescription.Alpha; #if defined(DEBUG_DISPLAY) builtinData.renderingLayers = GetMeshRenderingLayerMask(); #endif #ifdef _ALPHATEST_ON builtinData.alphaClipTreshold = surfaceDescription.AlphaClipThreshold; #endif #if _DEPTHOFFSET_ON builtinData.depthOffset = surfaceDescription.DepthOffset; #endif ApplyDebugToBuiltinData(builtinData); } VertexInput ApplyMeshModification(VertexInput inputMesh, float3 timeParameters, inout VertexOutput o ) { _TimeParameters.xyz = timeParameters; float3 ase_normalWS = TransformObjectToWorldNormal( inputMesh.normalOS ); o.ase_texcoord3.xyz = ase_normalWS; o.ase_texcoord4.xy = inputMesh.ase_texcoord.xy; //setting value to unused interpolator channels and avoid initialization warnings o.ase_texcoord3.w = 0; o.ase_texcoord4.zw = 0; #ifdef ASE_ABSOLUTE_VERTEX_POS float3 defaultVertexValue = inputMesh.positionOS.xyz; #else float3 defaultVertexValue = float3( 0, 0, 0 ); #endif float3 vertexValue = defaultVertexValue ; #ifdef ASE_ABSOLUTE_VERTEX_POS inputMesh.positionOS.xyz = vertexValue; #else inputMesh.positionOS.xyz += vertexValue; #endif inputMesh.normalOS = inputMesh.normalOS ; return inputMesh; } VertexOutput VertexFunction(VertexInput inputMesh) { VertexOutput o = (VertexOutput)0; VertexInput defaultMesh = inputMesh; UNITY_SETUP_INSTANCE_ID(inputMesh); UNITY_TRANSFER_INSTANCE_ID(inputMesh, o); UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o ); inputMesh = ApplyMeshModification( inputMesh, _TimeParameters.xyz, o); float3 positionRWS = TransformObjectToWorld(inputMesh.positionOS); float3 normalWS = TransformObjectToWorldNormal(inputMesh.normalOS); float3 VMESHpositionRWS = positionRWS; float4 VMESHpositionCS = TransformWorldToHClip(positionRWS); //#if defined(UNITY_REVERSED_Z) // VMESHpositionCS.z -= unity_MotionVectorsParams.z * VMESHpositionCS.w; //#else // VMESHpositionCS.z += unity_MotionVectorsParams.z * VMESHpositionCS.w; //#endif float4 VPASSpreviousPositionCS; float4 VPASSpositionCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(VMESHpositionRWS, 1.0)); bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; if (forceNoMotion) { VPASSpreviousPositionCS = float4(0.0, 0.0, 0.0, 1.0); } else { bool hasDeformation = unity_MotionVectorsParams.x > 0.0; float3 effectivePositionOS = (hasDeformation ? inputMesh.previousPositionOS : defaultMesh.positionOS); #if defined(_ADD_PRECOMPUTED_VELOCITY) effectivePositionOS -= inputMesh.precomputedVelocity; #endif #if defined(HAVE_MESH_MODIFICATION) VertexInput previousMesh = defaultMesh; previousMesh.positionOS = effectivePositionOS ; VertexOutput test = (VertexOutput)0; float3 curTime = _TimeParameters.xyz; previousMesh = ApplyMeshModification(previousMesh, _LastTimeParameters.xyz, test); _TimeParameters.xyz = curTime; float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.positionOS); #else float3 previousPositionRWS = TransformPreviousObjectToWorld(effectivePositionOS); #endif #ifdef ATTRIBUTES_NEED_NORMAL float3 normalWS = TransformPreviousObjectToWorldNormal(defaultMesh.normalOS); #else float3 normalWS = float3(0.0, 0.0, 0.0); #endif #if defined(HAVE_VERTEX_MODIFICATION) ApplyVertexModification(inputMesh, normalWS, previousPositionRWS, _LastTimeParameters.xyz); #endif VPASSpreviousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); } o.vmeshPositionCS = VMESHpositionCS; o.vmeshInterp00.xyz = VMESHpositionRWS; o.vpassInterpolators0 = float3(VPASSpositionCS.xyw); o.vpassInterpolators1 = float3(VPASSpreviousPositionCS.xyw); return o; } #if ( 0 ) // TEMPORARY: defined(ASE_TESSELLATION) struct VertexControl { float3 positionOS : INTERNALTESSPOS; float3 normalOS : NORMAL; float3 previousPositionOS : TEXCOORD4; float3 precomputedVelocity : TEXCOORD5; float4 ase_texcoord : TEXCOORD0; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct TessellationFactors { float edge[3] : SV_TessFactor; float inside : SV_InsideTessFactor; }; VertexControl Vert ( VertexInput v ) { VertexControl o; UNITY_SETUP_INSTANCE_ID(v); UNITY_TRANSFER_INSTANCE_ID(v, o); o.positionOS = v.positionOS; o.normalOS = v.normalOS; o.previousPositionOS = v.previousPositionOS; #if defined (_ADD_PRECOMPUTED_VELOCITY) o.precomputedVelocity = v.precomputedVelocity; #endif o.ase_texcoord = v.ase_texcoord; return o; } TessellationFactors TessellationFunction (InputPatch v) { TessellationFactors o; float4 tf = 1; float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; #if (SHADEROPTIONS_CAMERA_RELATIVE_RENDERING != 0) float3 cameraPos = 0; #else float3 cameraPos = _WorldSpaceCameraPos; #endif #if defined(ASE_FIXED_TESSELLATION) tf = FixedTess( tessValue ); #elif defined(ASE_DISTANCE_TESSELLATION) tf = DistanceBasedTess(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), cameraPos ); #elif defined(ASE_LENGTH_TESSELLATION) tf = EdgeLengthBasedTess(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), edgeLength, GetObjectToWorldMatrix(), cameraPos, _ScreenParams ); #elif defined(ASE_LENGTH_CULL_TESSELLATION) tf = EdgeLengthBasedTessCull(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), cameraPos, _ScreenParams, _FrustumPlanes ); #endif o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; return o; } [domain("tri")] [partitioning("fractional_odd")] [outputtopology("triangle_cw")] [patchconstantfunc("TessellationFunction")] [outputcontrolpoints(3)] VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) { return patch[id]; } [domain("tri")] VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) { VertexInput o = (VertexInput) 0; o.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; o.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; o.previousPositionOS = patch[0].previousPositionOS * bary.x + patch[1].previousPositionOS * bary.y + patch[2].previousPositionOS * bary.z; #if defined (_ADD_PRECOMPUTED_VELOCITY) o.precomputedVelocity = patch[0].precomputedVelocity * bary.x + patch[1].precomputedVelocity * bary.y + patch[2].precomputedVelocity * bary.z; #endif o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; #if defined(ASE_PHONG_TESSELLATION) float3 pp[3]; for (int i = 0; i < 3; ++i) pp[i] = o.positionOS.xyz - patch[i].normalOS * (dot(o.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); float phongStrength = _TessPhongStrength; o.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.positionOS.xyz; #endif UNITY_TRANSFER_INSTANCE_ID(patch[0], o); return VertexFunction(o); } #else VertexOutput Vert ( VertexInput v ) { return VertexFunction( v ); } #endif #if defined(WRITE_DECAL_BUFFER) && defined(WRITE_MSAA_DEPTH) #define SV_TARGET_NORMAL SV_Target3 #elif defined(WRITE_DECAL_BUFFER) || defined(WRITE_MSAA_DEPTH) #define SV_TARGET_NORMAL SV_Target2 #else #define SV_TARGET_NORMAL SV_Target1 #endif void Frag( VertexOutput packedInput #ifdef WRITE_MSAA_DEPTH , out float4 depthColor : SV_Target0 , out float4 outMotionVector : SV_Target1 #ifdef WRITE_DECAL_BUFFER , out float4 outDecalBuffer : SV_Target2 #endif #else , out float4 outMotionVector : SV_Target0 #ifdef WRITE_DECAL_BUFFER , out float4 outDecalBuffer : SV_Target1 #endif #endif #ifdef WRITE_NORMAL_BUFFER , out float4 outNormalBuffer : SV_TARGET_NORMAL #endif #ifdef _DEPTHOFFSET_ON , out float outputDepth : DEPTH_OFFSET_SEMANTIC #endif ) { UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( packedInput ); UNITY_SETUP_INSTANCE_ID( packedInput ); FragInputs input; ZERO_INITIALIZE(FragInputs, input); input.tangentToWorld = k_identity3x3; input.positionSS = packedInput.vmeshPositionCS; input.positionRWS = packedInput.vmeshInterp00.xyz; PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); SurfaceDescription surfaceDescription = (SurfaceDescription)0; float3 ase_normalWS = packedInput.ase_texcoord3.xyz; float fresnelNdotV23 = dot( ase_normalWS, V ); float fresnelNode23 = ( _Bias + _Scale * pow( 1.0 - fresnelNdotV23, _Power ) ); float temp_output_70_0 = ( 1.0 - fresnelNode23 ); float2 uv_VignetteMask = packedInput.ase_texcoord4.xy * _VignetteMask_ST.xy + _VignetteMask_ST.zw; float2 texCoord101 = packedInput.ase_texcoord4.xy * float2( 0.17,0.14 ) + float2( 0,0 ); float4 temp_output_94_0 = ( ( temp_output_70_0 * tex2D( _VignetteMask, uv_VignetteMask ) ) * tex2D( _TextureSample4, texCoord101 ) ); float4 temp_output_102_0 = ( temp_output_94_0 * 0.29 ); surfaceDescription.Alpha = temp_output_102_0.r; surfaceDescription.AlphaClipThreshold = _AlphaCutoff; SurfaceData surfaceData; BuiltinData builtinData; GetSurfaceAndBuiltinData(surfaceDescription, input, V, posInput, surfaceData, builtinData); float4 VPASSpositionCS = float4(packedInput.vpassInterpolators0.xy, 0.0, packedInput.vpassInterpolators0.z); float4 VPASSpreviousPositionCS = float4(packedInput.vpassInterpolators1.xy, 0.0, packedInput.vpassInterpolators1.z); #ifdef _DEPTHOFFSET_ON VPASSpositionCS.w += builtinData.depthOffset; VPASSpreviousPositionCS.w += builtinData.depthOffset; #endif float2 motionVector = CalculateMotionVector( VPASSpositionCS, VPASSpreviousPositionCS ); EncodeMotionVector( motionVector * 0.5, outMotionVector ); bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; if( forceNoMotion ) outMotionVector = float4( 2.0, 0.0, 0.0, 0.0 ); #ifdef WRITE_MSAA_DEPTH depthColor = packedInput.vmeshPositionCS.z; depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); #endif #ifdef WRITE_NORMAL_BUFFER EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); #endif #if defined(WRITE_DECAL_BUFFER) DecalPrepassData decalPrepassData; #ifdef _DISABLE_DECALS ZERO_INITIALIZE(DecalPrepassData, decalPrepassData); #else decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; #endif decalPrepassData.renderingLayerMask = GetMeshRenderingLayerMask(); EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); #endif #ifdef _DEPTHOFFSET_ON outputDepth = posInput.deviceDepth; #endif } ENDHLSL } Pass { Name "ScenePickingPass" Tags { "LightMode"="Picking" } Cull [_CullMode] HLSLPROGRAM #pragma multi_compile_instancing #pragma instancing_options renderinglayer #define ASE_VERSION 19801 #define ASE_SRP_VERSION -1 #pragma shader_feature _SURFACE_TYPE_TRANSPARENT #pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC _TRANSPARENT_REFRACTIVE_SORT #pragma editor_sync_compilation #pragma multi_compile _ DOTS_INSTANCING_ON #pragma vertex Vert #pragma fragment Frag #if (defined(_TRANSPARENT_WRITES_MOTION_VEC) || defined(_TRANSPARENT_REFRACTIVE_SORT)) && defined(_SURFACE_TYPE_TRANSPARENT) #define _WRITE_TRANSPARENT_MOTION_VECTOR #endif #define SHADERPASS SHADERPASS_DEPTH_ONLY #define SCENEPICKINGPASS 1 #define SUPPORT_GLOBAL_MIP_BIAS 1 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" #define ATTRIBUTES_NEED_NORMAL #define ATTRIBUTES_NEED_TANGENT #define VARYINGS_NEED_TANGENT_TO_WORLD #define SHADER_UNLIT float4 _SelectionID; CBUFFER_START( UnityPerMaterial ) float4 _VignetteMask_ST; float4 _CloudColor; float2 _DistortionTile; float2 _CloudTiling; float _CausticsScale; float _CausticsSpeed; float _CausticsStrength; float _DistortValue; float _DistortionSpeed1; float _GrayScalePower; float _Bias; float _Scale; float _Power; float _CloudDirection; float _CloudBrightness; float _EmissionPower; float4 _EmissionColor; float _RenderQueueType; #ifdef _ADD_PRECOMPUTED_VELOCITY float _AddPrecomputedVelocity; #endif #ifdef _ENABLE_SHADOW_MATTE float _ShadowMatteFilter; #endif float _StencilRef; float _StencilWriteMask; float _StencilRefDepth; float _StencilWriteMaskDepth; float _StencilRefMV; float _StencilWriteMaskMV; float _StencilRefDistortionVec; float _StencilWriteMaskDistortionVec; float _StencilWriteMaskGBuffer; float _StencilRefGBuffer; float _ZTestGBuffer; float _RequireSplitLighting; float _ReceivesSSR; float _SurfaceType; float _BlendMode; float _SrcBlend; float _DstBlend; float _DstBlend2; float _AlphaSrcBlend; float _AlphaDstBlend; float _ZWrite; float _TransparentZWrite; float _CullMode; float _TransparentSortPriority; float _EnableFogOnTransparent; float _CullModeForward; float _TransparentCullMode; float _ZTestDepthEqualForOpaque; float _ZTestTransparent; float _TransparentBackfaceEnable; float _AlphaCutoffEnable; float _AlphaCutoff; float _UseShadowThreshold; float _DoubleSidedEnable; float _DoubleSidedNormalMode; float4 _DoubleSidedConstants; float _EnableBlendModePreserveSpecularLighting; #ifdef ASE_TESSELLATION float _TessPhongStrength; float _TessValue; float _TessMin; float _TessMax; float _TessEdgeLength; float _TessMaxDisp; #endif CBUFFER_END sampler2D _VignetteMask; sampler2D _TextureSample4; #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/PickingSpaceTransforms.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/Unlit.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" struct VertexInput { float3 positionOS : POSITION; float3 normalOS : NORMAL; float4 tangentOS : TANGENT; float4 ase_texcoord : TEXCOORD0; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct VertexOutput { float4 positionCS : SV_POSITION; float3 normalWS : TEXCOORD0; float4 tangentWS : TEXCOORD1; float4 ase_texcoord2 : TEXCOORD2; float4 ase_texcoord3 : TEXCOORD3; UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO }; struct SurfaceDescription { float Alpha; float AlphaClipThreshold; }; void GetSurfaceAndBuiltinData(SurfaceDescription surfaceDescription, FragInputs fragInputs, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData RAY_TRACING_OPTIONAL_PARAMETERS) { #ifdef LOD_FADE_CROSSFADE LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); #endif #ifdef _ALPHATEST_ON float alphaCutoff = surfaceDescription.AlphaClipThreshold; GENERIC_ALPHA_TEST(surfaceDescription.Alpha, alphaCutoff); #endif #if !defined(SHADER_STAGE_RAY_TRACING) && _DEPTHOFFSET_ON ApplyDepthOffsetPositionInput(V, surfaceDescription.DepthOffset, GetViewForwardDir(), GetWorldToHClipMatrix(), posInput); #endif ZERO_INITIALIZE(SurfaceData, surfaceData); ZERO_BUILTIN_INITIALIZE(builtinData); builtinData.opacity = surfaceDescription.Alpha; #if defined(DEBUG_DISPLAY) builtinData.renderingLayers = GetMeshRenderingLayerMask(); #endif #ifdef _ALPHATEST_ON builtinData.alphaClipTreshold = alphaCutoff; #endif #if _DEPTHOFFSET_ON builtinData.depthOffset = surfaceDescription.DepthOffset; #endif ApplyDebugToBuiltinData(builtinData); } VertexOutput VertexFunction(VertexInput inputMesh ) { VertexOutput o; ZERO_INITIALIZE(VertexOutput, o); UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); UNITY_SETUP_INSTANCE_ID(inputMesh); UNITY_TRANSFER_INSTANCE_ID(inputMesh, o ); float3 ase_positionWS = GetAbsolutePositionWS( TransformObjectToWorld( ( inputMesh.positionOS ).xyz ) ); o.ase_texcoord2.xyz = ase_positionWS; o.ase_texcoord3.xy = inputMesh.ase_texcoord.xy; //setting value to unused interpolator channels and avoid initialization warnings o.ase_texcoord2.w = 0; o.ase_texcoord3.zw = 0; #ifdef ASE_ABSOLUTE_VERTEX_POS float3 defaultVertexValue = inputMesh.positionOS.xyz; #else float3 defaultVertexValue = float3( 0, 0, 0 ); #endif float3 vertexValue = defaultVertexValue ; #ifdef ASE_ABSOLUTE_VERTEX_POS inputMesh.positionOS.xyz = vertexValue; #else inputMesh.positionOS.xyz += vertexValue; #endif inputMesh.normalOS = inputMesh.normalOS ; float3 positionRWS = TransformObjectToWorld(inputMesh.positionOS); float3 normalWS = TransformObjectToWorldNormal(inputMesh.normalOS); float4 tangentWS = float4(TransformObjectToWorldDir(inputMesh.tangentOS.xyz), inputMesh.tangentOS.w); o.positionCS = TransformWorldToHClip(positionRWS); o.normalWS.xyz = normalWS; o.tangentWS.xyzw = tangentWS; return o; } #if defined(ASE_TESSELLATION) struct VertexControl { float3 positionOS : INTERNALTESSPOS; float3 normalOS : NORMAL; float4 tangentOS : TANGENT; float4 ase_texcoord : TEXCOORD0; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct TessellationFactors { float edge[3] : SV_TessFactor; float inside : SV_InsideTessFactor; }; VertexControl Vert ( VertexInput v ) { VertexControl o; UNITY_SETUP_INSTANCE_ID(v); UNITY_TRANSFER_INSTANCE_ID(v, o); o.positionOS = v.positionOS; o.normalOS = v.normalOS; o.tangentOS = v.tangentOS; o.ase_texcoord = v.ase_texcoord; return o; } TessellationFactors TessellationFunction (InputPatch v) { TessellationFactors o; float4 tf = 1; float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; #if (SHADEROPTIONS_CAMERA_RELATIVE_RENDERING != 0) float3 cameraPos = 0; #else float3 cameraPos = _WorldSpaceCameraPos; #endif #if defined(ASE_FIXED_TESSELLATION) tf = FixedTess( tessValue ); #elif defined(ASE_DISTANCE_TESSELLATION) tf = DistanceBasedTess(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), cameraPos ); #elif defined(ASE_LENGTH_TESSELLATION) tf = EdgeLengthBasedTess(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), edgeLength, GetObjectToWorldMatrix(), cameraPos, _ScreenParams ); #elif defined(ASE_LENGTH_CULL_TESSELLATION) tf = EdgeLengthBasedTessCull(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), cameraPos, _ScreenParams, _FrustumPlanes ); #endif o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; return o; } [domain("tri")] [partitioning("fractional_odd")] [outputtopology("triangle_cw")] [patchconstantfunc("TessellationFunction")] [outputcontrolpoints(3)] VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) { return patch[id]; } [domain("tri")] VertexOutput DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) { VertexInput o = (VertexInput) 0; o.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; o.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; o.tangentOS = patch[0].tangentOS * bary.x + patch[1].tangentOS * bary.y + patch[2].tangentOS * bary.z; o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; #if defined(ASE_PHONG_TESSELLATION) float3 pp[3]; for (int i = 0; i < 3; ++i) pp[i] = o.positionOS.xyz - patch[i].normalOS * (dot(o.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); float phongStrength = _TessPhongStrength; o.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.positionOS.xyz; #endif UNITY_TRANSFER_INSTANCE_ID(patch[0], o); return VertexFunction(o); } #else VertexOutput Vert ( VertexInput v ) { return VertexFunction( v ); } #endif void Frag( VertexOutput packedInput , out float4 outColor : SV_Target0 ) { UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput); UNITY_SETUP_INSTANCE_ID(packedInput); FragInputs input; ZERO_INITIALIZE(FragInputs, input); input.tangentToWorld = k_identity3x3; input.positionSS = packedInput.positionCS; input.tangentToWorld = BuildTangentToWorld(packedInput.tangentWS.xyzw, packedInput.normalWS.xyz); PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); SurfaceDescription surfaceDescription = (SurfaceDescription)0; float3 ase_positionWS = packedInput.ase_texcoord2.xyz; float3 ase_viewVectorWS = ( _WorldSpaceCameraPos.xyz - ase_positionWS ); float3 ase_viewDirWS = normalize( ase_viewVectorWS ); float fresnelNdotV23 = dot( packedInput.normalWS, ase_viewDirWS ); float fresnelNode23 = ( _Bias + _Scale * pow( 1.0 - fresnelNdotV23, _Power ) ); float temp_output_70_0 = ( 1.0 - fresnelNode23 ); float2 uv_VignetteMask = packedInput.ase_texcoord3.xy * _VignetteMask_ST.xy + _VignetteMask_ST.zw; float2 texCoord101 = packedInput.ase_texcoord3.xy * float2( 0.17,0.14 ) + float2( 0,0 ); float4 temp_output_94_0 = ( ( temp_output_70_0 * tex2D( _VignetteMask, uv_VignetteMask ) ) * tex2D( _TextureSample4, texCoord101 ) ); float4 temp_output_102_0 = ( temp_output_94_0 * 0.29 ); surfaceDescription.Alpha = temp_output_102_0.r; surfaceDescription.AlphaClipThreshold = _AlphaCutoff; float3 V = float3(1.0, 1.0, 1.0); SurfaceData surfaceData; BuiltinData builtinData; GetSurfaceAndBuiltinData(surfaceDescription, input, V, posInput, surfaceData, builtinData); outColor = _SelectionID; } ENDHLSL } Pass { Name "FullScreenDebug" Tags { "LightMode" = "FullScreenDebug" } Cull [_CullMode] ZTest LEqual ZWrite Off HLSLPROGRAM /*ase_pragma_before*/ #pragma vertex Vert #pragma fragment Frag #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" #define SHADERPASS SHADERPASS_FULL_SCREEN_DEBUG #define SUPPORT_GLOBAL_MIP_BIAS 1 struct AttributesMesh { float3 positionOS : POSITION; float3 normalOS : NORMAL; float4 tangentOS : TANGENT; #if UNITY_ANY_INSTANCING_ENABLED uint instanceID : INSTANCEID_SEMANTIC; #endif }; struct VaryingsMeshToPS { SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION; #if UNITY_ANY_INSTANCING_ENABLED uint instanceID : CUSTOM_INSTANCE_ID; #endif }; struct PackedVaryingsMeshToPS { SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION; #if UNITY_ANY_INSTANCING_ENABLED uint instanceID : CUSTOM_INSTANCE_ID; #endif }; VaryingsMeshToPS UnpackVaryingsMeshToPS (PackedVaryingsMeshToPS input) { VaryingsMeshToPS output; output.positionCS = input.positionCS; #if UNITY_ANY_INSTANCING_ENABLED output.instanceID = input.instanceID; #endif return output; } PackedVaryingsMeshToPS PackVaryingsMeshToPS (VaryingsMeshToPS input) { PackedVaryingsMeshToPS output; ZERO_INITIALIZE(PackedVaryingsMeshToPS, output); output.positionCS = input.positionCS; #if UNITY_ANY_INSTANCING_ENABLED output.instanceID = input.instanceID; #endif return output; } FragInputs BuildFragInputs(VaryingsMeshToPS input) { FragInputs output; ZERO_INITIALIZE(FragInputs, output); output.tangentToWorld = k_identity3x3; output.positionSS = input.positionCS; return output; } FragInputs UnpackVaryingsMeshToFragInputs(PackedVaryingsMeshToPS input) { UNITY_SETUP_INSTANCE_ID(input); VaryingsMeshToPS unpacked = UnpackVaryingsMeshToPS(input); return BuildFragInputs(unpacked); } #define DEBUG_DISPLAY #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/FullScreenDebug.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/VertMesh.hlsl" PackedVaryingsType Vert(AttributesMesh inputMesh) { VaryingsType varyingsType; varyingsType.vmesh = VertMesh(inputMesh); return PackVaryingsType(varyingsType); } #if !defined(_DEPTHOFFSET_ON) [earlydepthstencil] // quad overshading debug mode writes to UAV #endif void Frag(PackedVaryingsToPS packedInput) { UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput); FragInputs input = UnpackVaryingsToFragInputs(packedInput); PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz); #ifdef PLATFORM_SUPPORTS_PRIMITIVE_ID_IN_PIXEL_SHADER if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_QUAD_OVERDRAW) { IncrementQuadOverdrawCounter(posInput.positionSS.xy, input.primitiveID); } #endif } ENDHLSL } } CustomEditor "Rendering.HighDefinition.HDUnlitGUI" Fallback "Hidden/InternalErrorShader" } /*ASEBEGIN Version=19801 Node;AmplifyShaderEditor.RangedFloatNode;21;-1696,624;Inherit;False;Property;_Scale;Scale;19;0;Create;True;0;0;0;False;0;False;2;2;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode;22;-1664,720;Inherit;False;Property;_Power;Power;21;0;Create;True;0;0;0;False;0;False;2.42;2.42;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode;20;-1680,528;Inherit;False;Property;_Bias;Bias;18;0;Create;True;0;0;0;False;0;False;-0.78;0;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.FresnelNode;23;-1488,528;Inherit;True;Standard;WorldNormal;ViewDir;False;False;5;0;FLOAT3;0,0,1;False;4;FLOAT3;0,0,0;False;1;FLOAT;-0.78;False;2;FLOAT;1.75;False;3;FLOAT;2.42;False;1;FLOAT;0 Node;AmplifyShaderEditor.OneMinusNode;70;-1088,608;Inherit;True;1;0;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.TextureCoordinatesNode;101;-2160,816;Inherit;False;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;0.17,0.14;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.SamplerNode;72;-1344,752;Inherit;True;Property;_VignetteMask;VignetteMask;20;0;Create;True;0;0;0;False;0;False;-1;95ef4804fe0be4c999ddaa383536cde8;95ef4804fe0be4c999ddaa383536cde8;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;6;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT3;5 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;89;-768,608;Inherit;True;2;2;0;FLOAT;0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.SamplerNode;99;-1856,816;Inherit;True;Property;_TextureSample4;Texture Sample 1;8;0;Create;True;0;0;0;False;0;False;-1;c701d8bbcea7c2c4abbf9c22ee81138a;c701d8bbcea7c2c4abbf9c22ee81138a;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;6;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT3;5 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;94;-416,768;Inherit;True;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.RangedFloatNode;103;-403.6068,1020.824;Inherit;False;Constant;_Float2;Float 2;26;0;Create;True;0;0;0;False;0;False;0.29;0;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleTimeNode;24;-2736,-800;Inherit;False;1;0;FLOAT;1;False;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode;25;-2752,-672;Inherit;False;Property;_DistortionSpeed1;DistortionSpeed;1;0;Create;True;0;0;0;False;0;False;0.5;0;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;26;-2528,-736;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.Vector2Node;27;-2608,-960;Inherit;False;Property;_DistortionTile;DistortionTile;6;0;Create;True;0;0;0;False;0;False;1,1;1,1;0;3;FLOAT2;0;FLOAT;1;FLOAT;2 Node;AmplifyShaderEditor.TextureCoordinatesNode;28;-2256,-848;Inherit;False;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.RangedFloatNode;29;-1840,-1152;Inherit;False;Property;_DistortValue;DistortValue;13;0;Create;True;0;0;0;False;0;False;1;0;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.SamplerNode;30;-2032,-1056;Inherit;True;Property;_Normals;Normals;3;0;Create;True;0;0;0;False;0;False;-1;09e350b54acf68c4ca8b3f46a5a64977;09e350b54acf68c4ca8b3f46a5a64977;True;0;True;white;Auto;True;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;6;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT3;5 Node;AmplifyShaderEditor.RegisterLocalVarNode;31;-1600,-1136;Inherit;False;DistortValue;-1;True;1;0;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.RegisterLocalVarNode;32;-1600,-1056;Inherit;False;Normals;-1;True;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0 Node;AmplifyShaderEditor.RangedFloatNode;34;-3568,-192;Inherit;False;Property;_CloudDirection;Cloud Direction;9;0;Create;True;0;0;0;False;0;False;1;9.1;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleTimeNode;33;-3552,-64;Inherit;False;1;0;FLOAT;1;False;1;FLOAT;0 Node;AmplifyShaderEditor.GetLocalVarNode;35;-2080,-320;Inherit;False;31;DistortValue;1;0;OBJECT;;False;1;FLOAT;0 Node;AmplifyShaderEditor.GetLocalVarNode;36;-2080,-224;Inherit;False;32;Normals;1;0;OBJECT;;False;1;FLOAT3;0 Node;AmplifyShaderEditor.GrabScreenPosition;37;-2304,-576;Inherit;False;0;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.Vector2Node;39;-3232,-224;Inherit;False;Property;_CloudTiling;Cloud Tiling;5;0;Create;True;0;0;0;False;0;False;1,1;1,1;0;3;FLOAT2;0;FLOAT;1;FLOAT;2 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;38;-3312,-96;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;40;-1760,-368;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0 Node;AmplifyShaderEditor.ComponentMaskNode;41;-2000,-528;Inherit;False;True;True;True;True;1;0;FLOAT4;0,0,0,0;False;1;FLOAT4;0 Node;AmplifyShaderEditor.SimpleAddOpNode;43;-1760,-512;Inherit;False;2;2;0;FLOAT4;0,0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT4;0 Node;AmplifyShaderEditor.RangedFloatNode;44;-3072,352;Inherit;False;Property;_CloudPower;Cloud Power;10;0;Create;True;0;0;0;False;0;False;2.34;0;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.ScreenColorNode;46;-1632,-560;Inherit;False;Global;_GrabScreen1;Grab Screen 1;9;0;Create;True;0;0;0;False;0;False;Object;-1;False;False;True;False;2;0;FLOAT2;0,0;False;1;FLOAT;0;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;48;-2480,160;Inherit;True;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.SimpleDivideOpNode;49;-1344,-416;Inherit;True;2;0;COLOR;0,0,0,0;False;1;COLOR;1,1,1,0;False;1;COLOR;0 Node;AmplifyShaderEditor.RangedFloatNode;50;-2160,304;Inherit;False;Property;_CloudBrightness;Cloud Brightness;12;0;Create;True;0;0;0;False;0;False;3.62;3.62;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.ClampOpNode;51;-2144,48;Inherit;True;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;COLOR;0.2150944,0.2150944,0.2150944,0;False;1;COLOR;0 Node;AmplifyShaderEditor.SaturateNode;52;-1264,-656;Inherit;True;1;0;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;53;-1888,160;Inherit;True;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.ColorNode;54;-1888,400;Inherit;False;Property;_CloudColor;Cloud Color;11;0;Create;True;0;0;0;False;0;False;0,1,0.7772009,0;0,1,0.2468553,0;True;True;0;6;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT3;5 Node;AmplifyShaderEditor.TFHCGrayscale;55;-1088,-768;Inherit;True;1;1;0;FLOAT3;0,0,0;False;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode;56;-992,-528;Inherit;False;Property;_GrayScalePower;Gray Scale Power;16;0;Create;True;0;0;0;False;0;False;0;0;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;57;-1664,144;Inherit;True;2;2;0;COLOR;0,0,0,0;False;1;COLOR;1,1,1,0;False;1;COLOR;0 Node;AmplifyShaderEditor.LerpOp;58;-656,-576;Inherit;True;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.RangedFloatNode;60;-1440,256;Inherit;False;Property;_EmissionPower;Emission Power;14;0;Create;True;0;0;0;False;0;False;11.31;11.31;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;71;-1216,176;Inherit;True;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;75;-752,240;Inherit;True;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.SimpleTimeNode;83;-1536,-112;Inherit;False;1;0;FLOAT;1;False;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode;92;-1200,448;Inherit;False;Constant;_Float1;Float 1;25;0;Create;True;0;0;0;False;0;False;0.16;0;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;9;-3136,-2144;Inherit;True;2;2;0;FLOAT4;0,0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT4;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;10;-2752,-2112;Inherit;True;2;2;0;FLOAT4;0,0,0,0;False;1;FLOAT2;0,0;False;1;FLOAT4;0 Node;AmplifyShaderEditor.Vector2Node;11;-2960,-1888;Inherit;False;Property;_DistortionDirection;DistortionDirection;4;0;Create;True;0;0;0;False;0;False;1,1;0,0;0;3;FLOAT2;0;FLOAT;1;FLOAT;2 Node;AmplifyShaderEditor.ScreenColorNode;12;-2432,-1936;Inherit;False;Global;_GrabScreen0;Grab Screen 0;4;0;Create;True;0;0;0;False;0;False;Object;-1;False;False;False;False;2;0;FLOAT2;0,0;False;1;FLOAT;0;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.RangedFloatNode;13;-2224,-1872;Inherit;False;Property;_Smoothness;Smoothness;15;0;Create;True;0;0;0;False;0;False;0;0;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.SamplerNode;14;-3664,-2208;Inherit;True;Property;_TextureSample0;Texture Sample 0;2;0;Create;True;0;0;0;False;0;False;-1;09e350b54acf68c4ca8b3f46a5a64977;09e350b54acf68c4ca8b3f46a5a64977;True;0;True;bump;Auto;True;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;6;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT3;5 Node;AmplifyShaderEditor.ScreenPosInputsNode;15;-3392,-2384;Float;False;1;False;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.TextureCoordinatesNode;16;-3936,-2160;Inherit;False;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.SimpleTimeNode;17;-4416,-2112;Inherit;False;1;0;FLOAT;1;False;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode;18;-4432,-1984;Inherit;False;Property;_DistortionSpeed;DistortionSpeed;0;0;Create;True;0;0;0;False;0;False;0.5;0;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;19;-4208,-2048;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.TFHCRemapNode;62;-2400,-272;Inherit;True;5;0;COLOR;0,0,0,0;False;1;COLOR;0.01,0,0,0;False;2;COLOR;-0.22,1,1,1;False;3;COLOR;1,0,0,0;False;4;COLOR;2.39,1,1,1;False;1;COLOR;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;63;-800,-784;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleSubtractOpNode;64;-1360,-944;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.ScreenPosInputsNode;65;-1856,-752;Float;False;1;False;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.ScreenDepthNode;66;-1712,-928;Inherit;False;1;1;0;FLOAT4;0,0,0,0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SamplerNode;67;-928,800;Inherit;True;Property;_TextureSample2;Texture Sample 2;17;0;Create;True;0;0;0;False;0;False;-1;95ef4804fe0be4c999ddaa383536cde8;95ef4804fe0be4c999ddaa383536cde8;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;6;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT3;5 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;68;-1424,-592;Inherit;False;2;2;0;FLOAT;0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.StepOpNode;69;-1536,-800;Inherit;True;2;0;FLOAT;0;False;1;FLOAT;1;False;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleAddOpNode;77;-672,-80;Inherit;True;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;80;-492,-304;Inherit;True;2;2;0;FLOAT;0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;98;336,592;Inherit;True;2;2;0;FLOAT;0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.SimpleSubtractOpNode;93;-992,368;Inherit;True;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.SamplerNode;45;-2768,-224;Inherit;True;Property;_TextureSample1;Texture Sample 1;7;0;Create;True;0;0;0;False;0;False;-1;c701d8bbcea7c2c4abbf9c22ee81138a;c701d8bbcea7c2c4abbf9c22ee81138a;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;6;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT3;5 Node;AmplifyShaderEditor.TextureCoordinatesNode;42;-3040,-192;Inherit;False;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;84;-1296,-144;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.VoronoiNode;79;-1040,-352;Inherit;True;1;0;1;3;1;False;1;False;False;False;4;0;FLOAT2;0,0;False;1;FLOAT;13.71;False;2;FLOAT;5;False;3;FLOAT;0;False;3;FLOAT;0;FLOAT2;1;FLOAT2;2 Node;AmplifyShaderEditor.RangedFloatNode;85;-1248,-224;Inherit;False;Property;_CausticsScale;CausticsScale;23;0;Create;True;0;0;0;False;0;False;5;5;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode;82;-1536,-208;Inherit;False;Property;_CausticsSpeed;CausticsSpeed;22;0;Create;True;0;0;0;False;0;False;2;0;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;86;-784,-304;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;96;-48,544;Inherit;True;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.FresnelNode;47;-2816,304;Inherit;False;Standard;WorldNormal;ViewDir;False;False;5;0;FLOAT3;0,0,1;False;4;FLOAT3;0,0,0;False;1;FLOAT;0;False;2;FLOAT;1;False;3;FLOAT;5;False;1;FLOAT;0 Node;AmplifyShaderEditor.OneMinusNode;104;-2538.277,466.8671;Inherit;True;1;0;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;102;-192,944;Inherit;True;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.SimpleAddOpNode;59;-1488,0;Inherit;True;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.RangedFloatNode;87;-1056,-80;Inherit;False;Property;_CausticsStrength;CausticsStrength;24;0;Create;True;0;0;0;False;0;False;1;1;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;2;0,0;Float;False;False;-1;3;Rendering.HighDefinition.HDUnlitGUI;0;13;New Amplify Shader;7f5cb9c3ea6481f469fdd856555439ef;True;ShadowCaster;0;1;ShadowCaster;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;3;RenderPipeline=HDRenderPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;5;True;7;d3d11;metal;vulkan;xboxone;xboxseries;playstation;switch;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;0;True;_CullMode;False;True;False;False;False;False;0;False;;False;False;False;False;False;False;False;False;False;True;1;False;;False;False;True;1;LightMode=ShadowCaster;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;3;0,0;Float;False;False;-1;3;Rendering.HighDefinition.HDUnlitGUI;0;13;New Amplify Shader;7f5cb9c3ea6481f469fdd856555439ef;True;META;0;2;META;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;3;RenderPipeline=HDRenderPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;5;True;7;d3d11;metal;vulkan;xboxone;xboxseries;playstation;switch;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Meta;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;4;0,0;Float;False;False;-1;3;Rendering.HighDefinition.HDUnlitGUI;0;13;New Amplify Shader;7f5cb9c3ea6481f469fdd856555439ef;True;SceneSelectionPass;0;3;SceneSelectionPass;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;3;RenderPipeline=HDRenderPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;5;True;7;d3d11;metal;vulkan;xboxone;xboxseries;playstation;switch;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=SceneSelectionPass;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;5;0,0;Float;False;False;-1;3;Rendering.HighDefinition.HDUnlitGUI;0;13;New Amplify Shader;7f5cb9c3ea6481f469fdd856555439ef;True;DepthForwardOnly;0;4;DepthForwardOnly;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;3;RenderPipeline=HDRenderPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;5;True;7;d3d11;metal;vulkan;xboxone;xboxseries;playstation;switch;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;0;True;_CullMode;False;True;False;False;False;False;0;False;;False;False;False;False;False;False;False;True;True;0;True;_StencilRefDepth;255;False;;255;True;_StencilWriteMaskDepth;7;False;;3;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;True;1;False;;False;False;True;1;LightMode=DepthForwardOnly;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;6;0,0;Float;False;False;-1;3;Rendering.HighDefinition.HDUnlitGUI;0;13;New Amplify Shader;7f5cb9c3ea6481f469fdd856555439ef;True;MotionVectors;0;5;MotionVectors;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;3;RenderPipeline=HDRenderPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;5;True;7;d3d11;metal;vulkan;xboxone;xboxseries;playstation;switch;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;0;True;_CullMode;False;False;False;False;False;False;False;False;False;True;True;0;True;_StencilRefMV;255;False;;255;True;_StencilWriteMaskMV;7;False;;3;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;True;1;False;;False;False;True;1;LightMode=MotionVectors;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;7;0,0;Float;False;False;-1;3;Rendering.HighDefinition.HDUnlitGUI;0;13;New Amplify Shader;7f5cb9c3ea6481f469fdd856555439ef;True;DistortionVectors;0;6;DistortionVectors;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;3;RenderPipeline=HDRenderPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;5;True;7;d3d11;metal;vulkan;xboxone;xboxseries;playstation;switch;0;False;True;4;1;False;;1;False;;4;1;False;;1;False;;True;1;False;;1;False;;False;False;False;False;False;False;False;False;False;False;False;True;0;True;_CullMode;False;False;False;False;False;False;False;False;False;True;True;0;True;_StencilRefDistortionVec;255;False;;255;True;_StencilWriteMaskDistortionVec;7;False;;3;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;True;2;False;;True;3;False;;False;True;1;LightMode=DistortionVectors;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;8;0,0;Float;False;False;-1;3;Rendering.HighDefinition.HDUnlitGUI;0;13;New Amplify Shader;7f5cb9c3ea6481f469fdd856555439ef;True;ScenePickingPass;0;7;ScenePickingPass;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;3;RenderPipeline=HDRenderPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;5;True;7;d3d11;metal;vulkan;xboxone;xboxseries;playstation;switch;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;0;True;_CullMode;False;False;False;False;False;False;False;False;False;False;False;True;2;False;;True;3;False;;False;True;1;LightMode=Picking;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;1;0,0;Float;False;True;-1;3;Rendering.HighDefinition.HDUnlitGUI;0;13;HDRPLitDistortionDimensionalFracture;7f5cb9c3ea6481f469fdd856555439ef;True;Forward Unlit;0;0;Forward Unlit;9;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;3;RenderPipeline=HDRenderPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;5;True;7;d3d11;metal;vulkan;xboxone;xboxseries;playstation;switch;0;False;False;False;False;True;3;1;False;;10;False;;0;1;False;;0;False;;False;False;True;1;1;False;;0;True;_DstBlend2;0;1;False;;0;False;;False;False;True;1;1;False;;0;True;_DstBlend2;0;1;False;;0;False;;False;False;False;True;0;True;_CullModeForward;False;False;False;True;True;True;True;True;0;True;_ColorMaskTransparentVel;False;False;False;False;False;True;True;0;True;_StencilRef;255;False;;255;True;_StencilWriteMask;7;False;;3;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;True;0;True;_ZWrite;True;0;True;_ZTestDepthEqualForOpaque;False;True;1;LightMode=ForwardOnly;False;False;0;Hidden/InternalErrorShader;0;0;Standard;30;Surface Type;0;0; Rendering Pass ;0;0; Rendering Pass;1;0; Blending Mode;0;0; Receive Fog;1;0; Distortion;0;0; Distortion Mode;0;0; Distortion Only;1;0; Depth Write;1;0; Cull Mode;0;0; Depth Test;4;0;Double-Sided;1;638784323879463018;Alpha Clipping;1;638784287730077041;Receive Decals;1;0;Motion Vectors;1;0; Add Precomputed Velocity;0;0;Shadow Matte;0;0;Cast Shadows;1;0;GPU Instancing;1;0;Tessellation;0;0; Phong;0;0; Strength;0.5,False,;0; Type;0;0; Tess;16,False,;0; Min;10,False,;0; Max;25,False,;0; Edge Length;16,False,;0; Max Displacement;25,False,;0;Vertex Position,InvertActionOnDeselection;1;0;LOD CrossFade;0;0;0;8;True;True;True;True;True;True;False;True;False;;False;0 WireConnection;23;1;20;0 WireConnection;23;2;21;0 WireConnection;23;3;22;0 WireConnection;70;0;23;0 WireConnection;89;0;70;0 WireConnection;89;1;72;0 WireConnection;99;1;101;0 WireConnection;94;0;89;0 WireConnection;94;1;99;0 WireConnection;26;0;24;0 WireConnection;26;1;25;0 WireConnection;28;0;27;0 WireConnection;28;1;26;0 WireConnection;30;1;28;0 WireConnection;31;0;29;0 WireConnection;32;0;30;0 WireConnection;38;0;34;0 WireConnection;38;1;33;0 WireConnection;40;0;35;0 WireConnection;40;1;36;0 WireConnection;41;0;37;0 WireConnection;43;0;41;0 WireConnection;43;1;40;0 WireConnection;46;0;43;0 WireConnection;48;0;102;0 WireConnection;48;1;45;0 WireConnection;49;0;46;0 WireConnection;51;0;48;0 WireConnection;52;0;49;0 WireConnection;53;0;51;0 WireConnection;53;1;50;0 WireConnection;55;0;52;0 WireConnection;57;0;53;0 WireConnection;57;1;54;0 WireConnection;58;0;52;0 WireConnection;58;1;55;0 WireConnection;58;2;56;0 WireConnection;71;0;59;0 WireConnection;71;1;60;0 WireConnection;75;0;71;0 WireConnection;75;1;70;0 WireConnection;9;0;15;0 WireConnection;9;1;14;0 WireConnection;10;0;9;0 WireConnection;10;1;11;0 WireConnection;12;1;10;0 WireConnection;14;1;16;0 WireConnection;16;1;19;0 WireConnection;19;0;17;0 WireConnection;19;1;18;0 WireConnection;62;0;45;0 WireConnection;63;0;55;0 WireConnection;63;1;56;0 WireConnection;64;0;66;0 WireConnection;64;1;65;3 WireConnection;67;1;23;0 WireConnection;68;0;69;0 WireConnection;68;1;46;0 WireConnection;69;0;64;0 WireConnection;77;0;71;0 WireConnection;80;0;86;0 WireConnection;80;1;71;0 WireConnection;98;0;86;0 WireConnection;98;1;96;0 WireConnection;93;0;45;0 WireConnection;93;1;92;0 WireConnection;45;1;42;0 WireConnection;42;0;39;0 WireConnection;42;1;38;0 WireConnection;84;0;82;0 WireConnection;84;1;83;0 WireConnection;79;1;84;0 WireConnection;79;2;85;0 WireConnection;86;0;79;0 WireConnection;86;1;87;0 WireConnection;96;0;75;0 WireConnection;96;1;94;0 WireConnection;47;3;44;0 WireConnection;104;0;47;0 WireConnection;102;0;94;0 WireConnection;102;1;103;0 WireConnection;59;0;58;0 WireConnection;59;1;57;0 WireConnection;1;0;80;0 WireConnection;1;1;75;0 WireConnection;1;2;102;0 ASEEND*/ //CHKSM=107A29BA3A9E7C633BABF330A4ECC8A8C36F7CA9