// Made with Amplify Shader Editor v1.9.7.1 // Available at the Unity Asset Store - http://u3d.as/y3X Shader "HDRPLitDistortion" { 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" {} _CloudDirection("Cloud Direction", Float) = 1 _CloudPower("Cloud Power", Float) = 2.34 _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 [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) = 0 [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 19701 #define ASE_SRP_VERSION 170003 #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 _CloudColor; float2 _DistortionTile; float2 _CloudTiling; float _DistortValue; float _DistortionSpeed1; float _GrayScalePower; float _CloudPower; float _CloudDirection; float _CloudBrightness; float _EmissionPower; float _Bias; float _Scale; 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 _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_RELATIVE_WORLD_POS #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; float3 positionRWS : TEXCOORD0; float4 ase_texcoord1 : TEXCOORD1; float4 ase_texcoord2 : TEXCOORD2; float4 ase_texcoord3 : TEXCOORD3; UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO }; inline float4 ASE_ComputeGrabScreenPos( float4 pos ) { #if UNITY_UV_STARTS_AT_TOP float scale = -1.0; #else float scale = 1.0; #endif float4 o = pos; o.y = pos.w * 0.5f; o.y = ( pos.y - o.y ) * _ProjectionParams.x * scale + o.y; return o; } float4 ASEHDSampleSceneColor(float2 uv, float lod, float exposureMultiplier) { #if defined(REQUIRE_OPAQUE_TEXTURE) && defined(_SURFACE_TYPE_TRANSPARENT) && defined(SHADERPASS) && (SHADERPASS != SHADERPASS_LIGHT_TRANSPORT) return float4( SampleCameraColor(uv, lod) * exposureMultiplier, 1.0 ); #endif return float4(0.0, 0.0, 0.0, 1.0); } struct SurfaceDescription { float3 Color; float3 Emission; float4 ShadowTint; float Alpha; float AlphaClipThreshold; float4 VTPackedFeedback; }; void BuildSurfaceData(FragInputs fragInputs, SurfaceDescription surfaceDescription, float3 V, out SurfaceData surfaceData) { ZERO_INITIALIZE(SurfaceData, surfaceData); surfaceData.color = surfaceDescription.Color; } 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); #ifdef WRITE_NORMAL_BUFFER surfaceData.normalWS = fragInputs.tangentToWorld[2]; #endif #if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT HDShadowContext shadowContext = InitShadowContext(); float shadow; float3 shadow3; posInput = GetPositionInput(fragInputs.positionSS.xy, _ScreenSize.zw, fragInputs.positionSS.z, UNITY_MATRIX_I_VP, UNITY_MATRIX_V); float3 normalWS = normalize(fragInputs.tangentToWorld[1]); uint renderingLayers = GetMeshRenderingLayerMask(); ShadowLoopMin(shadowContext, posInput, normalWS, asuint(_ShadowMatteFilter), renderingLayers, shadow3); shadow = dot(shadow3, float3(1.0f/3.0f, 1.0f/3.0f, 1.0f/3.0f)); float4 shadowColor = (1 - shadow)*surfaceDescription.ShadowTint.rgba; float localAlpha = saturate(shadowColor.a + surfaceDescription.Alpha); #ifdef _SURFACE_TYPE_TRANSPARENT surfaceData.color = lerp(shadowColor.rgb*surfaceData.color, lerp(lerp(shadowColor.rgb, surfaceData.color, 1 - surfaceDescription.ShadowTint.a), surfaceData.color, shadow), surfaceDescription.Alpha); #else surfaceData.color = lerp(lerp(shadowColor.rgb, surfaceData.color, 1 - surfaceDescription.ShadowTint.a), surfaceData.color, shadow); #endif localAlpha = ApplyBlendMode(surfaceData.color, localAlpha).a; surfaceDescription.Alpha = localAlpha; #endif ZERO_INITIALIZE(BuiltinData, builtinData); builtinData.opacity = surfaceDescription.Alpha; #if defined(DEBUG_DISPLAY) builtinData.renderingLayers = GetMeshRenderingLayerMask(); #endif #ifdef _ALPHATEST_ON builtinData.alphaClipTreshold = surfaceDescription.AlphaClipThreshold; #endif builtinData.emissiveColor = surfaceDescription.Emission; #ifdef UNITY_VIRTUAL_TEXTURING builtinData.vtPackedFeedback = surfaceDescription.VTPackedFeedback; #endif #if _DEPTHOFFSET_ON builtinData.depthOffset = surfaceDescription.DepthOffset; #endif ApplyDebugToBuiltinData(builtinData); } float GetDeExposureMultiplier() { #if defined(DISABLE_UNLIT_DEEXPOSURE) return 1.0; #else return _DeExposureMultiplier; #endif } VertexOutput VertexFunction( VertexInput inputMesh ) { VertexOutput o; UNITY_SETUP_INSTANCE_ID(inputMesh); UNITY_TRANSFER_INSTANCE_ID(inputMesh, o); UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o ); float4 ase_clipPos = TransformWorldToHClip( TransformObjectToWorld(inputMesh.positionOS)); float4 screenPos = ComputeScreenPos( ase_clipPos , _ProjectionParams.x ); o.ase_texcoord1 = screenPos; float3 ase_worldNormal = TransformObjectToWorldNormal(inputMesh.normalOS); o.ase_texcoord3.xyz = ase_worldNormal; o.ase_texcoord2.xy = inputMesh.ase_texcoord.xy; //setting value to unused interpolator channels and avoid initialization warnings o.ase_texcoord2.zw = 0; o.ase_texcoord3.w = 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.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 #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 ); FragInputs input; ZERO_INITIALIZE(FragInputs, input); input.tangentToWorld = k_identity3x3; float3 positionRWS = packedInput.positionRWS; input.positionSS = packedInput.positionCS; input.positionRWS = positionRWS; 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; float4 screenPos = packedInput.ase_texcoord1; float4 ase_grabScreenPos = ASE_ComputeGrabScreenPos( screenPos ); float4 ase_grabScreenPosNorm = ase_grabScreenPos / ase_grabScreenPos.w; float DistortValue54 = _DistortValue; float2 temp_cast_0 = (( _TimeParameters.x * _DistortionSpeed1 )).xx; float2 texCoord66 = packedInput.ase_texcoord2.xy * _DistortionTile + temp_cast_0; float3 Normals59 = UnpackNormalScale( tex2D( _Normals, texCoord66 ), 1.0f ); float4 fetchOpaqueVal55 = ASEHDSampleSceneColor(( (ase_grabScreenPosNorm).xyzw + float4( ( DistortValue54 * Normals59 ) , 0.0 ) ).xy, 0.0, 1.0); float4 temp_output_56_0 = saturate( ( fetchOpaqueVal55 / float4( 1,1,1,0 ) ) ); float grayscale67 = dot(temp_output_56_0.rgb, float3(0.299,0.587,0.114)); float4 temp_cast_4 = (grayscale67).xxxx; float4 lerpResult102 = lerp( temp_output_56_0 , temp_cast_4 , _GrayScalePower); float3 ase_worldPos = GetAbsolutePositionWS( positionRWS ); float3 ase_viewVectorWS = ( _WorldSpaceCameraPos.xyz - ase_worldPos ); float3 ase_viewDirWS = normalize( ase_viewVectorWS ); float3 ase_worldNormal = packedInput.ase_texcoord3.xyz; float fresnelNdotV35 = dot( ase_worldNormal, ase_viewDirWS ); float fresnelNode35 = ( 0.0 + 1.0 * pow( 1.0 - fresnelNdotV35, _CloudPower ) ); float2 temp_cast_5 = (( _CloudDirection * _TimeParameters.x )).xx; float2 texCoord30 = packedInput.ase_texcoord2.xy * _CloudTiling + temp_cast_5; float4 tex2DNode32 = tex2D( _TextureSample1, texCoord30 ); float4 clampResult37 = clamp( ( fresnelNode35 * tex2DNode32 ) , float4( 0,0,0,0 ) , float4( 0.2150944,0.2150944,0.2150944,0 ) ); float4 temp_output_61_0 = ( ( lerpResult102 + ( ( clampResult37 * _CloudBrightness ) * _CloudColor ) ) * _EmissionPower ); float fresnelNdotV109 = dot( ase_worldNormal, ase_viewDirWS ); float fresnelNode109 = ( _Bias + _Scale * pow( 1.0 - fresnelNdotV109, 2.42 ) ); float temp_output_110_0 = ( 1.0 - fresnelNode109 ); surfaceDescription.Color = temp_output_61_0.rgb; surfaceDescription.Emission = temp_output_61_0.rgb; surfaceDescription.Alpha = temp_output_110_0; 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 19701 #define ASE_SRP_VERSION 170003 #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_VERT_NORMAL struct VertexInput { float3 positionOS : POSITION; float3 normalOS : NORMAL; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct VertexOutput { float4 positionCS : SV_Position; float4 ase_texcoord : TEXCOORD0; float4 ase_texcoord1 : TEXCOORD1; UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO }; CBUFFER_START( UnityPerMaterial ) float4 _CloudColor; float2 _DistortionTile; float2 _CloudTiling; float _DistortValue; float _DistortionSpeed1; float _GrayScalePower; float _CloudPower; float _CloudDirection; float _CloudBrightness; float _EmissionPower; float _Bias; float _Scale; 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 #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_worldPos = GetAbsolutePositionWS( TransformObjectToWorld( (inputMesh.positionOS).xyz ) ); o.ase_texcoord.xyz = ase_worldPos; float3 ase_worldNormal = TransformObjectToWorldNormal(inputMesh.normalOS); o.ase_texcoord1.xyz = ase_worldNormal; //setting value to unused interpolator channels and avoid initialization warnings o.ase_texcoord.w = 0; o.ase_texcoord1.w = 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; 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; 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; #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 ); 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; float3 ase_worldPos = packedInput.ase_texcoord.xyz; float3 ase_viewVectorWS = ( _WorldSpaceCameraPos.xyz - ase_worldPos ); float3 ase_viewDirWS = normalize( ase_viewVectorWS ); float3 ase_worldNormal = packedInput.ase_texcoord1.xyz; float fresnelNdotV109 = dot( ase_worldNormal, ase_viewDirWS ); float fresnelNode109 = ( _Bias + _Scale * pow( 1.0 - fresnelNdotV109, 2.42 ) ); float temp_output_110_0 = ( 1.0 - fresnelNode109 ); surfaceDescription.Alpha = temp_output_110_0; 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 19701 #define ASE_SRP_VERSION 170003 #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 _CloudColor; float2 _DistortionTile; float2 _CloudTiling; float _DistortValue; float _DistortionSpeed1; float _GrayScalePower; float _CloudPower; float _CloudDirection; float _CloudBrightness; float _EmissionPower; float _Bias; float _Scale; 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 _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 }; inline float4 ASE_ComputeGrabScreenPos( float4 pos ) { #if UNITY_UV_STARTS_AT_TOP float scale = -1.0; #else float scale = 1.0; #endif float4 o = pos; o.y = pos.w * 0.5f; o.y = ( pos.y - o.y ) * _ProjectionParams.x * scale + o.y; return o; } float4 ASEHDSampleSceneColor(float2 uv, float lod, float exposureMultiplier) { #if defined(REQUIRE_OPAQUE_TEXTURE) && defined(_SURFACE_TYPE_TRANSPARENT) && defined(SHADERPASS) && (SHADERPASS != SHADERPASS_LIGHT_TRANSPORT) return float4( SampleCameraColor(uv, lod) * exposureMultiplier, 1.0 ); #endif return float4(0.0, 0.0, 0.0, 1.0); } struct SurfaceDescription { float3 Color; float3 Emission; float Alpha; float AlphaClipThreshold; }; void BuildSurfaceData( FragInputs fragInputs, SurfaceDescription surfaceDescription, float3 V, out SurfaceData surfaceData ) { ZERO_INITIALIZE( SurfaceData, surfaceData ); surfaceData.color = surfaceDescription.Color; #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 builtinData.emissiveColor = surfaceDescription.Emission; #if _DEPTHOFFSET_ON builtinData.depthOffset = surfaceDescription.DepthOffset; #endif ApplyDebugToBuiltinData(builtinData); } #define SCENEPICKINGPASS #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/PickingSpaceTransforms.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/MetaPass.hlsl" VertexOutput VertexFunction( VertexInput inputMesh ) { VertexOutput o; UNITY_SETUP_INSTANCE_ID( inputMesh ); UNITY_TRANSFER_INSTANCE_ID( inputMesh, o ); float4 ase_clipPos = TransformWorldToHClip( TransformObjectToWorld(inputMesh.positionOS)); float4 screenPos = ComputeScreenPos( ase_clipPos , _ProjectionParams.x ); o.ase_texcoord2 = screenPos; float3 ase_worldPos = GetAbsolutePositionWS( TransformObjectToWorld( (inputMesh.positionOS).xyz ) ); o.ase_texcoord4.xyz = ase_worldPos; float3 ase_worldNormal = TransformObjectToWorldNormal(inputMesh.normalOS); o.ase_texcoord5.xyz = ase_worldNormal; o.ase_texcoord3.xy = inputMesh.uv0.xy; //setting value to unused interpolator channels and avoid initialization warnings o.ase_texcoord3.zw = 0; o.ase_texcoord4.w = 0; o.ase_texcoord5.w = 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 ; #ifdef EDITOR_VISUALIZATION float2 vizUV = 0; float4 lightCoord = 0; UnityEditorVizData(inputMesh.positionOS.xyz, inputMesh.uv0.xy, inputMesh.uv1.xy, inputMesh.uv2.xy, vizUV, lightCoord); #endif float2 uv = float2( 0.0, 0.0 ); if( unity_MetaVertexControl.x ) { uv = inputMesh.uv1.xy * unity_LightmapST.xy + unity_LightmapST.zw; } else if( unity_MetaVertexControl.y ) { uv = inputMesh.uv2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; } #ifdef EDITOR_VISUALIZATION o.VizUV.xy = vizUV; o.LightCoord = lightCoord; #endif o.positionCS = float4( uv * 2.0 - 1.0, inputMesh.positionOS.z > 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; float4 screenPos = packedInput.ase_texcoord2; float4 ase_grabScreenPos = ASE_ComputeGrabScreenPos( screenPos ); float4 ase_grabScreenPosNorm = ase_grabScreenPos / ase_grabScreenPos.w; float DistortValue54 = _DistortValue; float2 temp_cast_0 = (( _TimeParameters.x * _DistortionSpeed1 )).xx; float2 texCoord66 = packedInput.ase_texcoord3.xy * _DistortionTile + temp_cast_0; float3 Normals59 = UnpackNormalScale( tex2D( _Normals, texCoord66 ), 1.0f ); float4 fetchOpaqueVal55 = ASEHDSampleSceneColor(( (ase_grabScreenPosNorm).xyzw + float4( ( DistortValue54 * Normals59 ) , 0.0 ) ).xy, 0.0, 1.0); float4 temp_output_56_0 = saturate( ( fetchOpaqueVal55 / float4( 1,1,1,0 ) ) ); float grayscale67 = dot(temp_output_56_0.rgb, float3(0.299,0.587,0.114)); float4 temp_cast_4 = (grayscale67).xxxx; float4 lerpResult102 = lerp( temp_output_56_0 , temp_cast_4 , _GrayScalePower); float3 ase_worldPos = packedInput.ase_texcoord4.xyz; float3 ase_viewVectorWS = ( _WorldSpaceCameraPos.xyz - ase_worldPos ); float3 ase_viewDirWS = normalize( ase_viewVectorWS ); float3 ase_worldNormal = packedInput.ase_texcoord5.xyz; float fresnelNdotV35 = dot( ase_worldNormal, ase_viewDirWS ); float fresnelNode35 = ( 0.0 + 1.0 * pow( 1.0 - fresnelNdotV35, _CloudPower ) ); float2 temp_cast_5 = (( _CloudDirection * _TimeParameters.x )).xx; float2 texCoord30 = packedInput.ase_texcoord3.xy * _CloudTiling + temp_cast_5; float4 tex2DNode32 = tex2D( _TextureSample1, texCoord30 ); float4 clampResult37 = clamp( ( fresnelNode35 * tex2DNode32 ) , float4( 0,0,0,0 ) , float4( 0.2150944,0.2150944,0.2150944,0 ) ); float4 temp_output_61_0 = ( ( lerpResult102 + ( ( clampResult37 * _CloudBrightness ) * _CloudColor ) ) * _EmissionPower ); float fresnelNdotV109 = dot( ase_worldNormal, ase_viewDirWS ); float fresnelNode109 = ( _Bias + _Scale * pow( 1.0 - fresnelNdotV109, 2.42 ) ); float temp_output_110_0 = ( 1.0 - fresnelNode109 ); surfaceDescription.Color = temp_output_61_0.rgb; surfaceDescription.Emission = temp_output_61_0.rgb; surfaceDescription.Alpha = temp_output_110_0; 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 19701 #define ASE_SRP_VERSION 170003 #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 _CloudColor; float2 _DistortionTile; float2 _CloudTiling; float _DistortValue; float _DistortionSpeed1; float _GrayScalePower; float _CloudPower; float _CloudDirection; float _CloudBrightness; float _EmissionPower; float _Bias; float _Scale; 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 #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; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct VertexOutput { float4 positionCS : SV_Position; float4 ase_texcoord : TEXCOORD0; float4 ase_texcoord1 : TEXCOORD1; 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_worldPos = GetAbsolutePositionWS( TransformObjectToWorld( (inputMesh.positionOS).xyz ) ); o.ase_texcoord.xyz = ase_worldPos; float3 ase_worldNormal = TransformObjectToWorldNormal(inputMesh.normalOS); o.ase_texcoord1.xyz = ase_worldNormal; //setting value to unused interpolator channels and avoid initialization warnings o.ase_texcoord.w = 0; o.ase_texcoord1.w = 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; 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; 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; #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_worldPos = packedInput.ase_texcoord.xyz; float3 ase_viewVectorWS = ( _WorldSpaceCameraPos.xyz - ase_worldPos ); float3 ase_viewDirWS = normalize( ase_viewVectorWS ); float3 ase_worldNormal = packedInput.ase_texcoord1.xyz; float fresnelNdotV109 = dot( ase_worldNormal, ase_viewDirWS ); float fresnelNode109 = ( _Bias + _Scale * pow( 1.0 - fresnelNdotV109, 2.42 ) ); float temp_output_110_0 = ( 1.0 - fresnelNode109 ); surfaceDescription.Alpha = temp_output_110_0; 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 19701 #define ASE_SRP_VERSION 170003 #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 _CloudColor; float2 _DistortionTile; float2 _CloudTiling; float _DistortValue; float _DistortionSpeed1; float _GrayScalePower; float _CloudPower; float _CloudDirection; float _CloudBrightness; float _EmissionPower; float _Bias; float _Scale; 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 #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; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct VertexOutput { float4 positionCS : SV_Position; float4 ase_texcoord : TEXCOORD0; float4 ase_texcoord1 : TEXCOORD1; 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_worldPos = GetAbsolutePositionWS( TransformObjectToWorld( (inputMesh.positionOS).xyz ) ); o.ase_texcoord.xyz = ase_worldPos; float3 ase_worldNormal = TransformObjectToWorldNormal(inputMesh.normalOS); o.ase_texcoord1.xyz = ase_worldNormal; //setting value to unused interpolator channels and avoid initialization warnings o.ase_texcoord.w = 0; o.ase_texcoord1.w = 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; 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; 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; #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 ); 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; float3 ase_worldPos = packedInput.ase_texcoord.xyz; float3 ase_viewVectorWS = ( _WorldSpaceCameraPos.xyz - ase_worldPos ); float3 ase_viewDirWS = normalize( ase_viewVectorWS ); float3 ase_worldNormal = packedInput.ase_texcoord1.xyz; float fresnelNdotV109 = dot( ase_worldNormal, ase_viewDirWS ); float fresnelNode109 = ( _Bias + _Scale * pow( 1.0 - fresnelNdotV109, 2.42 ) ); float temp_output_110_0 = ( 1.0 - fresnelNode109 ); surfaceDescription.Alpha = temp_output_110_0; 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 19701 #define ASE_SRP_VERSION 170003 #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 _CloudColor; float2 _DistortionTile; float2 _CloudTiling; float _DistortValue; float _DistortionSpeed1; float _GrayScalePower; float _CloudPower; float _CloudDirection; float _CloudBrightness; float _EmissionPower; float _Bias; float _Scale; 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 #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; float3 previousPositionOS : TEXCOORD4; float3 precomputedVelocity : TEXCOORD5; 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_worldPos = GetAbsolutePositionWS( TransformObjectToWorld( (inputMesh.positionOS).xyz ) ); o.ase_texcoord3.xyz = ase_worldPos; float3 ase_worldNormal = TransformObjectToWorldNormal(inputMesh.normalOS); o.ase_texcoord4.xyz = ase_worldNormal; //setting value to unused interpolator channels and avoid initialization warnings o.ase_texcoord3.w = 0; o.ase_texcoord4.w = 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; 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 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 #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_worldPos = packedInput.ase_texcoord3.xyz; float3 ase_viewVectorWS = ( _WorldSpaceCameraPos.xyz - ase_worldPos ); float3 ase_viewDirWS = normalize( ase_viewVectorWS ); float3 ase_worldNormal = packedInput.ase_texcoord4.xyz; float fresnelNdotV109 = dot( ase_worldNormal, ase_viewDirWS ); float fresnelNode109 = ( _Bias + _Scale * pow( 1.0 - fresnelNdotV109, 2.42 ) ); float temp_output_110_0 = ( 1.0 - fresnelNode109 ); surfaceDescription.Alpha = temp_output_110_0; 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 19701 #define ASE_SRP_VERSION 170003 #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 _CloudColor; float2 _DistortionTile; float2 _CloudTiling; float _DistortValue; float _DistortionSpeed1; float _GrayScalePower; float _CloudPower; float _CloudDirection; float _CloudBrightness; float _EmissionPower; float _Bias; float _Scale; 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 #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; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct VertexOutput { float4 positionCS : SV_POSITION; float3 normalWS : TEXCOORD0; float4 tangentWS : TEXCOORD1; float4 ase_texcoord2 : TEXCOORD2; 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_worldPos = GetAbsolutePositionWS( TransformObjectToWorld( (inputMesh.positionOS).xyz ) ); o.ase_texcoord2.xyz = ase_worldPos; //setting value to unused interpolator channels and avoid initialization warnings o.ase_texcoord2.w = 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; 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; 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; #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_worldPos = packedInput.ase_texcoord2.xyz; float3 ase_viewVectorWS = ( _WorldSpaceCameraPos.xyz - ase_worldPos ); float3 ase_viewDirWS = normalize( ase_viewVectorWS ); float fresnelNdotV109 = dot( packedInput.normalWS, ase_viewDirWS ); float fresnelNode109 = ( _Bias + _Scale * pow( 1.0 - fresnelNdotV109, 2.42 ) ); float temp_output_110_0 = ( 1.0 - fresnelNode109 ); surfaceDescription.Alpha = temp_output_110_0; 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=19701 Node;AmplifyShaderEditor.RangedFloatNode;150;-688,992;Inherit;False;Property;_Bias;Bias;17;0;Create;True;0;0;0;False;0;False;-0.78;0;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode;151;-704,1088;Inherit;False;Property;_Scale;Scale;18;0;Create;True;0;0;0;False;0;False;2;2;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode;152;-672,1184;Inherit;False;Constant;_Power;Power;19;0;Create;True;0;0;0;False;0;False;2.42;0;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.FresnelNode;109;-496,992;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.SimpleTimeNode;63;-1744,-336;Inherit;False;1;0;FLOAT;1;False;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode;64;-1760,-208;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;65;-1536,-272;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.Vector2Node;25;-1616,-496;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;66;-1264,-384;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;53;-848,-688;Inherit;False;Property;_DistortValue;DistortValue;12;0;Create;True;0;0;0;False;0;False;1;0;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.SamplerNode;60;-1040,-592;Inherit;True;Property;_Normals;Normals;3;0;Create;True;0;0;0;False;0;False;-1;09e350b54acf68c4ca8b3f46a5a64977;None;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;54;-608,-672;Inherit;False;DistortValue;-1;True;1;0;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.RegisterLocalVarNode;59;-608,-592;Inherit;False;Normals;-1;True;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0 Node;AmplifyShaderEditor.SimpleTimeNode;28;-2560,400;Inherit;False;1;0;FLOAT;1;False;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode;29;-2576,272;Inherit;False;Property;_CloudDirection;Cloud Direction;8;0;Create;True;0;0;0;False;0;False;1;9.1;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.GetLocalVarNode;52;-1088,144;Inherit;False;54;DistortValue;1;0;OBJECT;;False;1;FLOAT;0 Node;AmplifyShaderEditor.GetLocalVarNode;57;-1088,240;Inherit;False;59;Normals;1;0;OBJECT;;False;1;FLOAT3;0 Node;AmplifyShaderEditor.GrabScreenPosition;48;-1312,-112;Inherit;False;0;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;27;-2320,368;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.Vector2Node;31;-2240,240;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;51;-768,96;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0 Node;AmplifyShaderEditor.ComponentMaskNode;49;-1008,-64;Inherit;False;True;True;True;True;1;0;FLOAT4;0,0,0,0;False;1;FLOAT4;0 Node;AmplifyShaderEditor.TextureCoordinatesNode;30;-2048,272;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.SimpleAddOpNode;50;-768,-48;Inherit;False;2;2;0;FLOAT4;0,0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT4;0 Node;AmplifyShaderEditor.RangedFloatNode;36;-2080,816;Inherit;False;Property;_CloudPower;Cloud Power;9;0;Create;True;0;0;0;False;0;False;2.34;0;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.SamplerNode;32;-1776,240;Inherit;True;Property;_TextureSample1;Texture Sample 1;7;0;Create;True;0;0;0;False;0;False;-1;c701d8bbcea7c2c4abbf9c22ee81138a;None;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.ScreenColorNode;55;-640,-96;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.FresnelNode;35;-1824,768;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.SimpleMultiplyOpNode;34;-1488,624;Inherit;True;2;2;0;FLOAT;0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.SimpleDivideOpNode;100;-352,48;Inherit;True;2;0;COLOR;0,0,0,0;False;1;COLOR;1,1,1,0;False;1;COLOR;0 Node;AmplifyShaderEditor.RangedFloatNode;39;-1168,768;Inherit;False;Property;_CloudBrightness;Cloud Brightness;11;0;Create;True;0;0;0;False;0;False;3.62;3.62;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.ClampOpNode;37;-1152,512;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;56;-272,-192;Inherit;True;1;0;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;38;-896,624;Inherit;True;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.ColorNode;42;-896,864;Inherit;False;Property;_CloudColor;Cloud Color;10;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;67;-96,-304;Inherit;True;1;1;0;FLOAT3;0,0,0;False;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode;70;0,-64;Inherit;False;Property;_GrayScalePower;Gray Scale Power;15;0;Create;True;0;0;0;False;0;False;0;0;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;40;-672,608;Inherit;True;2;2;0;COLOR;0,0,0,0;False;1;COLOR;1,1,1,0;False;1;COLOR;0 Node;AmplifyShaderEditor.LerpOp;102;336,-112;Inherit;False;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.SimpleAddOpNode;41;-448,448;Inherit;True;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.RangedFloatNode;62;-448,720;Inherit;False;Property;_EmissionPower;Emission Power;13;0;Create;True;0;0;0;False;0;False;11.31;11.31;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;61;-224,640;Inherit;True;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.SamplerNode;172;-144,848;Inherit;True;Property;_TextureSample3;Texture Sample 3;19;0;Create;True;0;0;0;False;0;False;-1;95ef4804fe0be4c999ddaa383536cde8;None;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.WorldSpaceCameraPos;174;-528,816;Inherit;False;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 Node;AmplifyShaderEditor.LerpOp;106;464,880;Inherit;True;3;0;COLOR;0,0,0,0;False;1;COLOR;1,1,1,0;False;2;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;20;-2144,-1680;Inherit;True;2;2;0;FLOAT4;0,0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT4;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;22;-1760,-1648;Inherit;True;2;2;0;FLOAT4;0,0,0,0;False;1;FLOAT2;0,0;False;1;FLOAT4;0 Node;AmplifyShaderEditor.Vector2Node;21;-1968,-1424;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;23;-1440,-1472;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;68;-1232,-1408;Inherit;False;Property;_Smoothness;Smoothness;14;0;Create;True;0;0;0;False;0;False;0;0;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.SamplerNode;16;-2672,-1744;Inherit;True;Property;_TextureSample0;Texture Sample 0;2;0;Create;True;0;0;0;False;0;False;-1;09e350b54acf68c4ca8b3f46a5a64977;None;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;19;-2400,-1920;Float;False;1;False;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.TextureCoordinatesNode;26;-2944,-1696;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;12;-3424,-1648;Inherit;False;1;0;FLOAT;1;False;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode;14;-3440,-1520;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;13;-3216,-1584;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.TFHCRemapNode;33;-1408,192;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;71;192,-320;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.ScreenDepthNode;112;784,848;Inherit;False;0;True;1;0;FLOAT4;0,0,0,0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleSubtractOpNode;119;-368,-480;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.ScreenPosInputsNode;129;-864,-288;Float;False;1;False;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.ScreenDepthNode;113;-720,-464;Inherit;False;1;True;1;0;FLOAT4;0,0,0,0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SamplerNode;104;64,1264;Inherit;True;Property;_TextureSample2;Texture Sample 2;16;0;Create;True;0;0;0;False;0;False;-1;95ef4804fe0be4c999ddaa383536cde8;None;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;116;-432,-128;Inherit;False;2;2;0;FLOAT;0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.StepOpNode;115;-544,-336;Inherit;True;2;0;FLOAT;0;False;1;FLOAT;1;False;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;105;240,704;Inherit;True;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.OneMinusNode;110;-96,1072;Inherit;True;1;0;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode;176;640,720;Inherit;False;Property;_Float0;Float 0;20;0;Create;True;0;0;0;False;0;False;0;0;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;165;928,480;Float;False;False;-1;2;Rendering.HighDefinition.HDUnlitGUI;0;1;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;166;928,480;Float;False;False;-1;2;Rendering.HighDefinition.HDUnlitGUI;0;1;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;167;928,480;Float;False;False;-1;2;Rendering.HighDefinition.HDUnlitGUI;0;1;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;168;928,480;Float;False;False;-1;2;Rendering.HighDefinition.HDUnlitGUI;0;1;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;169;928,480;Float;False;False;-1;2;Rendering.HighDefinition.HDUnlitGUI;0;1;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;170;928,480;Float;False;False;-1;2;Rendering.HighDefinition.HDUnlitGUI;0;1;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;171;928,480;Float;False;False;-1;2;Rendering.HighDefinition.HDUnlitGUI;0;1;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;164;928,480;Float;False;True;-1;2;Rendering.HighDefinition.HDUnlitGUI;0;13;HDRPLitDistortion;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;0;0;Alpha Clipping;1;638698269852176859;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;109;1;150;0 WireConnection;109;2;151;0 WireConnection;109;3;152;0 WireConnection;65;0;63;0 WireConnection;65;1;64;0 WireConnection;66;0;25;0 WireConnection;66;1;65;0 WireConnection;60;1;66;0 WireConnection;54;0;53;0 WireConnection;59;0;60;0 WireConnection;27;0;29;0 WireConnection;27;1;28;0 WireConnection;51;0;52;0 WireConnection;51;1;57;0 WireConnection;49;0;48;0 WireConnection;30;0;31;0 WireConnection;30;1;27;0 WireConnection;50;0;49;0 WireConnection;50;1;51;0 WireConnection;32;1;30;0 WireConnection;55;0;50;0 WireConnection;35;3;36;0 WireConnection;34;0;35;0 WireConnection;34;1;32;0 WireConnection;100;0;55;0 WireConnection;37;0;34;0 WireConnection;56;0;100;0 WireConnection;38;0;37;0 WireConnection;38;1;39;0 WireConnection;67;0;56;0 WireConnection;40;0;38;0 WireConnection;40;1;42;0 WireConnection;102;0;56;0 WireConnection;102;1;67;0 WireConnection;102;2;70;0 WireConnection;41;0;102;0 WireConnection;41;1;40;0 WireConnection;61;0;41;0 WireConnection;61;1;62;0 WireConnection;106;0;105;0 WireConnection;20;0;19;0 WireConnection;20;1;16;0 WireConnection;22;0;20;0 WireConnection;22;1;21;0 WireConnection;23;1;22;0 WireConnection;16;1;26;0 WireConnection;26;1;13;0 WireConnection;13;0;12;0 WireConnection;13;1;14;0 WireConnection;33;0;32;0 WireConnection;71;0;67;0 WireConnection;71;1;70;0 WireConnection;112;0;106;0 WireConnection;119;0;113;0 WireConnection;119;1;129;3 WireConnection;104;1;109;0 WireConnection;116;0;115;0 WireConnection;116;1;55;0 WireConnection;115;0;119;0 WireConnection;105;0;61;0 WireConnection;105;1;110;0 WireConnection;110;0;109;0 WireConnection;164;0;61;0 WireConnection;164;1;61;0 WireConnection;164;2;110;0 ASEEND*/ //CHKSM=4A50C24A08DB085B6547A525FCB207DB63C9775D