// Made with Amplify Shader Editor // Available at the Unity Asset Store - http://u3d.as/y3X Shader "MTE/URP/4 Textures/Height Blend (Packed)" { Properties { [HideInInspector] _AlphaCutoff("Alpha Cutoff ", Range(0, 1)) = 0.5 [HideInInspector] _EmissionColor("Emission Color", Color) = (1,1,1,1) _PackedSplat0("PackedSplat0", 2D) = "white" {} _PackedSplat1("PackedSplat1", 2D) = "white" {} _PackedSplat2("PackedSplat2", 2D) = "white" {} _PackedHeightMap("PackedHeightMap", 2D) = "white" {} _Control("Control", 2D) = "white" {} _HeightWeight("HeightWeight", Vector) = (0.3,0.3,0.3,0.3) _NormalStrength("NormalStrength", Vector) = (-1,-1,-1,-1) _Metallic("Metallic", Vector) = (0,0,0,0) _Smoothness("Smoothness", Vector) = (0,0,0,0) [ASEEnd]_Tilling("Tilling", Vector) = (1,1,0,0) [HideInInspector] _texcoord( "", 2D ) = "white" {} //_TransmissionShadow( "Transmission Shadow", Range( 0, 1 ) ) = 0.5 //_TransStrength( "Trans Strength", Range( 0, 50 ) ) = 1 //_TransNormal( "Trans Normal Distortion", Range( 0, 1 ) ) = 0.5 //_TransScattering( "Trans Scattering", Range( 1, 50 ) ) = 2 //_TransDirect( "Trans Direct", Range( 0, 1 ) ) = 0.9 //_TransAmbient( "Trans Ambient", Range( 0, 1 ) ) = 0.1 //_TransShadow( "Trans Shadow", Range( 0, 1 ) ) = 0.5 //_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 } SubShader { LOD 0 Tags { "RenderPipeline"="UniversalPipeline" "RenderType"="Opaque" "Queue"="Geometry" } Cull Back AlphaToMask Off HLSLINCLUDE #pragma target 3.0 #pragma prefer_hlslcc gles #pragma exclude_renderers d3d11_9x #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 DistanceFromPlane (float3 pos, float4 plane) { float d = dot (float4(pos,1.0f), plane); return d; } bool WorldViewFrustumCull (float3 wpos0, float3 wpos1, float3 wpos2, float cullEps, float4 planes[6] ) { float4 planeTest; planeTest.x = (( DistanceFromPlane(wpos0, planes[0]) > -cullEps) ? 1.0f : 0.0f ) + (( DistanceFromPlane(wpos1, planes[0]) > -cullEps) ? 1.0f : 0.0f ) + (( DistanceFromPlane(wpos2, planes[0]) > -cullEps) ? 1.0f : 0.0f ); planeTest.y = (( DistanceFromPlane(wpos0, planes[1]) > -cullEps) ? 1.0f : 0.0f ) + (( DistanceFromPlane(wpos1, planes[1]) > -cullEps) ? 1.0f : 0.0f ) + (( DistanceFromPlane(wpos2, planes[1]) > -cullEps) ? 1.0f : 0.0f ); planeTest.z = (( DistanceFromPlane(wpos0, planes[2]) > -cullEps) ? 1.0f : 0.0f ) + (( DistanceFromPlane(wpos1, planes[2]) > -cullEps) ? 1.0f : 0.0f ) + (( DistanceFromPlane(wpos2, planes[2]) > -cullEps) ? 1.0f : 0.0f ); planeTest.w = (( DistanceFromPlane(wpos0, planes[3]) > -cullEps) ? 1.0f : 0.0f ) + (( DistanceFromPlane(wpos1, planes[3]) > -cullEps) ? 1.0f : 0.0f ) + (( DistanceFromPlane(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" Tags { "LightMode"="UniversalForward" } Blend One Zero, One Zero ZWrite On ZTest LEqual Offset 0 , 0 ColorMask RGBA HLSLPROGRAM #define _NORMAL_DROPOFF_TS 1 #pragma multi_compile _ LOD_FADE_CROSSFADE #pragma multi_compile_fog #define ASE_FOG 1 #define _NORMALMAP 1 #define ASE_SRP_VERSION 100500 #pragma multi_compile _ _SCREEN_SPACE_OCCLUSION #pragma multi_compile _ _MAIN_LIGHT_SHADOWS #pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE #pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS _ADDITIONAL_OFF #pragma multi_compile _ _ADDITIONAL_LIGHT_SHADOWS #pragma multi_compile _ _SHADOWS_SOFT #pragma multi_compile _ _MIXED_LIGHTING_SUBTRACTIVE #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING #pragma multi_compile _ SHADOWS_SHADOWMASK #pragma multi_compile _ DIRLIGHTMAP_COMBINED #pragma multi_compile _ LIGHTMAP_ON #pragma vertex vert #pragma fragment frag #define SHADERPASS_FORWARD #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityInstancing.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" #if ASE_SRP_VERSION <= 70108 #define REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR #endif #if defined(UNITY_INSTANCING_ENABLED) && defined(_TERRAIN_INSTANCED_PERPIXEL_NORMAL) #define ENABLE_TERRAIN_PERPIXEL_NORMAL #endif #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" #pragma multi_compile_instancing struct VertexInput { float4 vertex : POSITION; float3 ase_normal : NORMAL; float4 ase_tangent : TANGENT; float4 texcoord1 : TEXCOORD1; float4 texcoord : TEXCOORD0; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct VertexOutput { float4 clipPos : SV_POSITION; float4 lightmapUVOrVertexSH : TEXCOORD0; half4 fogFactorAndVertexLight : TEXCOORD1; #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) float4 shadowCoord : TEXCOORD2; #endif float4 tSpace0 : TEXCOORD3; float4 tSpace1 : TEXCOORD4; float4 tSpace2 : TEXCOORD5; #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) float4 screenPos : TEXCOORD6; #endif float4 ase_texcoord7 : TEXCOORD7; UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO }; CBUFFER_START(UnityPerMaterial) float4 _PackedHeightMap_TexelSize; float4 _NormalStrength; float2 _Tilling; #ifdef _TRANSMISSION_ASE float _TransmissionShadow; #endif #ifdef _TRANSLUCENCY_ASE float _TransStrength; float _TransNormal; float _TransScattering; float _TransDirect; float _TransAmbient; float _TransShadow; #endif #ifdef TESSELLATION_ON float _TessPhongStrength; float _TessValue; float _TessMin; float _TessMax; float _TessEdgeLength; float _TessMaxDisp; #endif CBUFFER_END sampler2D _Control; sampler2D _PackedHeightMap; sampler2D _PackedSplat0; sampler2D _PackedSplat1; sampler2D _PackedSplat2; UNITY_INSTANCING_BUFFER_START(MTEURP4TexturesHeightBlendPacked) UNITY_DEFINE_INSTANCED_PROP(float4, _Control_ST) UNITY_DEFINE_INSTANCED_PROP(float4, _HeightWeight) UNITY_DEFINE_INSTANCED_PROP(float4, _PackedHeightMap_ST) UNITY_DEFINE_INSTANCED_PROP(float4, _Metallic) UNITY_DEFINE_INSTANCED_PROP(float4, _Smoothness) UNITY_INSTANCING_BUFFER_END(MTEURP4TexturesHeightBlendPacked) VertexOutput VertexFunction( VertexInput v ) { VertexOutput o = (VertexOutput)0; UNITY_SETUP_INSTANCE_ID(v); UNITY_TRANSFER_INSTANCE_ID(v, o); UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); o.ase_texcoord7.xy = v.texcoord.xy; //setting value to unused interpolator channels and avoid initialization warnings o.ase_texcoord7.zw = 0; #ifdef ASE_ABSOLUTE_VERTEX_POS float3 defaultVertexValue = v.vertex.xyz; #else float3 defaultVertexValue = float3(0, 0, 0); #endif float3 vertexValue = defaultVertexValue; #ifdef ASE_ABSOLUTE_VERTEX_POS v.vertex.xyz = vertexValue; #else v.vertex.xyz += vertexValue; #endif v.ase_normal = v.ase_normal; float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); float3 positionVS = TransformWorldToView( positionWS ); float4 positionCS = TransformWorldToHClip( positionWS ); VertexNormalInputs normalInput = GetVertexNormalInputs( v.ase_normal, v.ase_tangent ); o.tSpace0 = float4( normalInput.normalWS, positionWS.x); o.tSpace1 = float4( normalInput.tangentWS, positionWS.y); o.tSpace2 = float4( normalInput.bitangentWS, positionWS.z); OUTPUT_LIGHTMAP_UV( v.texcoord1, unity_LightmapST, o.lightmapUVOrVertexSH.xy ); OUTPUT_SH( normalInput.normalWS.xyz, o.lightmapUVOrVertexSH.xyz ); #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) o.lightmapUVOrVertexSH.zw = v.texcoord; o.lightmapUVOrVertexSH.xy = v.texcoord * unity_LightmapST.xy + unity_LightmapST.zw; #endif half3 vertexLight = VertexLighting( positionWS, normalInput.normalWS ); #ifdef ASE_FOG half fogFactor = ComputeFogFactor( positionCS.z ); #else half fogFactor = 0; #endif o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) VertexPositionInputs vertexInput = (VertexPositionInputs)0; vertexInput.positionWS = positionWS; vertexInput.positionCS = positionCS; o.shadowCoord = GetShadowCoord( vertexInput ); #endif o.clipPos = positionCS; #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) o.screenPos = ComputeScreenPos(positionCS); #endif return o; } #if defined(TESSELLATION_ON) struct VertexControl { float4 vertex : INTERNALTESSPOS; float3 ase_normal : NORMAL; float4 ase_tangent : TANGENT; float4 texcoord : TEXCOORD0; float4 texcoord1 : TEXCOORD1; 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.vertex = v.vertex; o.ase_normal = v.ase_normal; o.ase_tangent = v.ase_tangent; o.texcoord = v.texcoord; o.texcoord1 = v.texcoord1; 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 defined(ASE_FIXED_TESSELLATION) tf = FixedTess( tessValue ); #elif defined(ASE_DISTANCE_TESSELLATION) tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); #elif defined(ASE_LENGTH_TESSELLATION) tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); #elif defined(ASE_LENGTH_CULL_TESSELLATION) tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); #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.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; o.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * bary.z; o.texcoord = patch[0].texcoord * bary.x + patch[1].texcoord * bary.y + patch[2].texcoord * bary.z; o.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z; #if defined(ASE_PHONG_TESSELLATION) float3 pp[3]; for (int i = 0; i < 3; ++i) pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); float phongStrength = _TessPhongStrength; o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; #endif UNITY_TRANSFER_INSTANCE_ID(patch[0], o); return VertexFunction(o); } #else VertexOutput vert ( VertexInput v ) { return VertexFunction( v ); } #endif #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) #define ASE_SV_DEPTH SV_DepthLessEqual #else #define ASE_SV_DEPTH SV_Depth #endif half4 frag ( VertexOutput IN #ifdef ASE_DEPTH_WRITE_ON ,out float outputDepth : ASE_SV_DEPTH #endif ) : SV_Target { UNITY_SETUP_INSTANCE_ID(IN); UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); #ifdef LOD_FADE_CROSSFADE LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); #endif #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) float2 sampleCoords = (IN.lightmapUVOrVertexSH.zw / _TerrainHeightmapRecipSize.zw + 0.5f) * _TerrainHeightmapRecipSize.xy; float3 WorldNormal = TransformObjectToWorldNormal(normalize(SAMPLE_TEXTURE2D(_TerrainNormalmapTexture, sampler_TerrainNormalmapTexture, sampleCoords).rgb * 2 - 1)); float3 WorldTangent = -cross(GetObjectToWorldMatrix()._13_23_33, WorldNormal); float3 WorldBiTangent = cross(WorldNormal, -WorldTangent); #else float3 WorldNormal = normalize( IN.tSpace0.xyz ); float3 WorldTangent = IN.tSpace1.xyz; float3 WorldBiTangent = IN.tSpace2.xyz; #endif float3 WorldPosition = float3(IN.tSpace0.w,IN.tSpace1.w,IN.tSpace2.w); float3 WorldViewDirection = _WorldSpaceCameraPos.xyz - WorldPosition; float4 ShadowCoords = float4( 0, 0, 0, 0 ); #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) float4 ScreenPos = IN.screenPos; #endif #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) ShadowCoords = IN.shadowCoord; #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); #endif WorldViewDirection = SafeNormalize( WorldViewDirection ); float4 _Control_ST_Instance = UNITY_ACCESS_INSTANCED_PROP(MTEURP4TexturesHeightBlendPacked,_Control_ST); float2 uv_Control = IN.ase_texcoord7.xy * _Control_ST_Instance.xy + _Control_ST_Instance.zw; float4 tex2DNode6 = tex2D( _Control, uv_Control ); float4 _HeightWeight_Instance = UNITY_ACCESS_INSTANCED_PROP(MTEURP4TexturesHeightBlendPacked,_HeightWeight); float4 _PackedHeightMap_ST_Instance = UNITY_ACCESS_INSTANCED_PROP(MTEURP4TexturesHeightBlendPacked,_PackedHeightMap_ST); float2 uv_PackedHeightMap = IN.ase_texcoord7.xy * _PackedHeightMap_ST_Instance.xy + _PackedHeightMap_ST_Instance.zw; float2 temp_output_164_0 = ( uv_PackedHeightMap * _Tilling ); float4 temp_output_74_0 = ( tex2DNode6 * tex2D( _PackedHeightMap, temp_output_164_0 ) ); float4 break75 = temp_output_74_0; float temp_output_73_0 = max( max( max( break75.r , break75.g ) , break75.b ) , break75.a ); float4 appendResult78 = (float4(temp_output_73_0 , temp_output_73_0 , temp_output_73_0 , temp_output_73_0)); float4 temp_output_80_0 = ( tex2DNode6 * max( ( _HeightWeight_Instance + ( temp_output_74_0 - appendResult78 ) ) , float4( 0,0,0,0 ) ) ); float dotResult145 = dot( temp_output_80_0 , half4(1,1,1,1) ); float4 temp_output_81_0 = ( temp_output_80_0 / max( dotResult145 , 0.0 ) ); float4 tex2DNode5 = tex2D( _PackedSplat0, temp_output_164_0 ); float3 appendResult125 = (float3(tex2DNode5.r , tex2DNode5.g , tex2DNode5.b)); float4 tex2DNode67 = tex2D( _PackedSplat1, temp_output_164_0 ); float3 appendResult126 = (float3(tex2DNode67.r , tex2DNode67.g , tex2DNode67.b)); float4 tex2DNode68 = tex2D( _PackedSplat2, temp_output_164_0 ); float3 appendResult127 = (float3(tex2DNode68.r , tex2DNode68.g , tex2DNode68.b)); float3 appendResult128 = (float3(tex2DNode5.a , tex2DNode67.a , tex2DNode68.a)); float3 gammaToLinear152 = SRGBToLinear( appendResult128 ); float4 weightedBlendVar70 = temp_output_81_0; float3 weightedAvg70 = ( ( weightedBlendVar70.x*appendResult125 + weightedBlendVar70.y*appendResult126 + weightedBlendVar70.z*appendResult127 + weightedBlendVar70.w*gammaToLinear152 )/( weightedBlendVar70.x + weightedBlendVar70.y + weightedBlendVar70.z + weightedBlendVar70.w ) ); float2 temp_output_94_0_g102 = temp_output_164_0; float2 appendResult99_g102 = (float2(_PackedHeightMap_TexelSize.x , 0.0)); float4 tex2DNode97_g102 = tex2D( _PackedHeightMap, ( temp_output_94_0_g102 + appendResult99_g102 ) ); float4 tex2DNode100_g102 = tex2D( _PackedHeightMap, temp_output_94_0_g102 ); float temp_output_21_0_g103 = tex2DNode100_g102.r; float temp_output_128_0_g102 = _NormalStrength.x; float temp_output_22_0_g103 = temp_output_128_0_g102; float3 appendResult11_g103 = (float3(1.0 , 0.0 , ( ( tex2DNode97_g102.r - temp_output_21_0_g103 ) * temp_output_22_0_g103 ))); float2 appendResult101_g102 = (float2(0.0 , _PackedHeightMap_TexelSize.y)); float4 tex2DNode98_g102 = tex2D( _PackedHeightMap, ( temp_output_94_0_g102 + appendResult101_g102 ) ); float3 appendResult19_g103 = (float3(0.0 , 0.5 , ( ( tex2DNode98_g102.r - temp_output_21_0_g103 ) * temp_output_22_0_g103 ))); float3 normalizeResult15_g103 = normalize( cross( appendResult11_g103 , appendResult19_g103 ) ); float temp_output_21_0_g106 = tex2DNode100_g102.g; float temp_output_22_0_g106 = temp_output_128_0_g102; float3 appendResult11_g106 = (float3(1.0 , 0.0 , ( ( tex2DNode97_g102.g - temp_output_21_0_g106 ) * temp_output_22_0_g106 ))); float3 appendResult19_g106 = (float3(0.0 , 0.5 , ( ( tex2DNode98_g102.g - temp_output_21_0_g106 ) * temp_output_22_0_g106 ))); float3 normalizeResult15_g106 = normalize( cross( appendResult11_g106 , appendResult19_g106 ) ); float temp_output_21_0_g104 = tex2DNode100_g102.b; float temp_output_22_0_g104 = temp_output_128_0_g102; float3 appendResult11_g104 = (float3(1.0 , 0.0 , ( ( tex2DNode97_g102.b - temp_output_21_0_g104 ) * temp_output_22_0_g104 ))); float3 appendResult19_g104 = (float3(0.0 , 0.5 , ( ( tex2DNode98_g102.b - temp_output_21_0_g104 ) * temp_output_22_0_g104 ))); float3 normalizeResult15_g104 = normalize( cross( appendResult11_g104 , appendResult19_g104 ) ); float temp_output_21_0_g105 = tex2DNode100_g102.a; float temp_output_22_0_g105 = temp_output_128_0_g102; float3 appendResult11_g105 = (float3(1.0 , 0.0 , ( ( tex2DNode97_g102.a - temp_output_21_0_g105 ) * temp_output_22_0_g105 ))); float3 appendResult19_g105 = (float3(0.0 , 0.5 , ( ( tex2DNode98_g102.a - temp_output_21_0_g105 ) * temp_output_22_0_g105 ))); float3 normalizeResult15_g105 = normalize( cross( appendResult11_g105 , appendResult19_g105 ) ); float4 weightedBlendVar92 = temp_output_81_0; float3 weightedAvg92 = ( ( weightedBlendVar92.x*( ( normalizeResult15_g103 * 0.5 ) + float3( 0.5,0.5,0.5 ) ) + weightedBlendVar92.y*( ( normalizeResult15_g106 * 0.5 ) + float3( 0.5,0.5,0.5 ) ) + weightedBlendVar92.z*( ( normalizeResult15_g104 * 0.5 ) + float3( 0.5,0.5,0.5 ) ) + weightedBlendVar92.w*( ( normalizeResult15_g105 * 0.5 ) + float3( 0.5,0.5,0.5 ) ) )/( weightedBlendVar92.x + weightedBlendVar92.y + weightedBlendVar92.z + weightedBlendVar92.w ) ); float4 _Metallic_Instance = UNITY_ACCESS_INSTANCED_PROP(MTEURP4TexturesHeightBlendPacked,_Metallic); float dotResult141 = dot( temp_output_81_0 , _Metallic_Instance ); float4 _Smoothness_Instance = UNITY_ACCESS_INSTANCED_PROP(MTEURP4TexturesHeightBlendPacked,_Smoothness); float dotResult140 = dot( temp_output_81_0 , _Smoothness_Instance ); float3 Albedo = weightedAvg70; float3 Normal = weightedAvg92; float3 Emission = 0; float3 Specular = 0.5; float Metallic = dotResult141; float Smoothness = dotResult140; float Occlusion = 1; float Alpha = 1; float AlphaClipThreshold = 0.5; float AlphaClipThresholdShadow = 0.5; float3 BakedGI = 0; float3 RefractionColor = 1; float RefractionIndex = 1; float3 Transmission = 1; float3 Translucency = 1; #ifdef ASE_DEPTH_WRITE_ON float DepthValue = 0; #endif #ifdef _ALPHATEST_ON clip(Alpha - AlphaClipThreshold); #endif InputData inputData; inputData.positionWS = WorldPosition; inputData.viewDirectionWS = WorldViewDirection; inputData.shadowCoord = ShadowCoords; #ifdef _NORMALMAP #if _NORMAL_DROPOFF_TS inputData.normalWS = TransformTangentToWorld(Normal, half3x3( WorldTangent, WorldBiTangent, WorldNormal )); #elif _NORMAL_DROPOFF_OS inputData.normalWS = TransformObjectToWorldNormal(Normal); #elif _NORMAL_DROPOFF_WS inputData.normalWS = Normal; #endif inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS); #else inputData.normalWS = WorldNormal; #endif #ifdef ASE_FOG inputData.fogCoord = IN.fogFactorAndVertexLight.x; #endif inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) float3 SH = SampleSH(inputData.normalWS.xyz); #else float3 SH = IN.lightmapUVOrVertexSH.xyz; #endif inputData.bakedGI = SAMPLE_GI( IN.lightmapUVOrVertexSH.xy, SH, inputData.normalWS ); #ifdef _ASE_BAKEDGI inputData.bakedGI = BakedGI; #endif inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.clipPos); inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUVOrVertexSH.xy); half4 color = UniversalFragmentPBR( inputData, Albedo, Metallic, Specular, Smoothness, Occlusion, Emission, Alpha); #ifdef _TRANSMISSION_ASE { float shadow = _TransmissionShadow; Light mainLight = GetMainLight( inputData.shadowCoord ); float3 mainAtten = mainLight.color * mainLight.distanceAttenuation; mainAtten = lerp( mainAtten, mainAtten * mainLight.shadowAttenuation, shadow ); half3 mainTransmission = max(0 , -dot(inputData.normalWS, mainLight.direction)) * mainAtten * Transmission; color.rgb += Albedo * mainTransmission; #ifdef _ADDITIONAL_LIGHTS int transPixelLightCount = GetAdditionalLightsCount(); for (int i = 0; i < transPixelLightCount; ++i) { Light light = GetAdditionalLight(i, inputData.positionWS); float3 atten = light.color * light.distanceAttenuation; atten = lerp( atten, atten * light.shadowAttenuation, shadow ); half3 transmission = max(0 , -dot(inputData.normalWS, light.direction)) * atten * Transmission; color.rgb += Albedo * transmission; } #endif } #endif #ifdef _TRANSLUCENCY_ASE { float shadow = _TransShadow; float normal = _TransNormal; float scattering = _TransScattering; float direct = _TransDirect; float ambient = _TransAmbient; float strength = _TransStrength; Light mainLight = GetMainLight( inputData.shadowCoord ); float3 mainAtten = mainLight.color * mainLight.distanceAttenuation; mainAtten = lerp( mainAtten, mainAtten * mainLight.shadowAttenuation, shadow ); half3 mainLightDir = mainLight.direction + inputData.normalWS * normal; half mainVdotL = pow( saturate( dot( inputData.viewDirectionWS, -mainLightDir ) ), scattering ); half3 mainTranslucency = mainAtten * ( mainVdotL * direct + inputData.bakedGI * ambient ) * Translucency; color.rgb += Albedo * mainTranslucency * strength; #ifdef _ADDITIONAL_LIGHTS int transPixelLightCount = GetAdditionalLightsCount(); for (int i = 0; i < transPixelLightCount; ++i) { Light light = GetAdditionalLight(i, inputData.positionWS); float3 atten = light.color * light.distanceAttenuation; atten = lerp( atten, atten * light.shadowAttenuation, shadow ); half3 lightDir = light.direction + inputData.normalWS * normal; half VdotL = pow( saturate( dot( inputData.viewDirectionWS, -lightDir ) ), scattering ); half3 translucency = atten * ( VdotL * direct + inputData.bakedGI * ambient ) * Translucency; color.rgb += Albedo * translucency * strength; } #endif } #endif #ifdef _REFRACTION_ASE float4 projScreenPos = ScreenPos / ScreenPos.w; float3 refractionOffset = ( RefractionIndex - 1.0 ) * mul( UNITY_MATRIX_V, float4( WorldNormal,0 ) ).xyz * ( 1.0 - dot( WorldNormal, WorldViewDirection ) ); projScreenPos.xy += refractionOffset.xy; float3 refraction = SHADERGRAPH_SAMPLE_SCENE_COLOR( projScreenPos.xy ) * RefractionColor; color.rgb = lerp( refraction, color.rgb, color.a ); color.a = 1; #endif #ifdef ASE_FINAL_COLOR_ALPHA_MULTIPLY color.rgb *= color.a; #endif #ifdef ASE_FOG #ifdef TERRAIN_SPLAT_ADDPASS color.rgb = MixFogColor(color.rgb, half3( 0, 0, 0 ), IN.fogFactorAndVertexLight.x ); #else color.rgb = MixFog(color.rgb, IN.fogFactorAndVertexLight.x); #endif #endif #ifdef ASE_DEPTH_WRITE_ON outputDepth = DepthValue; #endif return color; } ENDHLSL } Pass { Name "ShadowCaster" Tags { "LightMode"="ShadowCaster" } ZWrite On ZTest LEqual AlphaToMask Off ColorMask 0 HLSLPROGRAM #define _NORMAL_DROPOFF_TS 1 #pragma multi_compile_instancing #pragma multi_compile _ LOD_FADE_CROSSFADE #pragma multi_compile_fog #define ASE_FOG 1 #define _NORMALMAP 1 #define ASE_SRP_VERSION 100500 #pragma vertex vert #pragma fragment frag #if ASE_SRP_VERSION >= 110000 #pragma multi_compile _ _CASTING_PUNCTUAL_LIGHT_SHADOW #endif #define SHADERPASS_SHADOWCASTER #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" struct VertexInput { float4 vertex : POSITION; float3 ase_normal : NORMAL; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct VertexOutput { float4 clipPos : SV_POSITION; #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) float3 worldPos : TEXCOORD0; #endif #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) float4 shadowCoord : TEXCOORD1; #endif UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO }; CBUFFER_START(UnityPerMaterial) float4 _PackedHeightMap_TexelSize; float4 _NormalStrength; float2 _Tilling; #ifdef _TRANSMISSION_ASE float _TransmissionShadow; #endif #ifdef _TRANSLUCENCY_ASE float _TransStrength; float _TransNormal; float _TransScattering; float _TransDirect; float _TransAmbient; float _TransShadow; #endif #ifdef TESSELLATION_ON float _TessPhongStrength; float _TessValue; float _TessMin; float _TessMax; float _TessEdgeLength; float _TessMaxDisp; #endif CBUFFER_END UNITY_INSTANCING_BUFFER_START(MTEURP4TexturesHeightBlendPacked) UNITY_INSTANCING_BUFFER_END(MTEURP4TexturesHeightBlendPacked) float3 _LightDirection; #if ASE_SRP_VERSION >= 110000 float3 _LightPosition; #endif VertexOutput VertexFunction( VertexInput v ) { VertexOutput o; UNITY_SETUP_INSTANCE_ID(v); UNITY_TRANSFER_INSTANCE_ID(v, o); UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o ); #ifdef ASE_ABSOLUTE_VERTEX_POS float3 defaultVertexValue = v.vertex.xyz; #else float3 defaultVertexValue = float3(0, 0, 0); #endif float3 vertexValue = defaultVertexValue; #ifdef ASE_ABSOLUTE_VERTEX_POS v.vertex.xyz = vertexValue; #else v.vertex.xyz += vertexValue; #endif v.ase_normal = v.ase_normal; float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) o.worldPos = positionWS; #endif float3 normalWS = TransformObjectToWorldDir(v.ase_normal); #if ASE_SRP_VERSION >= 110000 #if _CASTING_PUNCTUAL_LIGHT_SHADOW float3 lightDirectionWS = normalize(_LightPosition - positionWS); #else float3 lightDirectionWS = _LightDirection; #endif float4 clipPos = TransformWorldToHClip(ApplyShadowBias(positionWS, normalWS, lightDirectionWS)); #if UNITY_REVERSED_Z clipPos.z = min(clipPos.z, UNITY_NEAR_CLIP_VALUE); #else clipPos.z = max(clipPos.z, UNITY_NEAR_CLIP_VALUE); #endif #else float4 clipPos = TransformWorldToHClip(ApplyShadowBias(positionWS, normalWS, _LightDirection)); #if UNITY_REVERSED_Z clipPos.z = min(clipPos.z, clipPos.w * UNITY_NEAR_CLIP_VALUE); #else clipPos.z = max(clipPos.z, clipPos.w * UNITY_NEAR_CLIP_VALUE); #endif #endif #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) VertexPositionInputs vertexInput = (VertexPositionInputs)0; vertexInput.positionWS = positionWS; vertexInput.positionCS = clipPos; o.shadowCoord = GetShadowCoord( vertexInput ); #endif o.clipPos = clipPos; return o; } #if defined(TESSELLATION_ON) struct VertexControl { float4 vertex : INTERNALTESSPOS; float3 ase_normal : 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.vertex = v.vertex; o.ase_normal = v.ase_normal; 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 defined(ASE_FIXED_TESSELLATION) tf = FixedTess( tessValue ); #elif defined(ASE_DISTANCE_TESSELLATION) tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); #elif defined(ASE_LENGTH_TESSELLATION) tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); #elif defined(ASE_LENGTH_CULL_TESSELLATION) tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); #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.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; #if defined(ASE_PHONG_TESSELLATION) float3 pp[3]; for (int i = 0; i < 3; ++i) pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); float phongStrength = _TessPhongStrength; o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; #endif UNITY_TRANSFER_INSTANCE_ID(patch[0], o); return VertexFunction(o); } #else VertexOutput vert ( VertexInput v ) { return VertexFunction( v ); } #endif #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) #define ASE_SV_DEPTH SV_DepthLessEqual #else #define ASE_SV_DEPTH SV_Depth #endif half4 frag( VertexOutput IN #ifdef ASE_DEPTH_WRITE_ON ,out float outputDepth : ASE_SV_DEPTH #endif ) : SV_TARGET { UNITY_SETUP_INSTANCE_ID( IN ); UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) float3 WorldPosition = IN.worldPos; #endif float4 ShadowCoords = float4( 0, 0, 0, 0 ); #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) ShadowCoords = IN.shadowCoord; #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); #endif #endif float Alpha = 1; float AlphaClipThreshold = 0.5; float AlphaClipThresholdShadow = 0.5; #ifdef ASE_DEPTH_WRITE_ON float DepthValue = 0; #endif #ifdef _ALPHATEST_ON #ifdef _ALPHATEST_SHADOW_ON clip(Alpha - AlphaClipThresholdShadow); #else clip(Alpha - AlphaClipThreshold); #endif #endif #ifdef LOD_FADE_CROSSFADE LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); #endif #ifdef ASE_DEPTH_WRITE_ON outputDepth = DepthValue; #endif return 0; } ENDHLSL } Pass { Name "DepthOnly" Tags { "LightMode"="DepthOnly" } ZWrite On ColorMask 0 AlphaToMask Off HLSLPROGRAM #define _NORMAL_DROPOFF_TS 1 #pragma multi_compile_instancing #pragma multi_compile _ LOD_FADE_CROSSFADE #pragma multi_compile_fog #define ASE_FOG 1 #define _NORMALMAP 1 #define ASE_SRP_VERSION 100500 #pragma vertex vert #pragma fragment frag #define SHADERPASS_DEPTHONLY #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" struct VertexInput { float4 vertex : POSITION; float3 ase_normal : NORMAL; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct VertexOutput { float4 clipPos : SV_POSITION; #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) float3 worldPos : TEXCOORD0; #endif #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) float4 shadowCoord : TEXCOORD1; #endif UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO }; CBUFFER_START(UnityPerMaterial) float4 _PackedHeightMap_TexelSize; float4 _NormalStrength; float2 _Tilling; #ifdef _TRANSMISSION_ASE float _TransmissionShadow; #endif #ifdef _TRANSLUCENCY_ASE float _TransStrength; float _TransNormal; float _TransScattering; float _TransDirect; float _TransAmbient; float _TransShadow; #endif #ifdef TESSELLATION_ON float _TessPhongStrength; float _TessValue; float _TessMin; float _TessMax; float _TessEdgeLength; float _TessMaxDisp; #endif CBUFFER_END UNITY_INSTANCING_BUFFER_START(MTEURP4TexturesHeightBlendPacked) UNITY_INSTANCING_BUFFER_END(MTEURP4TexturesHeightBlendPacked) VertexOutput VertexFunction( VertexInput v ) { VertexOutput o = (VertexOutput)0; UNITY_SETUP_INSTANCE_ID(v); UNITY_TRANSFER_INSTANCE_ID(v, o); UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); #ifdef ASE_ABSOLUTE_VERTEX_POS float3 defaultVertexValue = v.vertex.xyz; #else float3 defaultVertexValue = float3(0, 0, 0); #endif float3 vertexValue = defaultVertexValue; #ifdef ASE_ABSOLUTE_VERTEX_POS v.vertex.xyz = vertexValue; #else v.vertex.xyz += vertexValue; #endif v.ase_normal = v.ase_normal; float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); float4 positionCS = TransformWorldToHClip( positionWS ); #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) o.worldPos = positionWS; #endif #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) VertexPositionInputs vertexInput = (VertexPositionInputs)0; vertexInput.positionWS = positionWS; vertexInput.positionCS = positionCS; o.shadowCoord = GetShadowCoord( vertexInput ); #endif o.clipPos = positionCS; return o; } #if defined(TESSELLATION_ON) struct VertexControl { float4 vertex : INTERNALTESSPOS; float3 ase_normal : 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.vertex = v.vertex; o.ase_normal = v.ase_normal; 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 defined(ASE_FIXED_TESSELLATION) tf = FixedTess( tessValue ); #elif defined(ASE_DISTANCE_TESSELLATION) tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); #elif defined(ASE_LENGTH_TESSELLATION) tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); #elif defined(ASE_LENGTH_CULL_TESSELLATION) tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); #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.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; #if defined(ASE_PHONG_TESSELLATION) float3 pp[3]; for (int i = 0; i < 3; ++i) pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); float phongStrength = _TessPhongStrength; o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; #endif UNITY_TRANSFER_INSTANCE_ID(patch[0], o); return VertexFunction(o); } #else VertexOutput vert ( VertexInput v ) { return VertexFunction( v ); } #endif #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) #define ASE_SV_DEPTH SV_DepthLessEqual #else #define ASE_SV_DEPTH SV_Depth #endif half4 frag( VertexOutput IN #ifdef ASE_DEPTH_WRITE_ON ,out float outputDepth : ASE_SV_DEPTH #endif ) : SV_TARGET { UNITY_SETUP_INSTANCE_ID(IN); UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) float3 WorldPosition = IN.worldPos; #endif float4 ShadowCoords = float4( 0, 0, 0, 0 ); #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) ShadowCoords = IN.shadowCoord; #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); #endif #endif float Alpha = 1; float AlphaClipThreshold = 0.5; #ifdef ASE_DEPTH_WRITE_ON float DepthValue = 0; #endif #ifdef _ALPHATEST_ON clip(Alpha - AlphaClipThreshold); #endif #ifdef LOD_FADE_CROSSFADE LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); #endif #ifdef ASE_DEPTH_WRITE_ON outputDepth = DepthValue; #endif return 0; } ENDHLSL } Pass { Name "Meta" Tags { "LightMode"="Meta" } Cull Off HLSLPROGRAM #define _NORMAL_DROPOFF_TS 1 #pragma multi_compile _ LOD_FADE_CROSSFADE #pragma multi_compile_fog #define ASE_FOG 1 #define _NORMALMAP 1 #define ASE_SRP_VERSION 100500 #pragma vertex vert #pragma fragment frag #define SHADERPASS_META #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MetaInput.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" #pragma multi_compile_instancing #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A struct VertexInput { float4 vertex : POSITION; float3 ase_normal : NORMAL; float4 texcoord1 : TEXCOORD1; float4 texcoord2 : TEXCOORD2; float4 ase_texcoord : TEXCOORD0; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct VertexOutput { float4 clipPos : SV_POSITION; #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) float3 worldPos : TEXCOORD0; #endif #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) float4 shadowCoord : TEXCOORD1; #endif float4 ase_texcoord2 : TEXCOORD2; UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO }; CBUFFER_START(UnityPerMaterial) float4 _PackedHeightMap_TexelSize; float4 _NormalStrength; float2 _Tilling; #ifdef _TRANSMISSION_ASE float _TransmissionShadow; #endif #ifdef _TRANSLUCENCY_ASE float _TransStrength; float _TransNormal; float _TransScattering; float _TransDirect; float _TransAmbient; float _TransShadow; #endif #ifdef TESSELLATION_ON float _TessPhongStrength; float _TessValue; float _TessMin; float _TessMax; float _TessEdgeLength; float _TessMaxDisp; #endif CBUFFER_END sampler2D _Control; sampler2D _PackedHeightMap; sampler2D _PackedSplat0; sampler2D _PackedSplat1; sampler2D _PackedSplat2; UNITY_INSTANCING_BUFFER_START(MTEURP4TexturesHeightBlendPacked) UNITY_DEFINE_INSTANCED_PROP(float4, _Control_ST) UNITY_DEFINE_INSTANCED_PROP(float4, _HeightWeight) UNITY_DEFINE_INSTANCED_PROP(float4, _PackedHeightMap_ST) UNITY_INSTANCING_BUFFER_END(MTEURP4TexturesHeightBlendPacked) VertexOutput VertexFunction( VertexInput v ) { VertexOutput o = (VertexOutput)0; UNITY_SETUP_INSTANCE_ID(v); UNITY_TRANSFER_INSTANCE_ID(v, o); UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); o.ase_texcoord2.xy = v.ase_texcoord.xy; //setting value to unused interpolator channels and avoid initialization warnings o.ase_texcoord2.zw = 0; #ifdef ASE_ABSOLUTE_VERTEX_POS float3 defaultVertexValue = v.vertex.xyz; #else float3 defaultVertexValue = float3(0, 0, 0); #endif float3 vertexValue = defaultVertexValue; #ifdef ASE_ABSOLUTE_VERTEX_POS v.vertex.xyz = vertexValue; #else v.vertex.xyz += vertexValue; #endif v.ase_normal = v.ase_normal; float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) o.worldPos = positionWS; #endif o.clipPos = MetaVertexPosition( v.vertex, v.texcoord1.xy, v.texcoord1.xy, unity_LightmapST, unity_DynamicLightmapST ); #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) VertexPositionInputs vertexInput = (VertexPositionInputs)0; vertexInput.positionWS = positionWS; vertexInput.positionCS = o.clipPos; o.shadowCoord = GetShadowCoord( vertexInput ); #endif return o; } #if defined(TESSELLATION_ON) struct VertexControl { float4 vertex : INTERNALTESSPOS; float3 ase_normal : NORMAL; float4 texcoord1 : TEXCOORD1; float4 texcoord2 : TEXCOORD2; 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.vertex = v.vertex; o.ase_normal = v.ase_normal; o.texcoord1 = v.texcoord1; o.texcoord2 = v.texcoord2; 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 defined(ASE_FIXED_TESSELLATION) tf = FixedTess( tessValue ); #elif defined(ASE_DISTANCE_TESSELLATION) tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); #elif defined(ASE_LENGTH_TESSELLATION) tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); #elif defined(ASE_LENGTH_CULL_TESSELLATION) tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); #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.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; o.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z; o.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * 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.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); float phongStrength = _TessPhongStrength; o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; #endif UNITY_TRANSFER_INSTANCE_ID(patch[0], o); return VertexFunction(o); } #else VertexOutput vert ( VertexInput v ) { return VertexFunction( v ); } #endif half4 frag(VertexOutput IN ) : SV_TARGET { UNITY_SETUP_INSTANCE_ID(IN); UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) float3 WorldPosition = IN.worldPos; #endif float4 ShadowCoords = float4( 0, 0, 0, 0 ); #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) ShadowCoords = IN.shadowCoord; #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); #endif #endif float4 _Control_ST_Instance = UNITY_ACCESS_INSTANCED_PROP(MTEURP4TexturesHeightBlendPacked,_Control_ST); float2 uv_Control = IN.ase_texcoord2.xy * _Control_ST_Instance.xy + _Control_ST_Instance.zw; float4 tex2DNode6 = tex2D( _Control, uv_Control ); float4 _HeightWeight_Instance = UNITY_ACCESS_INSTANCED_PROP(MTEURP4TexturesHeightBlendPacked,_HeightWeight); float4 _PackedHeightMap_ST_Instance = UNITY_ACCESS_INSTANCED_PROP(MTEURP4TexturesHeightBlendPacked,_PackedHeightMap_ST); float2 uv_PackedHeightMap = IN.ase_texcoord2.xy * _PackedHeightMap_ST_Instance.xy + _PackedHeightMap_ST_Instance.zw; float2 temp_output_164_0 = ( uv_PackedHeightMap * _Tilling ); float4 temp_output_74_0 = ( tex2DNode6 * tex2D( _PackedHeightMap, temp_output_164_0 ) ); float4 break75 = temp_output_74_0; float temp_output_73_0 = max( max( max( break75.r , break75.g ) , break75.b ) , break75.a ); float4 appendResult78 = (float4(temp_output_73_0 , temp_output_73_0 , temp_output_73_0 , temp_output_73_0)); float4 temp_output_80_0 = ( tex2DNode6 * max( ( _HeightWeight_Instance + ( temp_output_74_0 - appendResult78 ) ) , float4( 0,0,0,0 ) ) ); float dotResult145 = dot( temp_output_80_0 , half4(1,1,1,1) ); float4 temp_output_81_0 = ( temp_output_80_0 / max( dotResult145 , 0.0 ) ); float4 tex2DNode5 = tex2D( _PackedSplat0, temp_output_164_0 ); float3 appendResult125 = (float3(tex2DNode5.r , tex2DNode5.g , tex2DNode5.b)); float4 tex2DNode67 = tex2D( _PackedSplat1, temp_output_164_0 ); float3 appendResult126 = (float3(tex2DNode67.r , tex2DNode67.g , tex2DNode67.b)); float4 tex2DNode68 = tex2D( _PackedSplat2, temp_output_164_0 ); float3 appendResult127 = (float3(tex2DNode68.r , tex2DNode68.g , tex2DNode68.b)); float3 appendResult128 = (float3(tex2DNode5.a , tex2DNode67.a , tex2DNode68.a)); float3 gammaToLinear152 = SRGBToLinear( appendResult128 ); float4 weightedBlendVar70 = temp_output_81_0; float3 weightedAvg70 = ( ( weightedBlendVar70.x*appendResult125 + weightedBlendVar70.y*appendResult126 + weightedBlendVar70.z*appendResult127 + weightedBlendVar70.w*gammaToLinear152 )/( weightedBlendVar70.x + weightedBlendVar70.y + weightedBlendVar70.z + weightedBlendVar70.w ) ); float3 Albedo = weightedAvg70; float3 Emission = 0; float Alpha = 1; float AlphaClipThreshold = 0.5; #ifdef _ALPHATEST_ON clip(Alpha - AlphaClipThreshold); #endif MetaInput metaInput = (MetaInput)0; metaInput.Albedo = Albedo; metaInput.Emission = Emission; return MetaFragment(metaInput); } ENDHLSL } Pass { Name "Universal2D" Tags { "LightMode"="Universal2D" } Blend One Zero, One Zero ZWrite On ZTest LEqual Offset 0 , 0 ColorMask RGBA HLSLPROGRAM #define _NORMAL_DROPOFF_TS 1 #pragma multi_compile _ LOD_FADE_CROSSFADE #pragma multi_compile_fog #define ASE_FOG 1 #define _NORMALMAP 1 #define ASE_SRP_VERSION 100500 #pragma vertex vert #pragma fragment frag #define SHADERPASS_2D #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityInstancing.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" #pragma multi_compile_instancing #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A struct VertexInput { float4 vertex : POSITION; float3 ase_normal : NORMAL; float4 ase_texcoord : TEXCOORD0; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct VertexOutput { float4 clipPos : SV_POSITION; #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) float3 worldPos : TEXCOORD0; #endif #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) float4 shadowCoord : TEXCOORD1; #endif float4 ase_texcoord2 : TEXCOORD2; UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO }; CBUFFER_START(UnityPerMaterial) float4 _PackedHeightMap_TexelSize; float4 _NormalStrength; float2 _Tilling; #ifdef _TRANSMISSION_ASE float _TransmissionShadow; #endif #ifdef _TRANSLUCENCY_ASE float _TransStrength; float _TransNormal; float _TransScattering; float _TransDirect; float _TransAmbient; float _TransShadow; #endif #ifdef TESSELLATION_ON float _TessPhongStrength; float _TessValue; float _TessMin; float _TessMax; float _TessEdgeLength; float _TessMaxDisp; #endif CBUFFER_END sampler2D _Control; sampler2D _PackedHeightMap; sampler2D _PackedSplat0; sampler2D _PackedSplat1; sampler2D _PackedSplat2; UNITY_INSTANCING_BUFFER_START(MTEURP4TexturesHeightBlendPacked) UNITY_DEFINE_INSTANCED_PROP(float4, _Control_ST) UNITY_DEFINE_INSTANCED_PROP(float4, _HeightWeight) UNITY_DEFINE_INSTANCED_PROP(float4, _PackedHeightMap_ST) UNITY_INSTANCING_BUFFER_END(MTEURP4TexturesHeightBlendPacked) VertexOutput VertexFunction( VertexInput v ) { VertexOutput o = (VertexOutput)0; UNITY_SETUP_INSTANCE_ID( v ); UNITY_TRANSFER_INSTANCE_ID( v, o ); UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o ); o.ase_texcoord2.xy = v.ase_texcoord.xy; //setting value to unused interpolator channels and avoid initialization warnings o.ase_texcoord2.zw = 0; #ifdef ASE_ABSOLUTE_VERTEX_POS float3 defaultVertexValue = v.vertex.xyz; #else float3 defaultVertexValue = float3(0, 0, 0); #endif float3 vertexValue = defaultVertexValue; #ifdef ASE_ABSOLUTE_VERTEX_POS v.vertex.xyz = vertexValue; #else v.vertex.xyz += vertexValue; #endif v.ase_normal = v.ase_normal; float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); float4 positionCS = TransformWorldToHClip( positionWS ); #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) o.worldPos = positionWS; #endif #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) VertexPositionInputs vertexInput = (VertexPositionInputs)0; vertexInput.positionWS = positionWS; vertexInput.positionCS = positionCS; o.shadowCoord = GetShadowCoord( vertexInput ); #endif o.clipPos = positionCS; return o; } #if defined(TESSELLATION_ON) struct VertexControl { float4 vertex : INTERNALTESSPOS; float3 ase_normal : 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.vertex = v.vertex; o.ase_normal = v.ase_normal; 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 defined(ASE_FIXED_TESSELLATION) tf = FixedTess( tessValue ); #elif defined(ASE_DISTANCE_TESSELLATION) tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); #elif defined(ASE_LENGTH_TESSELLATION) tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); #elif defined(ASE_LENGTH_CULL_TESSELLATION) tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); #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.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * 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.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); float phongStrength = _TessPhongStrength; o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; #endif UNITY_TRANSFER_INSTANCE_ID(patch[0], o); return VertexFunction(o); } #else VertexOutput vert ( VertexInput v ) { return VertexFunction( v ); } #endif half4 frag(VertexOutput IN ) : SV_TARGET { UNITY_SETUP_INSTANCE_ID( IN ); UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) float3 WorldPosition = IN.worldPos; #endif float4 ShadowCoords = float4( 0, 0, 0, 0 ); #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) ShadowCoords = IN.shadowCoord; #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); #endif #endif float4 _Control_ST_Instance = UNITY_ACCESS_INSTANCED_PROP(MTEURP4TexturesHeightBlendPacked,_Control_ST); float2 uv_Control = IN.ase_texcoord2.xy * _Control_ST_Instance.xy + _Control_ST_Instance.zw; float4 tex2DNode6 = tex2D( _Control, uv_Control ); float4 _HeightWeight_Instance = UNITY_ACCESS_INSTANCED_PROP(MTEURP4TexturesHeightBlendPacked,_HeightWeight); float4 _PackedHeightMap_ST_Instance = UNITY_ACCESS_INSTANCED_PROP(MTEURP4TexturesHeightBlendPacked,_PackedHeightMap_ST); float2 uv_PackedHeightMap = IN.ase_texcoord2.xy * _PackedHeightMap_ST_Instance.xy + _PackedHeightMap_ST_Instance.zw; float2 temp_output_164_0 = ( uv_PackedHeightMap * _Tilling ); float4 temp_output_74_0 = ( tex2DNode6 * tex2D( _PackedHeightMap, temp_output_164_0 ) ); float4 break75 = temp_output_74_0; float temp_output_73_0 = max( max( max( break75.r , break75.g ) , break75.b ) , break75.a ); float4 appendResult78 = (float4(temp_output_73_0 , temp_output_73_0 , temp_output_73_0 , temp_output_73_0)); float4 temp_output_80_0 = ( tex2DNode6 * max( ( _HeightWeight_Instance + ( temp_output_74_0 - appendResult78 ) ) , float4( 0,0,0,0 ) ) ); float dotResult145 = dot( temp_output_80_0 , half4(1,1,1,1) ); float4 temp_output_81_0 = ( temp_output_80_0 / max( dotResult145 , 0.0 ) ); float4 tex2DNode5 = tex2D( _PackedSplat0, temp_output_164_0 ); float3 appendResult125 = (float3(tex2DNode5.r , tex2DNode5.g , tex2DNode5.b)); float4 tex2DNode67 = tex2D( _PackedSplat1, temp_output_164_0 ); float3 appendResult126 = (float3(tex2DNode67.r , tex2DNode67.g , tex2DNode67.b)); float4 tex2DNode68 = tex2D( _PackedSplat2, temp_output_164_0 ); float3 appendResult127 = (float3(tex2DNode68.r , tex2DNode68.g , tex2DNode68.b)); float3 appendResult128 = (float3(tex2DNode5.a , tex2DNode67.a , tex2DNode68.a)); float3 gammaToLinear152 = SRGBToLinear( appendResult128 ); float4 weightedBlendVar70 = temp_output_81_0; float3 weightedAvg70 = ( ( weightedBlendVar70.x*appendResult125 + weightedBlendVar70.y*appendResult126 + weightedBlendVar70.z*appendResult127 + weightedBlendVar70.w*gammaToLinear152 )/( weightedBlendVar70.x + weightedBlendVar70.y + weightedBlendVar70.z + weightedBlendVar70.w ) ); float3 Albedo = weightedAvg70; float Alpha = 1; float AlphaClipThreshold = 0.5; half4 color = half4( Albedo, Alpha ); #ifdef _ALPHATEST_ON clip(Alpha - AlphaClipThreshold); #endif return color; } ENDHLSL } Pass { Name "DepthNormals" Tags { "LightMode"="DepthNormals" } ZWrite On Blend One Zero ZTest LEqual ZWrite On HLSLPROGRAM #define _NORMAL_DROPOFF_TS 1 #pragma multi_compile_instancing #pragma multi_compile _ LOD_FADE_CROSSFADE #pragma multi_compile_fog #define ASE_FOG 1 #define _NORMALMAP 1 #define ASE_SRP_VERSION 100500 #pragma vertex vert #pragma fragment frag #define SHADERPASS_DEPTHNORMALSONLY #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" struct VertexInput { float4 vertex : POSITION; float3 ase_normal : NORMAL; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct VertexOutput { float4 clipPos : SV_POSITION; #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) float3 worldPos : TEXCOORD0; #endif #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) float4 shadowCoord : TEXCOORD1; #endif float3 worldNormal : TEXCOORD2; UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO }; CBUFFER_START(UnityPerMaterial) float4 _PackedHeightMap_TexelSize; float4 _NormalStrength; float2 _Tilling; #ifdef _TRANSMISSION_ASE float _TransmissionShadow; #endif #ifdef _TRANSLUCENCY_ASE float _TransStrength; float _TransNormal; float _TransScattering; float _TransDirect; float _TransAmbient; float _TransShadow; #endif #ifdef TESSELLATION_ON float _TessPhongStrength; float _TessValue; float _TessMin; float _TessMax; float _TessEdgeLength; float _TessMaxDisp; #endif CBUFFER_END UNITY_INSTANCING_BUFFER_START(MTEURP4TexturesHeightBlendPacked) UNITY_INSTANCING_BUFFER_END(MTEURP4TexturesHeightBlendPacked) VertexOutput VertexFunction( VertexInput v ) { VertexOutput o = (VertexOutput)0; UNITY_SETUP_INSTANCE_ID(v); UNITY_TRANSFER_INSTANCE_ID(v, o); UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); #ifdef ASE_ABSOLUTE_VERTEX_POS float3 defaultVertexValue = v.vertex.xyz; #else float3 defaultVertexValue = float3(0, 0, 0); #endif float3 vertexValue = defaultVertexValue; #ifdef ASE_ABSOLUTE_VERTEX_POS v.vertex.xyz = vertexValue; #else v.vertex.xyz += vertexValue; #endif v.ase_normal = v.ase_normal; float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); float3 normalWS = TransformObjectToWorldNormal( v.ase_normal ); float4 positionCS = TransformWorldToHClip( positionWS ); #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) o.worldPos = positionWS; #endif o.worldNormal = normalWS; #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) VertexPositionInputs vertexInput = (VertexPositionInputs)0; vertexInput.positionWS = positionWS; vertexInput.positionCS = positionCS; o.shadowCoord = GetShadowCoord( vertexInput ); #endif o.clipPos = positionCS; return o; } #if defined(TESSELLATION_ON) struct VertexControl { float4 vertex : INTERNALTESSPOS; float3 ase_normal : 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.vertex = v.vertex; o.ase_normal = v.ase_normal; 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 defined(ASE_FIXED_TESSELLATION) tf = FixedTess( tessValue ); #elif defined(ASE_DISTANCE_TESSELLATION) tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); #elif defined(ASE_LENGTH_TESSELLATION) tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); #elif defined(ASE_LENGTH_CULL_TESSELLATION) tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); #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.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; #if defined(ASE_PHONG_TESSELLATION) float3 pp[3]; for (int i = 0; i < 3; ++i) pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); float phongStrength = _TessPhongStrength; o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; #endif UNITY_TRANSFER_INSTANCE_ID(patch[0], o); return VertexFunction(o); } #else VertexOutput vert ( VertexInput v ) { return VertexFunction( v ); } #endif #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) #define ASE_SV_DEPTH SV_DepthLessEqual #else #define ASE_SV_DEPTH SV_Depth #endif half4 frag( VertexOutput IN #ifdef ASE_DEPTH_WRITE_ON ,out float outputDepth : ASE_SV_DEPTH #endif ) : SV_TARGET { UNITY_SETUP_INSTANCE_ID(IN); UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) float3 WorldPosition = IN.worldPos; #endif float4 ShadowCoords = float4( 0, 0, 0, 0 ); #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) ShadowCoords = IN.shadowCoord; #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); #endif #endif float Alpha = 1; float AlphaClipThreshold = 0.5; #ifdef ASE_DEPTH_WRITE_ON float DepthValue = 0; #endif #ifdef _ALPHATEST_ON clip(Alpha - AlphaClipThreshold); #endif #ifdef LOD_FADE_CROSSFADE LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); #endif #ifdef ASE_DEPTH_WRITE_ON outputDepth = DepthValue; #endif return float4(PackNormalOctRectEncode(TransformWorldToViewDir(IN.worldNormal, true)), 0.0, 0.0); } ENDHLSL } Pass { Name "GBuffer" Tags { "LightMode"="UniversalGBuffer" } Blend One Zero, One Zero ZWrite On ZTest LEqual Offset 0 , 0 ColorMask RGBA HLSLPROGRAM #define _NORMAL_DROPOFF_TS 1 #pragma multi_compile _ LOD_FADE_CROSSFADE #pragma multi_compile_fog #define ASE_FOG 1 #define _NORMALMAP 1 #define ASE_SRP_VERSION 100500 #pragma multi_compile _ _MAIN_LIGHT_SHADOWS #pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE #pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS #pragma multi_compile _ _ADDITIONAL_LIGHT_SHADOWS #pragma multi_compile _ _SHADOWS_SOFT #pragma multi_compile _ _MIXED_LIGHTING_SUBTRACTIVE #pragma multi_compile _ _GBUFFER_NORMALS_OCT #pragma multi_compile _ DIRLIGHTMAP_COMBINED #pragma multi_compile _ LIGHTMAP_ON #pragma vertex vert #pragma fragment frag #define SHADERPASS SHADERPASS_GBUFFER #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityInstancing.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityGBuffer.hlsl" #if ASE_SRP_VERSION <= 70108 #define REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR #endif #if defined(UNITY_INSTANCING_ENABLED) && defined(_TERRAIN_INSTANCED_PERPIXEL_NORMAL) #define ENABLE_TERRAIN_PERPIXEL_NORMAL #endif #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" #pragma multi_compile_instancing struct VertexInput { float4 vertex : POSITION; float3 ase_normal : NORMAL; float4 ase_tangent : TANGENT; float4 texcoord1 : TEXCOORD1; float4 texcoord : TEXCOORD0; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct VertexOutput { float4 clipPos : SV_POSITION; float4 lightmapUVOrVertexSH : TEXCOORD0; half4 fogFactorAndVertexLight : TEXCOORD1; #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) float4 shadowCoord : TEXCOORD2; #endif float4 tSpace0 : TEXCOORD3; float4 tSpace1 : TEXCOORD4; float4 tSpace2 : TEXCOORD5; #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) float4 screenPos : TEXCOORD6; #endif float4 ase_texcoord7 : TEXCOORD7; UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO }; CBUFFER_START(UnityPerMaterial) float4 _PackedHeightMap_TexelSize; float4 _NormalStrength; float2 _Tilling; #ifdef _TRANSMISSION_ASE float _TransmissionShadow; #endif #ifdef _TRANSLUCENCY_ASE float _TransStrength; float _TransNormal; float _TransScattering; float _TransDirect; float _TransAmbient; float _TransShadow; #endif #ifdef TESSELLATION_ON float _TessPhongStrength; float _TessValue; float _TessMin; float _TessMax; float _TessEdgeLength; float _TessMaxDisp; #endif CBUFFER_END sampler2D _Control; sampler2D _PackedHeightMap; sampler2D _PackedSplat0; sampler2D _PackedSplat1; sampler2D _PackedSplat2; UNITY_INSTANCING_BUFFER_START(MTEURP4TexturesHeightBlendPacked) UNITY_DEFINE_INSTANCED_PROP(float4, _Control_ST) UNITY_DEFINE_INSTANCED_PROP(float4, _HeightWeight) UNITY_DEFINE_INSTANCED_PROP(float4, _PackedHeightMap_ST) UNITY_DEFINE_INSTANCED_PROP(float4, _Metallic) UNITY_DEFINE_INSTANCED_PROP(float4, _Smoothness) UNITY_INSTANCING_BUFFER_END(MTEURP4TexturesHeightBlendPacked) VertexOutput VertexFunction( VertexInput v ) { VertexOutput o = (VertexOutput)0; UNITY_SETUP_INSTANCE_ID(v); UNITY_TRANSFER_INSTANCE_ID(v, o); UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); o.ase_texcoord7.xy = v.texcoord.xy; //setting value to unused interpolator channels and avoid initialization warnings o.ase_texcoord7.zw = 0; #ifdef ASE_ABSOLUTE_VERTEX_POS float3 defaultVertexValue = v.vertex.xyz; #else float3 defaultVertexValue = float3(0, 0, 0); #endif float3 vertexValue = defaultVertexValue; #ifdef ASE_ABSOLUTE_VERTEX_POS v.vertex.xyz = vertexValue; #else v.vertex.xyz += vertexValue; #endif v.ase_normal = v.ase_normal; float3 positionWS = TransformObjectToWorld( v.vertex.xyz ); float3 positionVS = TransformWorldToView( positionWS ); float4 positionCS = TransformWorldToHClip( positionWS ); VertexNormalInputs normalInput = GetVertexNormalInputs( v.ase_normal, v.ase_tangent ); o.tSpace0 = float4( normalInput.normalWS, positionWS.x); o.tSpace1 = float4( normalInput.tangentWS, positionWS.y); o.tSpace2 = float4( normalInput.bitangentWS, positionWS.z); OUTPUT_LIGHTMAP_UV( v.texcoord1, unity_LightmapST, o.lightmapUVOrVertexSH.xy ); OUTPUT_SH( normalInput.normalWS.xyz, o.lightmapUVOrVertexSH.xyz ); #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) o.lightmapUVOrVertexSH.zw = v.texcoord; o.lightmapUVOrVertexSH.xy = v.texcoord * unity_LightmapST.xy + unity_LightmapST.zw; #endif half3 vertexLight = VertexLighting( positionWS, normalInput.normalWS ); #ifdef ASE_FOG half fogFactor = ComputeFogFactor( positionCS.z ); #else half fogFactor = 0; #endif o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) VertexPositionInputs vertexInput = (VertexPositionInputs)0; vertexInput.positionWS = positionWS; vertexInput.positionCS = positionCS; o.shadowCoord = GetShadowCoord( vertexInput ); #endif o.clipPos = positionCS; #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) o.screenPos = ComputeScreenPos(positionCS); #endif return o; } #if defined(TESSELLATION_ON) struct VertexControl { float4 vertex : INTERNALTESSPOS; float3 ase_normal : NORMAL; float4 ase_tangent : TANGENT; float4 texcoord : TEXCOORD0; float4 texcoord1 : TEXCOORD1; 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.vertex = v.vertex; o.ase_normal = v.ase_normal; o.ase_tangent = v.ase_tangent; o.texcoord = v.texcoord; o.texcoord1 = v.texcoord1; 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 defined(ASE_FIXED_TESSELLATION) tf = FixedTess( tessValue ); #elif defined(ASE_DISTANCE_TESSELLATION) tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); #elif defined(ASE_LENGTH_TESSELLATION) tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); #elif defined(ASE_LENGTH_CULL_TESSELLATION) tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); #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.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; o.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * bary.z; o.texcoord = patch[0].texcoord * bary.x + patch[1].texcoord * bary.y + patch[2].texcoord * bary.z; o.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z; #if defined(ASE_PHONG_TESSELLATION) float3 pp[3]; for (int i = 0; i < 3; ++i) pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal)); float phongStrength = _TessPhongStrength; o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; #endif UNITY_TRANSFER_INSTANCE_ID(patch[0], o); return VertexFunction(o); } #else VertexOutput vert ( VertexInput v ) { return VertexFunction( v ); } #endif #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) #define ASE_SV_DEPTH SV_DepthLessEqual #else #define ASE_SV_DEPTH SV_Depth #endif FragmentOutput frag ( VertexOutput IN #ifdef ASE_DEPTH_WRITE_ON ,out float outputDepth : ASE_SV_DEPTH #endif ) { UNITY_SETUP_INSTANCE_ID(IN); UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); #ifdef LOD_FADE_CROSSFADE LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x ); #endif #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) float2 sampleCoords = (IN.lightmapUVOrVertexSH.zw / _TerrainHeightmapRecipSize.zw + 0.5f) * _TerrainHeightmapRecipSize.xy; float3 WorldNormal = TransformObjectToWorldNormal(normalize(SAMPLE_TEXTURE2D(_TerrainNormalmapTexture, sampler_TerrainNormalmapTexture, sampleCoords).rgb * 2 - 1)); float3 WorldTangent = -cross(GetObjectToWorldMatrix()._13_23_33, WorldNormal); float3 WorldBiTangent = cross(WorldNormal, -WorldTangent); #else float3 WorldNormal = normalize( IN.tSpace0.xyz ); float3 WorldTangent = IN.tSpace1.xyz; float3 WorldBiTangent = IN.tSpace2.xyz; #endif float3 WorldPosition = float3(IN.tSpace0.w,IN.tSpace1.w,IN.tSpace2.w); float3 WorldViewDirection = _WorldSpaceCameraPos.xyz - WorldPosition; float4 ShadowCoords = float4( 0, 0, 0, 0 ); #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) float4 ScreenPos = IN.screenPos; #endif #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) ShadowCoords = IN.shadowCoord; #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); #endif WorldViewDirection = SafeNormalize( WorldViewDirection ); float4 _Control_ST_Instance = UNITY_ACCESS_INSTANCED_PROP(MTEURP4TexturesHeightBlendPacked,_Control_ST); float2 uv_Control = IN.ase_texcoord7.xy * _Control_ST_Instance.xy + _Control_ST_Instance.zw; float4 tex2DNode6 = tex2D( _Control, uv_Control ); float4 _HeightWeight_Instance = UNITY_ACCESS_INSTANCED_PROP(MTEURP4TexturesHeightBlendPacked,_HeightWeight); float4 _PackedHeightMap_ST_Instance = UNITY_ACCESS_INSTANCED_PROP(MTEURP4TexturesHeightBlendPacked,_PackedHeightMap_ST); float2 uv_PackedHeightMap = IN.ase_texcoord7.xy * _PackedHeightMap_ST_Instance.xy + _PackedHeightMap_ST_Instance.zw; float2 temp_output_164_0 = ( uv_PackedHeightMap * _Tilling ); float4 temp_output_74_0 = ( tex2DNode6 * tex2D( _PackedHeightMap, temp_output_164_0 ) ); float4 break75 = temp_output_74_0; float temp_output_73_0 = max( max( max( break75.r , break75.g ) , break75.b ) , break75.a ); float4 appendResult78 = (float4(temp_output_73_0 , temp_output_73_0 , temp_output_73_0 , temp_output_73_0)); float4 temp_output_80_0 = ( tex2DNode6 * max( ( _HeightWeight_Instance + ( temp_output_74_0 - appendResult78 ) ) , float4( 0,0,0,0 ) ) ); float dotResult145 = dot( temp_output_80_0 , half4(1,1,1,1) ); float4 temp_output_81_0 = ( temp_output_80_0 / max( dotResult145 , 0.0 ) ); float4 tex2DNode5 = tex2D( _PackedSplat0, temp_output_164_0 ); float3 appendResult125 = (float3(tex2DNode5.r , tex2DNode5.g , tex2DNode5.b)); float4 tex2DNode67 = tex2D( _PackedSplat1, temp_output_164_0 ); float3 appendResult126 = (float3(tex2DNode67.r , tex2DNode67.g , tex2DNode67.b)); float4 tex2DNode68 = tex2D( _PackedSplat2, temp_output_164_0 ); float3 appendResult127 = (float3(tex2DNode68.r , tex2DNode68.g , tex2DNode68.b)); float3 appendResult128 = (float3(tex2DNode5.a , tex2DNode67.a , tex2DNode68.a)); float3 gammaToLinear152 = SRGBToLinear( appendResult128 ); float4 weightedBlendVar70 = temp_output_81_0; float3 weightedAvg70 = ( ( weightedBlendVar70.x*appendResult125 + weightedBlendVar70.y*appendResult126 + weightedBlendVar70.z*appendResult127 + weightedBlendVar70.w*gammaToLinear152 )/( weightedBlendVar70.x + weightedBlendVar70.y + weightedBlendVar70.z + weightedBlendVar70.w ) ); float2 temp_output_94_0_g102 = temp_output_164_0; float2 appendResult99_g102 = (float2(_PackedHeightMap_TexelSize.x , 0.0)); float4 tex2DNode97_g102 = tex2D( _PackedHeightMap, ( temp_output_94_0_g102 + appendResult99_g102 ) ); float4 tex2DNode100_g102 = tex2D( _PackedHeightMap, temp_output_94_0_g102 ); float temp_output_21_0_g103 = tex2DNode100_g102.r; float temp_output_128_0_g102 = _NormalStrength.x; float temp_output_22_0_g103 = temp_output_128_0_g102; float3 appendResult11_g103 = (float3(1.0 , 0.0 , ( ( tex2DNode97_g102.r - temp_output_21_0_g103 ) * temp_output_22_0_g103 ))); float2 appendResult101_g102 = (float2(0.0 , _PackedHeightMap_TexelSize.y)); float4 tex2DNode98_g102 = tex2D( _PackedHeightMap, ( temp_output_94_0_g102 + appendResult101_g102 ) ); float3 appendResult19_g103 = (float3(0.0 , 0.5 , ( ( tex2DNode98_g102.r - temp_output_21_0_g103 ) * temp_output_22_0_g103 ))); float3 normalizeResult15_g103 = normalize( cross( appendResult11_g103 , appendResult19_g103 ) ); float temp_output_21_0_g106 = tex2DNode100_g102.g; float temp_output_22_0_g106 = temp_output_128_0_g102; float3 appendResult11_g106 = (float3(1.0 , 0.0 , ( ( tex2DNode97_g102.g - temp_output_21_0_g106 ) * temp_output_22_0_g106 ))); float3 appendResult19_g106 = (float3(0.0 , 0.5 , ( ( tex2DNode98_g102.g - temp_output_21_0_g106 ) * temp_output_22_0_g106 ))); float3 normalizeResult15_g106 = normalize( cross( appendResult11_g106 , appendResult19_g106 ) ); float temp_output_21_0_g104 = tex2DNode100_g102.b; float temp_output_22_0_g104 = temp_output_128_0_g102; float3 appendResult11_g104 = (float3(1.0 , 0.0 , ( ( tex2DNode97_g102.b - temp_output_21_0_g104 ) * temp_output_22_0_g104 ))); float3 appendResult19_g104 = (float3(0.0 , 0.5 , ( ( tex2DNode98_g102.b - temp_output_21_0_g104 ) * temp_output_22_0_g104 ))); float3 normalizeResult15_g104 = normalize( cross( appendResult11_g104 , appendResult19_g104 ) ); float temp_output_21_0_g105 = tex2DNode100_g102.a; float temp_output_22_0_g105 = temp_output_128_0_g102; float3 appendResult11_g105 = (float3(1.0 , 0.0 , ( ( tex2DNode97_g102.a - temp_output_21_0_g105 ) * temp_output_22_0_g105 ))); float3 appendResult19_g105 = (float3(0.0 , 0.5 , ( ( tex2DNode98_g102.a - temp_output_21_0_g105 ) * temp_output_22_0_g105 ))); float3 normalizeResult15_g105 = normalize( cross( appendResult11_g105 , appendResult19_g105 ) ); float4 weightedBlendVar92 = temp_output_81_0; float3 weightedAvg92 = ( ( weightedBlendVar92.x*( ( normalizeResult15_g103 * 0.5 ) + float3( 0.5,0.5,0.5 ) ) + weightedBlendVar92.y*( ( normalizeResult15_g106 * 0.5 ) + float3( 0.5,0.5,0.5 ) ) + weightedBlendVar92.z*( ( normalizeResult15_g104 * 0.5 ) + float3( 0.5,0.5,0.5 ) ) + weightedBlendVar92.w*( ( normalizeResult15_g105 * 0.5 ) + float3( 0.5,0.5,0.5 ) ) )/( weightedBlendVar92.x + weightedBlendVar92.y + weightedBlendVar92.z + weightedBlendVar92.w ) ); float4 _Metallic_Instance = UNITY_ACCESS_INSTANCED_PROP(MTEURP4TexturesHeightBlendPacked,_Metallic); float dotResult141 = dot( temp_output_81_0 , _Metallic_Instance ); float4 _Smoothness_Instance = UNITY_ACCESS_INSTANCED_PROP(MTEURP4TexturesHeightBlendPacked,_Smoothness); float dotResult140 = dot( temp_output_81_0 , _Smoothness_Instance ); float3 Albedo = weightedAvg70; float3 Normal = weightedAvg92; float3 Emission = 0; float3 Specular = 0.5; float Metallic = dotResult141; float Smoothness = dotResult140; float Occlusion = 1; float Alpha = 1; float AlphaClipThreshold = 0.5; float AlphaClipThresholdShadow = 0.5; float3 BakedGI = 0; float3 RefractionColor = 1; float RefractionIndex = 1; float3 Transmission = 1; float3 Translucency = 1; #ifdef ASE_DEPTH_WRITE_ON float DepthValue = 0; #endif #ifdef _ALPHATEST_ON clip(Alpha - AlphaClipThreshold); #endif InputData inputData; inputData.positionWS = WorldPosition; inputData.viewDirectionWS = WorldViewDirection; inputData.shadowCoord = ShadowCoords; #ifdef _NORMALMAP #if _NORMAL_DROPOFF_TS inputData.normalWS = TransformTangentToWorld(Normal, half3x3( WorldTangent, WorldBiTangent, WorldNormal )); #elif _NORMAL_DROPOFF_OS inputData.normalWS = TransformObjectToWorldNormal(Normal); #elif _NORMAL_DROPOFF_WS inputData.normalWS = Normal; #endif inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS); #else inputData.normalWS = WorldNormal; #endif #ifdef ASE_FOG inputData.fogCoord = IN.fogFactorAndVertexLight.x; #endif inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) float3 SH = SampleSH(inputData.normalWS.xyz); #else float3 SH = IN.lightmapUVOrVertexSH.xyz; #endif inputData.bakedGI = SAMPLE_GI( IN.lightmapUVOrVertexSH.xy, SH, inputData.normalWS ); #ifdef _ASE_BAKEDGI inputData.bakedGI = BakedGI; #endif BRDFData brdfData; InitializeBRDFData( Albedo, Metallic, Specular, Smoothness, Alpha, brdfData); half4 color; color.rgb = GlobalIllumination( brdfData, inputData.bakedGI, Occlusion, inputData.normalWS, inputData.viewDirectionWS); color.a = Alpha; #ifdef _TRANSMISSION_ASE { float shadow = _TransmissionShadow; Light mainLight = GetMainLight( inputData.shadowCoord ); float3 mainAtten = mainLight.color * mainLight.distanceAttenuation; mainAtten = lerp( mainAtten, mainAtten * mainLight.shadowAttenuation, shadow ); half3 mainTransmission = max(0 , -dot(inputData.normalWS, mainLight.direction)) * mainAtten * Transmission; color.rgb += Albedo * mainTransmission; #ifdef _ADDITIONAL_LIGHTS int transPixelLightCount = GetAdditionalLightsCount(); for (int i = 0; i < transPixelLightCount; ++i) { Light light = GetAdditionalLight(i, inputData.positionWS); float3 atten = light.color * light.distanceAttenuation; atten = lerp( atten, atten * light.shadowAttenuation, shadow ); half3 transmission = max(0 , -dot(inputData.normalWS, light.direction)) * atten * Transmission; color.rgb += Albedo * transmission; } #endif } #endif #ifdef _TRANSLUCENCY_ASE { float shadow = _TransShadow; float normal = _TransNormal; float scattering = _TransScattering; float direct = _TransDirect; float ambient = _TransAmbient; float strength = _TransStrength; Light mainLight = GetMainLight( inputData.shadowCoord ); float3 mainAtten = mainLight.color * mainLight.distanceAttenuation; mainAtten = lerp( mainAtten, mainAtten * mainLight.shadowAttenuation, shadow ); half3 mainLightDir = mainLight.direction + inputData.normalWS * normal; half mainVdotL = pow( saturate( dot( inputData.viewDirectionWS, -mainLightDir ) ), scattering ); half3 mainTranslucency = mainAtten * ( mainVdotL * direct + inputData.bakedGI * ambient ) * Translucency; color.rgb += Albedo * mainTranslucency * strength; #ifdef _ADDITIONAL_LIGHTS int transPixelLightCount = GetAdditionalLightsCount(); for (int i = 0; i < transPixelLightCount; ++i) { Light light = GetAdditionalLight(i, inputData.positionWS); float3 atten = light.color * light.distanceAttenuation; atten = lerp( atten, atten * light.shadowAttenuation, shadow ); half3 lightDir = light.direction + inputData.normalWS * normal; half VdotL = pow( saturate( dot( inputData.viewDirectionWS, -lightDir ) ), scattering ); half3 translucency = atten * ( VdotL * direct + inputData.bakedGI * ambient ) * Translucency; color.rgb += Albedo * translucency * strength; } #endif } #endif #ifdef _REFRACTION_ASE float4 projScreenPos = ScreenPos / ScreenPos.w; float3 refractionOffset = ( RefractionIndex - 1.0 ) * mul( UNITY_MATRIX_V, float4( WorldNormal, 0 ) ).xyz * ( 1.0 - dot( WorldNormal, WorldViewDirection ) ); projScreenPos.xy += refractionOffset.xy; float3 refraction = SHADERGRAPH_SAMPLE_SCENE_COLOR( projScreenPos.xy ) * RefractionColor; color.rgb = lerp( refraction, color.rgb, color.a ); color.a = 1; #endif #ifdef ASE_FINAL_COLOR_ALPHA_MULTIPLY color.rgb *= color.a; #endif #ifdef ASE_FOG #ifdef TERRAIN_SPLAT_ADDPASS color.rgb = MixFogColor(color.rgb, half3( 0, 0, 0 ), IN.fogFactorAndVertexLight.x ); #else color.rgb = MixFog(color.rgb, IN.fogFactorAndVertexLight.x); #endif #endif #ifdef ASE_DEPTH_WRITE_ON outputDepth = DepthValue; #endif return BRDFDataToGbuffer(brdfData, inputData, Smoothness, Emission + color.rgb); } ENDHLSL } } CustomEditor "MTE.MTEPackedShaderGUI" Fallback "Hidden/InternalErrorShader" } /*ASEBEGIN Version=18927 -7;168;1920;851;4732.505;1590.094;4.160981;True;False Node;AmplifyShaderEditor.TexturePropertyNode;83;-2633.47,-255.8694;Inherit;True;Property;_PackedHeightMap;PackedHeightMap;3;0;Create;True;0;0;0;False;0;False;None;None;False;white;Auto;Texture2D;-1;0;2;SAMPLER2D;0;SAMPLERSTATE;1 Node;AmplifyShaderEditor.TextureCoordinatesNode;85;-2285.29,-277.3926;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.Vector2Node;165;-2259.041,-143.5288;Inherit;False;Property;_Tilling;Tilling;9;0;Create;True;0;0;0;False;0;False;1,1;1,1;0;3;FLOAT2;0;FLOAT;1;FLOAT;2 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;164;-2000.041,-257.5288;Inherit;False;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0 Node;AmplifyShaderEditor.SamplerNode;6;-1970.636,-759.5891;Inherit;True;Property;_Control;Control;4;0;Create;True;0;0;0;False;0;False;-1;None;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;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.SamplerNode;16;-1973.355,-479.3829;Inherit;True;Property;_Normal0;Packed Heightmap;5;0;Create;False;0;0;0;False;0;False;-1;None;None;True;0;True;black;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;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;74;-1440.455,-504.7105;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.BreakToComponentsNode;75;-1362.836,-277.3963;Inherit;False;COLOR;1;0;COLOR;0,0,0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15 Node;AmplifyShaderEditor.SimpleMaxOpNode;71;-1105.137,-328.6974;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMaxOpNode;72;-965.637,-295.7977;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMaxOpNode;73;-863.937,-194.8971;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.DynamicAppendNode;78;-789.9724,-348.0184;Inherit;False;FLOAT4;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT4;0 Node;AmplifyShaderEditor.SimpleSubtractOpNode;77;-617.5756,-412.9189;Inherit;False;2;0;COLOR;0,0,0,0;False;1;FLOAT4;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.Vector4Node;90;-691.5453,-796.3668;Float;False;InstancedProperty;_HeightWeight;HeightWeight;5;0;Create;True;0;0;0;True;0;False;0.3,0.3,0.3,0.3;0.3,0.3,0.3,0.3;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.SimpleAddOpNode;89;-451.204,-468.3737;Inherit;False;2;2;0;FLOAT4;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;FLOAT4;0 Node;AmplifyShaderEditor.SimpleMaxOpNode;76;-326.841,-404.1223;Inherit;False;2;0;FLOAT4;0,0,0,0;False;1;FLOAT4;0,0,0,0;False;1;FLOAT4;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;80;-211.9196,-536.009;Inherit;True;2;2;0;COLOR;0,0,0,0;False;1;FLOAT4;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.Vector4Node;144;5.750707,-262.8185;Half;False;Constant;_Vector0;Vector 0;14;0;Create;True;0;0;0;False;0;False;1,1,1,1;0,0,0,0;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.SamplerNode;5;-680.9175,-84.2321;Inherit;True;Property;_PackedSplat0;PackedSplat0;0;0;Create;True;0;0;0;False;0;False;67;None;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;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.DotProductOpNode;145;278.6508,-330.4185;Inherit;False;2;0;COLOR;0,0,0,0;False;1;FLOAT4;0,0,0,0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SamplerNode;68;-679.5864,303.4979;Inherit;True;Property;_PackedSplat2;PackedSplat2;2;0;Create;True;0;0;0;False;0;False;68;None;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;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.SamplerNode;67;-679.8618,109.4893;Inherit;True;Property;_PackedSplat1;PackedSplat1;1;0;Create;True;0;0;0;False;0;False;67;None;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;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.Vector4Node;149;-152.8214,549.5253;Float;False;Property;_NormalStrength;NormalStrength;6;0;Create;True;0;0;0;False;0;False;-1,-1,-1,-1;80,80,80,80;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.SimpleMaxOpNode;120;406.8276,-262.5091;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.DynamicAppendNode;128;-264.5563,328.7169;Inherit;False;FLOAT3;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT3;0 Node;AmplifyShaderEditor.DynamicAppendNode;127;-253.5769,208.6139;Inherit;False;FLOAT3;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT3;0 Node;AmplifyShaderEditor.SimpleDivideOpNode;81;556.3873,-432.8118;Inherit;True;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.Vector4Node;155;525.7409,619.5445;Inherit;False;InstancedProperty;_Metallic;Metallic;7;0;Create;True;0;0;0;False;0;False;0,0,0,0;0,0,0,0;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.Vector4Node;156;527.5974,840.1368;Inherit;False;InstancedProperty;_Smoothness;Smoothness;8;0;Create;True;0;0;0;False;0;False;0,0,0,0;0,0,0,0;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.FunctionNode;154;145.9654,457.4018;Inherit;False;GetNormalsFromPackedHeight;-1;;102;e838e220bfb1a834390a94fca7b1804b;0;3;128;FLOAT;3;False;102;SAMPLER2D;0;False;94;FLOAT2;0,0;False;4;FLOAT3;124;FLOAT3;50;FLOAT3;109;FLOAT3;110 Node;AmplifyShaderEditor.DynamicAppendNode;126;-262.5788,77.52241;Inherit;False;FLOAT3;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT3;0 Node;AmplifyShaderEditor.DynamicAppendNode;125;-260.0866,-57.8117;Inherit;False;FLOAT3;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT3;0 Node;AmplifyShaderEditor.GammaToLinearNode;152;-77.62876,327.9963;Inherit;False;1;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0 Node;AmplifyShaderEditor.WeightedBlendNode;92;908.6145,98.05365;Inherit;True;5;0;COLOR;0,0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;3;FLOAT3;0,0,0;False;4;FLOAT3;0,0,0;False;1;FLOAT3;0 Node;AmplifyShaderEditor.WeightedBlendNode;70;911.4041,-231.6432;Inherit;True;5;0;COLOR;0,0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;3;FLOAT3;0,0,0;False;4;FLOAT3;0,0,0;False;1;FLOAT3;0 Node;AmplifyShaderEditor.DotProductOpNode;140;883.8511,793.309;Inherit;False;2;0;COLOR;0,0,0,0;False;1;FLOAT4;0,0,0,0;False;1;FLOAT;0 Node;AmplifyShaderEditor.DotProductOpNode;141;952.7538,529.8822;Inherit;False;2;0;COLOR;0,0,0,0;False;1;FLOAT4;0,0,0,0;False;1;FLOAT;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;159;1258.334,-173.4329;Float;False;False;-1;2;UnityEditor.ShaderGraph.PBRMasterGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;ShadowCaster;0;2;ShadowCaster;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;0;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;False;False;True;False;False;False;False;0;False;-1;False;False;False;False;False;False;False;False;False;True;1;False;-1;True;3;False;-1;False;True;1;LightMode=ShadowCaster;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;160;1258.334,-173.4329;Float;False;False;-1;2;UnityEditor.ShaderGraph.PBRMasterGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;DepthOnly;0;3;DepthOnly;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;0;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;False;False;True;False;False;False;False;0;False;-1;False;False;False;False;False;False;False;False;False;True;1;False;-1;False;False;True;1;LightMode=DepthOnly;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;158;1258.334,-173.4329;Float;False;True;-1;2;MTE.MTEPackedShaderGUI;0;2;MTE/URP/4 Textures/Height Blend (Packed);94348b07e5e8bab40bd6c8a1e3df54cd;True;Forward;0;1;Forward;18;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;1;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;1;LightMode=UniversalForward;False;False;0;Hidden/InternalErrorShader;0;0;Standard;38;Workflow;1;Surface;0; Refraction Model;0; Blend;0;Two Sided;1;Fragment Normal Space,InvertActionOnDeselection;0;Transmission;0; Transmission Shadow;0.5,False,-1;Translucency;0; Translucency Strength;1,False,-1; Normal Distortion;0.5,False,-1; Scattering;2,False,-1; Direct;0.9,False,-1; Ambient;0.1,False,-1; Shadow;0.5,False,-1;Cast Shadows;1; Use Shadow Threshold;0;Receive Shadows;1;GPU Instancing;1;LOD CrossFade;1;Built-in Fog;1;_FinalColorxAlpha;0;Meta Pass;1;Override Baked GI;0;Extra Pre Pass;0;DOTS Instancing;0;Tessellation;0; Phong;0; Strength;0.5,False,-1; Type;0; Tess;16,False,-1; Min;10,False,-1; Max;25,False,-1; Edge Length;16,False,-1; Max Displacement;25,False,-1;Write Depth;0; Early Z;0;Vertex Position,InvertActionOnDeselection;1;0;8;False;True;True;True;True;True;True;True;False;;False;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;162;1258.334,-173.4329;Float;False;False;-1;2;UnityEditor.ShaderGraph.PBRMasterGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;Universal2D;0;5;Universal2D;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;0;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;1;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;1;LightMode=Universal2D;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;161;1258.334,-173.4329;Float;False;False;-1;2;UnityEditor.ShaderGraph.PBRMasterGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;Meta;0;4;Meta;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;0;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;-1;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;166;1258.334,-113.4329;Float;False;False;-1;2;UnityEditor.ShaderGraph.PBRMasterGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;DepthNormals;0;6;DepthNormals;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;0;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;0;1;False;-1;0;False;-1;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;1;False;-1;True;3;False;-1;False;True;1;LightMode=DepthNormals;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;157;1258.334,-173.4329;Float;False;False;-1;2;UnityEditor.ShaderGraph.PBRMasterGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;ExtraPrePass;0;0;ExtraPrePass;5;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;0;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;0;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;0;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;167;1258.334,-113.4329;Float;False;False;-1;2;UnityEditor.ShaderGraph.PBRMasterGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;GBuffer;0;7;GBuffer;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;0;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;1;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;1;LightMode=UniversalGBuffer;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0 WireConnection;85;2;83;0 WireConnection;164;0;85;0 WireConnection;164;1;165;0 WireConnection;16;0;83;0 WireConnection;16;1;164;0 WireConnection;74;0;6;0 WireConnection;74;1;16;0 WireConnection;75;0;74;0 WireConnection;71;0;75;0 WireConnection;71;1;75;1 WireConnection;72;0;71;0 WireConnection;72;1;75;2 WireConnection;73;0;72;0 WireConnection;73;1;75;3 WireConnection;78;0;73;0 WireConnection;78;1;73;0 WireConnection;78;2;73;0 WireConnection;78;3;73;0 WireConnection;77;0;74;0 WireConnection;77;1;78;0 WireConnection;89;0;90;0 WireConnection;89;1;77;0 WireConnection;76;0;89;0 WireConnection;80;0;6;0 WireConnection;80;1;76;0 WireConnection;5;1;164;0 WireConnection;145;0;80;0 WireConnection;145;1;144;0 WireConnection;68;1;164;0 WireConnection;67;1;164;0 WireConnection;120;0;145;0 WireConnection;128;0;5;4 WireConnection;128;1;67;4 WireConnection;128;2;68;4 WireConnection;127;0;68;1 WireConnection;127;1;68;2 WireConnection;127;2;68;3 WireConnection;81;0;80;0 WireConnection;81;1;120;0 WireConnection;154;128;149;0 WireConnection;154;102;83;0 WireConnection;154;94;164;0 WireConnection;126;0;67;1 WireConnection;126;1;67;2 WireConnection;126;2;67;3 WireConnection;125;0;5;1 WireConnection;125;1;5;2 WireConnection;125;2;5;3 WireConnection;152;0;128;0 WireConnection;92;0;81;0 WireConnection;92;1;154;124 WireConnection;92;2;154;50 WireConnection;92;3;154;109 WireConnection;92;4;154;110 WireConnection;70;0;81;0 WireConnection;70;1;125;0 WireConnection;70;2;126;0 WireConnection;70;3;127;0 WireConnection;70;4;152;0 WireConnection;140;0;81;0 WireConnection;140;1;156;0 WireConnection;141;0;81;0 WireConnection;141;1;155;0 WireConnection;158;0;70;0 WireConnection;158;1;92;0 WireConnection;158;3;141;0 WireConnection;158;4;140;0 ASEEND*/ //CHKSM=327C40E4CB6AA152E4DB21662CBBF4D54ED8913E