// Made with Amplify Shader Editor v1.9.9.4 // Available at the Unity Asset Store - http://u3d.as/y3X Shader "Raygeas/URP/Vegetation" { Properties { [HideInInspector] _EmissionColor("Emission Color", Color) = (1,1,1,1) [Header(Maps)][Space(5)] _Tiling( "Tiling", Float ) = 1 [NoScaleOffset][Space(5)] _Albedo( "Base", 2D ) = "white" {} [NoScaleOffset][Normal] _Normal( "Normal", 2D ) = "bump" {} [NoScaleOffset] _SmoothnessTexture( "Smoothness", 2D ) = "white" {} _AlphaCutoff( "Opacity Cutoff", Range( 0, 1 ) ) = 0.35 [Header(Settings)][Space(5)] _MainColor( "Main Color", Color ) = ( 1, 1, 1, 0 ) _NormalScale( "Normal", Float ) = 1 _Smoothness( "Smoothness", Range( 0, 1 ) ) = 0 [Header(Second Color)][Space(5)][Toggle( _COLOR2ENABLE_ON )] _Color2Enable( "Enable", Float ) = 0 [Space(10)] _SecondColor( "Second Color", Color ) = ( 0, 0, 0, 0 ) [KeywordEnum( World_Noise_2D,World_Noise_3D,Vertex_Gradient,UV_Gradient )] _SecondColorOverlayType( "Overlay Method", Float ) = 0 _SecondColorOffset( "Offset", Float ) = 1 _SecondColorFade( "Balance", Float ) = 1 _WorldNoiseScale( "World Noise Scale", Float ) = 1 [Header(Wind)][Space(5)][Toggle( _ENABLEWIND_ON )] _EnableWind( "Enable", Float ) = 1 [Space(10)] _WindForce( "Force", Range( 0, 1 ) ) = 0.6696684 _WindWavesScale( "Waves Scale", Range( 0, 1 ) ) = 0.25 _WindFlowDensity( "Flow Density", Range( 0.5, 5 ) ) = 1 [Toggle] _UVBaseLock( "UV Base Lock", Float ) = 0 [Toggle][Header(Grass Distance Fade)][Space(5)] _GrassDistanceFadeEnable( "Enable", Float ) = 0 [Space(10)] _GrassFadeDistance( "Distance", Float ) = 30 _GrassFade( "Fade", Range( 0, 1 ) ) = 1 [Header(Lighting)][Space(5)] _LightingFlatness( "Lighting Flatness", Range( 0, 1 ) ) = 0 //_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 //_InstancedTerrainNormals("Instanced Terrain Normals", Float) = 1.0 [ToggleOff] _SpecularHighlights("Specular Highlights", Float) = 1.0 [ToggleOff] _EnvironmentReflections("Environment Reflections", Float) = 1.0 [ToggleUI] _ReceiveShadows("Receive Shadows", Float) = 1.0 [HideInInspector] _QueueOffset("_QueueOffset", Float) = 0 [HideInInspector] _QueueControl("_QueueControl", Float) = -1 [HideInInspector][NoScaleOffset] unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} [HideInInspector][NoScaleOffset] unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} [HideInInspector][NoScaleOffset] unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} } SubShader { LOD 0 Tags { "RenderPipeline"="UniversalPipeline" "RenderType"="TransparentCutout" "Queue"="AlphaTest" "UniversalMaterialType"="Lit" } Cull Off ZWrite On ZTest LEqual Offset 0 , 0 AlphaToMask Off HLSLINCLUDE #pragma target 4.5 #pragma prefer_hlslcc gles // ensure rendering platforms toggle list is visible #if ( SHADER_TARGET > 35 ) && defined( SHADER_API_GLES3 ) #error For WebGL2/GLES3, please set your shader target to 3.5 via SubShader options. URP shaders in ASE use target 4.5 by default. #endif #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Filtering.hlsl" #ifndef ASE_TESS_FUNCS #define ASE_TESS_FUNCS float4 FixedTess( float tessValue ) { return tessValue; } float CalcDistanceTessFactor (float4 vertex, float minDist, float maxDist, float tess, float4x4 o2w, float3 cameraPos ) { float3 wpos = mul(o2w,vertex).xyz; float dist = distance (wpos, cameraPos); float f = clamp(1.0 - (dist - minDist) / (maxDist - minDist), 0.01, 1.0) * tess; return f; } float4 CalcTriEdgeTessFactors (float3 triVertexFactors) { float4 tess; tess.x = 0.5 * (triVertexFactors.y + triVertexFactors.z); tess.y = 0.5 * (triVertexFactors.x + triVertexFactors.z); tess.z = 0.5 * (triVertexFactors.x + triVertexFactors.y); tess.w = (triVertexFactors.x + triVertexFactors.y + triVertexFactors.z) / 3.0f; return tess; } float CalcEdgeTessFactor (float3 wpos0, float3 wpos1, float edgeLen, float3 cameraPos, float4 scParams ) { float dist = distance (0.5 * (wpos0+wpos1), cameraPos); float len = distance(wpos0, wpos1); float f = max(len * scParams.y / (edgeLen * dist), 1.0); return f; } float 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 ASE_GEOMETRY #define _NORMAL_DROPOFF_TS 1 #pragma shader_feature_local_fragment _RECEIVE_SHADOWS_OFF #pragma shader_feature_local_fragment _SPECULARHIGHLIGHTS_OFF #pragma shader_feature_local_fragment _ENVIRONMENTREFLECTIONS_OFF #pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION #pragma multi_compile_instancing #pragma instancing_options renderinglayer #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE #pragma multi_compile_fog #define ASE_FOG 1 #pragma multi_compile_fragment _ DEBUG_DISPLAY #pragma multi_compile_local_fragment _ALPHATEST_ON #define _NORMALMAP 1 #define ASE_VERSION 19904 #define ASE_SRP_VERSION 140011 #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN #pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS #pragma multi_compile _ EVALUATE_SH_MIXED EVALUATE_SH_VERTEX #pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS #pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING #pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION #pragma multi_compile_fragment _ _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 #pragma multi_compile _ _LIGHT_LAYERS #pragma multi_compile_fragment _ _LIGHT_COOKIES #pragma multi_compile _ _FORWARD_PLUS #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING #pragma multi_compile _ SHADOWS_SHADOWMASK #pragma multi_compile _ DIRLIGHTMAP_COMBINED #pragma multi_compile _ LIGHTMAP_ON #pragma multi_compile _ DYNAMICLIGHTMAP_ON #pragma vertex vert #pragma fragment frag #if defined(_SPECULAR_SETUP) && defined(ASE_LIGHTING_SIMPLE) #define _SPECULAR_COLOR 1 #endif #define SHADERPASS SHADERPASS_FORWARD #if ASE_SRP_VERSION >=140007 #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" #endif #if ASE_SRP_VERSION >=140007 #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" #endif #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" #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/Input.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" #if ASE_SRP_VERSION >=140009 #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" #endif #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" #if defined(LOD_FADE_CROSSFADE) #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" #endif #if defined( UNITY_INSTANCING_ENABLED ) && defined( ASE_INSTANCED_TERRAIN ) && ( defined(_TERRAIN_INSTANCED_PERPIXEL_NORMAL) || defined(_INSTANCEDTERRAINNORMALS_PIXEL) ) #define ENABLE_TERRAIN_PERPIXEL_NORMAL #endif #define ASE_NEEDS_VERT_POSITION #define ASE_NEEDS_TEXTURE_COORDINATES0 #define ASE_NEEDS_VERT_TEXTURE_COORDINATES0 #define ASE_NEEDS_VERT_NORMAL #define ASE_NEEDS_WORLD_POSITION #define ASE_NEEDS_FRAG_WORLD_POSITION #define ASE_NEEDS_FRAG_TEXTURE_COORDINATES0 #pragma shader_feature_local _ENABLEWIND_ON #pragma shader_feature_local _COLOR2ENABLE_ON #pragma shader_feature_local _SECONDCOLOROVERLAYTYPE_WORLD_NOISE_2D _SECONDCOLOROVERLAYTYPE_WORLD_NOISE_3D _SECONDCOLOROVERLAYTYPE_VERTEX_GRADIENT _SECONDCOLOROVERLAYTYPE_UV_GRADIENT #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) && (SHADER_TARGET >= 45) #define ASE_SV_DEPTH SV_DepthLessEqual #define ASE_SV_POSITION_QUALIFIERS linear noperspective centroid #else #define ASE_SV_DEPTH SV_Depth #define ASE_SV_POSITION_QUALIFIERS #endif struct Attributes { float4 positionOS : POSITION; half3 normalOS : NORMAL; half4 tangentOS : TANGENT; float4 texcoord : TEXCOORD0; #if defined(LIGHTMAP_ON) || defined(ASE_NEEDS_TEXTURE_COORDINATES1) float4 texcoord1 : TEXCOORD1; #endif #if defined(DYNAMICLIGHTMAP_ON) || defined(ASE_NEEDS_TEXTURE_COORDINATES2) float4 texcoord2 : TEXCOORD2; #endif float4 ase_color : COLOR; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct PackedVaryings { ASE_SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION; float3 positionWS : TEXCOORD0; half3 normalWS : TEXCOORD1; float4 tangentWS : TEXCOORD2; // holds terrainUV ifdef ENABLE_TERRAIN_PERPIXEL_NORMAL float4 lightmapUVOrVertexSH : TEXCOORD3; #if defined(ASE_FOG) || defined(_ADDITIONAL_LIGHTS_VERTEX) half4 fogFactorAndVertexLight : TEXCOORD4; #endif #if defined(DYNAMICLIGHTMAP_ON) float2 dynamicLightmapUV : TEXCOORD5; #endif float4 ase_texcoord6 : TEXCOORD6; float4 ase_texcoord7 : TEXCOORD7; UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO }; CBUFFER_START(UnityPerMaterial) float4 _MainColor; float4 _SecondColor; float _NormalScale; float _SecondColorFade; float _SecondColorOffset; float _WorldNoiseScale; float _Tiling; float _Smoothness; float _WindForce; float _GrassDistanceFadeEnable; float _GrassFadeDistance; float _GrassFade; float _UVBaseLock; float _WindFlowDensity; float _WindWavesScale; float _LightingFlatness; float _AlphaCutoff; #ifdef ASE_TRANSMISSION float _TransmissionShadow; #endif #ifdef ASE_TRANSLUCENCY float _TransStrength; float _TransNormal; float _TransScattering; float _TransDirect; float _TransAmbient; float _TransShadow; #endif #ifdef ASE_TESSELLATION float _TessPhongStrength; float _TessValue; float _TessMin; float _TessMax; float _TessEdgeLength; float _TessMaxDisp; #endif CBUFFER_END #ifdef SCENEPICKINGPASS float4 _SelectionID; #endif #ifdef SCENESELECTIONPASS int _ObjectId; int _PassValue; #endif float3 RAYGlobalDirection; float RAYGlobalWavesScale; float RAYGlobalFlowDensity; float RAYGlobalWindForce; sampler2D _Albedo; sampler2D _Normal; sampler2D _SmoothnessTexture; float3 mod3D289( float3 x ) { return x - floor( x / 289.0 ) * 289.0; } float4 mod3D289( float4 x ) { return x - floor( x / 289.0 ) * 289.0; } float4 permute( float4 x ) { return mod3D289( ( x * 34.0 + 1.0 ) * x ); } float4 taylorInvSqrt( float4 r ) { return 1.79284291400159 - r * 0.85373472095314; } float snoise( float3 v ) { const float2 C = float2( 1.0 / 6.0, 1.0 / 3.0 ); float3 i = floor( v + dot( v, C.yyy ) ); float3 x0 = v - i + dot( i, C.xxx ); float3 g = step( x0.yzx, x0.xyz ); float3 l = 1.0 - g; float3 i1 = min( g.xyz, l.zxy ); float3 i2 = max( g.xyz, l.zxy ); float3 x1 = x0 - i1 + C.xxx; float3 x2 = x0 - i2 + C.yyy; float3 x3 = x0 - 0.5; i = mod3D289( i); float4 p = permute( permute( permute( i.z + float4( 0.0, i1.z, i2.z, 1.0 ) ) + i.y + float4( 0.0, i1.y, i2.y, 1.0 ) ) + i.x + float4( 0.0, i1.x, i2.x, 1.0 ) ); float4 j = p - 49.0 * floor( p / 49.0 ); // mod(p,7*7) float4 x_ = floor( j / 7.0 ); float4 y_ = floor( j - 7.0 * x_ ); // mod(j,N) float4 x = ( x_ * 2.0 + 0.5 ) / 7.0 - 1.0; float4 y = ( y_ * 2.0 + 0.5 ) / 7.0 - 1.0; float4 h = 1.0 - abs( x ) - abs( y ); float4 b0 = float4( x.xy, y.xy ); float4 b1 = float4( x.zw, y.zw ); float4 s0 = floor( b0 ) * 2.0 + 1.0; float4 s1 = floor( b1 ) * 2.0 + 1.0; float4 sh = -step( h, 0.0 ); float4 a0 = b0.xzyw + s0.xzyw * sh.xxyy; float4 a1 = b1.xzyw + s1.xzyw * sh.zzww; float3 g0 = float3( a0.xy, h.x ); float3 g1 = float3( a0.zw, h.y ); float3 g2 = float3( a1.xy, h.z ); float3 g3 = float3( a1.zw, h.w ); float4 norm = taylorInvSqrt( float4( dot( g0, g0 ), dot( g1, g1 ), dot( g2, g2 ), dot( g3, g3 ) ) ); g0 *= norm.x; g1 *= norm.y; g2 *= norm.z; g3 *= norm.w; float4 m = max( 0.6 - float4( dot( x0, x0 ), dot( x1, x1 ), dot( x2, x2 ), dot( x3, x3 ) ), 0.0 ); m = m* m; m = m* m; float4 px = float4( dot( x0, g0 ), dot( x1, g1 ), dot( x2, g2 ), dot( x3, g3 ) ); return 42.0 * dot( m, px); } float3 mod2D289( float3 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; } float2 mod2D289( float2 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; } float3 permute( float3 x ) { return mod2D289( ( ( x * 34.0 ) + 1.0 ) * x ); } float snoise( float2 v ) { const float4 C = float4( 0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439 ); float2 i = floor( v + dot( v, C.yy ) ); float2 x0 = v - i + dot( i, C.xx ); float2 i1; i1 = ( x0.x > x0.y ) ? float2( 1.0, 0.0 ) : float2( 0.0, 1.0 ); float4 x12 = x0.xyxy + C.xxzz; x12.xy -= i1; i = mod2D289( i ); float3 p = permute( permute( i.y + float3( 0.0, i1.y, 1.0 ) ) + i.x + float3( 0.0, i1.x, 1.0 ) ); float3 m = max( 0.5 - float3( dot( x0, x0 ), dot( x12.xy, x12.xy ), dot( x12.zw, x12.zw ) ), 0.0 ); m = m * m; m = m * m; float3 x = 2.0 * frac( p * C.www ) - 1.0; float3 h = abs( x ) - 0.5; float3 ox = floor( x + 0.5 ); float3 a0 = x - ox; m *= 1.79284291400159 - 0.85373472095314 * ( a0 * a0 + h * h ); float3 g; g.x = a0.x * x0.x + h.x * x0.y; g.yz = a0.yz * x12.xz + h.yz * x12.yw; return 130.0 * dot( m, g ); } PackedVaryings VertexFunction( Attributes input ) { PackedVaryings output = (PackedVaryings)0; UNITY_SETUP_INSTANCE_ID(input); UNITY_TRANSFER_INSTANCE_ID(input, output); UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); float3 ase_positionWS = TransformObjectToWorld( ( input.positionOS ).xyz ); float mulTime34 = _TimeParameters.x * ( RAYGlobalWindForce * ( _WindForce * 5 ) ); float simplePerlin3D35 = snoise( ( ase_positionWS + mulTime34 )*( ( 1.0 - _WindWavesScale ) * RAYGlobalWavesScale ) ); simplePerlin3D35 = simplePerlin3D35*0.5 + 0.5; float saferPower940 = abs( simplePerlin3D35 ); float temp_output_231_0 = ( pow( saferPower940 , ( _WindFlowDensity * RAYGlobalFlowDensity ) ) * 0.01 ); float2 texCoord357 = input.texcoord.xy * float2( 1,1 ) + float2( 0,0 ); float saferPower356 = abs( texCoord357.y ); float lerpResult1020 = lerp( temp_output_231_0 , ( temp_output_231_0 * pow( saferPower356 , 1.5 ) ) , _UVBaseLock); float4 transform916 = mul(GetWorldToObjectMatrix(),float4( ( RAYGlobalDirection * ( lerpResult1020 * input.ase_color.r * ( ( _WindForce * 100 ) * RAYGlobalWindForce ) ) ) , 0.0 )); #ifdef _ENABLEWIND_ON float4 staticSwitch341 = transform916; #else float4 staticSwitch341 = float4( 0,0,0,0 ); #endif float4 Wind191 = staticSwitch341; float smoothstepResult1117 = smoothstep( 1.01 , ( 1.0 - _GrassFade ) , ( length( ( _WorldSpaceCameraPos - ase_positionWS ) ) / _GrassFadeDistance )); float lerpResult1023 = lerp( 1.0 , saturate( smoothstepResult1117 ) , _GrassDistanceFadeEnable); float GrassDistanceFadeMask982 = lerpResult1023; float4 lerpResult1065 = lerp( float4( ( input.positionOS.xyz * -1 ) , 0.0 ) , Wind191 , GrassDistanceFadeMask982); float3 lerpResult1096 = lerp( input.normalOS , float3( 0, 1, 0 ) , _LightingFlatness); float3 LightingFlatness1101 = lerpResult1096; output.ase_texcoord6.xy = input.texcoord.xy; output.ase_texcoord7 = input.positionOS; //setting value to unused interpolator channels and avoid initialization warnings output.ase_texcoord6.zw = 0; #ifdef ASE_ABSOLUTE_VERTEX_POS float3 defaultVertexValue = input.positionOS.xyz; #else float3 defaultVertexValue = float3(0, 0, 0); #endif float3 vertexValue = lerpResult1065.xyz; #ifdef ASE_ABSOLUTE_VERTEX_POS input.positionOS.xyz = vertexValue; #else input.positionOS.xyz += vertexValue; #endif input.normalOS = LightingFlatness1101; input.tangentOS = input.tangentOS; VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz ); VertexNormalInputs normalInput = GetVertexNormalInputs( input.normalOS, input.tangentOS ); #if defined(LIGHTMAP_ON) OUTPUT_LIGHTMAP_UV(input.texcoord1, unity_LightmapST, output.lightmapUVOrVertexSH.xy); #else OUTPUT_SH(normalInput.normalWS.xyz, output.lightmapUVOrVertexSH.xyz); #endif #if defined(DYNAMICLIGHTMAP_ON) output.dynamicLightmapUV.xy = input.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; #endif #if defined(ASE_FOG) || defined(_ADDITIONAL_LIGHTS_VERTEX) output.fogFactorAndVertexLight = 0; #if defined(ASE_FOG) && !defined(_FOG_FRAGMENT) output.fogFactorAndVertexLight.x = ComputeFogFactor(vertexInput.positionCS.z); #endif #ifdef _ADDITIONAL_LIGHTS_VERTEX half3 vertexLight = VertexLighting( vertexInput.positionWS, normalInput.normalWS ); output.fogFactorAndVertexLight.yzw = vertexLight; #endif #endif output.positionCS = vertexInput.positionCS; output.positionWS = vertexInput.positionWS; output.normalWS = normalInput.normalWS; output.tangentWS = float4( normalInput.tangentWS, ( input.tangentOS.w > 0.0 ? 1.0 : -1.0 ) * GetOddNegativeScale() ); #if defined( ENABLE_TERRAIN_PERPIXEL_NORMAL ) output.tangentWS.zw = input.texcoord.xy; output.tangentWS.xy = input.texcoord.xy * unity_LightmapST.xy + unity_LightmapST.zw; #endif return output; } #if defined(ASE_TESSELLATION) struct VertexControl { float4 positionOS : INTERNALTESSPOS; half3 normalOS : NORMAL; half4 tangentOS : TANGENT; float4 texcoord : TEXCOORD0; #if defined(LIGHTMAP_ON) || defined(ASE_NEEDS_TEXTURE_COORDINATES1) float4 texcoord1 : TEXCOORD1; #endif #if defined(DYNAMICLIGHTMAP_ON) || defined(ASE_NEEDS_TEXTURE_COORDINATES2) float4 texcoord2 : TEXCOORD2; #endif float4 ase_color : COLOR; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct TessellationFactors { float edge[3] : SV_TessFactor; float inside : SV_InsideTessFactor; }; VertexControl vert ( Attributes input ) { VertexControl output; UNITY_SETUP_INSTANCE_ID(input); UNITY_TRANSFER_INSTANCE_ID(input, output); output.positionOS = input.positionOS; output.normalOS = input.normalOS; output.tangentOS = input.tangentOS; output.texcoord = input.texcoord; #if defined(LIGHTMAP_ON) || defined(ASE_NEEDS_TEXTURE_COORDINATES1) output.texcoord1 = input.texcoord1; #endif #if defined(DYNAMICLIGHTMAP_ON) || defined(ASE_NEEDS_TEXTURE_COORDINATES2) output.texcoord2 = input.texcoord2; #endif output.ase_color = input.ase_color; return output; } TessellationFactors TessellationFunction (InputPatch input) { TessellationFactors output; 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(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); #elif defined(ASE_LENGTH_TESSELLATION) tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); #elif defined(ASE_LENGTH_CULL_TESSELLATION) tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); #endif output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w; return output; } [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")] PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) { Attributes output = (Attributes) 0; output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; output.tangentOS = patch[0].tangentOS * bary.x + patch[1].tangentOS * bary.y + patch[2].tangentOS * bary.z; output.texcoord = patch[0].texcoord * bary.x + patch[1].texcoord * bary.y + patch[2].texcoord * bary.z; #if defined(LIGHTMAP_ON) || defined(ASE_NEEDS_TEXTURE_COORDINATES1) output.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z; #endif #if defined(DYNAMICLIGHTMAP_ON) || defined(ASE_NEEDS_TEXTURE_COORDINATES2) output.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z; #endif output.ase_color = patch[0].ase_color * bary.x + patch[1].ase_color * bary.y + patch[2].ase_color * bary.z; #if defined(ASE_PHONG_TESSELLATION) float3 pp[3]; for (int i = 0; i < 3; ++i) pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); float phongStrength = _TessPhongStrength; output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz; #endif UNITY_TRANSFER_INSTANCE_ID(patch[0], output); return VertexFunction(output); } #else PackedVaryings vert ( Attributes input ) { return VertexFunction( input ); } #endif half4 frag ( PackedVaryings input #if defined( ASE_DEPTH_WRITE_ON ) ,out float outputDepth : ASE_SV_DEPTH #endif #ifdef _WRITE_RENDERING_LAYERS , out float4 outRenderingLayers : SV_Target1 #endif ) : SV_Target { UNITY_SETUP_INSTANCE_ID(input); UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); #if defined( _SURFACE_TYPE_TRANSPARENT ) const bool isTransparent = true; #else const bool isTransparent = false; #endif #if defined(LOD_FADE_CROSSFADE) LODFadeCrossFade( input.positionCS ); #endif #if defined(MAIN_LIGHT_CALCULATE_SHADOWS) float4 shadowCoord = TransformWorldToShadowCoord( input.positionWS ); #else float4 shadowCoord = float4(0, 0, 0, 0); #endif // @diogo: mikktspace compliant float renormFactor = 1.0 / max( FLT_MIN, length( input.normalWS ) ); float3 PositionWS = input.positionWS; float3 PositionRWS = GetCameraRelativePositionWS( PositionWS ); float3 ViewDirWS = GetWorldSpaceNormalizeViewDir( PositionWS ); float4 ShadowCoord = shadowCoord; float4 ScreenPosNorm = float4( GetNormalizedScreenSpaceUV( input.positionCS ), input.positionCS.zw ); float4 ClipPos = ComputeClipSpacePosition( ScreenPosNorm.xy, input.positionCS.z ) * input.positionCS.w; float4 ScreenPos = ComputeScreenPos( ClipPos ); float3 TangentWS = input.tangentWS.xyz * renormFactor; float3 BitangentWS = cross( input.normalWS, input.tangentWS.xyz ) * input.tangentWS.w * renormFactor; float3 NormalWS = input.normalWS * renormFactor; #if defined( ENABLE_TERRAIN_PERPIXEL_NORMAL ) float2 sampleCoords = (input.tangentWS.zw / _TerrainHeightmapRecipSize.zw + 0.5f) * _TerrainHeightmapRecipSize.xy; NormalWS = TransformObjectToWorldNormal(normalize(SAMPLE_TEXTURE2D(_TerrainNormalmapTexture, sampler_TerrainNormalmapTexture, sampleCoords).rgb * 2 - 1)); TangentWS = -cross(GetObjectToWorldMatrix()._13_23_33, NormalWS); BitangentWS = cross(NormalWS, -TangentWS); #endif float2 temp_cast_0 = (_Tiling).xx; float2 texCoord1028 = input.ase_texcoord6.xy * temp_cast_0 + float2( 0,0 ); float2 Tiling1032 = texCoord1028; float4 tex2DNode1 = tex2D( _Albedo, Tiling1032 ); float4 temp_output_10_0 = ( _MainColor * tex2DNode1 ); float simplePerlin2D742 = snoise( (PositionWS).xz*_WorldNoiseScale ); simplePerlin2D742 = simplePerlin2D742*0.5 + 0.5; float simplePerlin3D1015 = snoise( PositionWS*_WorldNoiseScale ); simplePerlin3D1015 = simplePerlin3D1015*0.5 + 0.5; float2 texCoord361 = input.ase_texcoord6.xy * float2( 1,1 ) + float2( 0,0 ); #if defined( _SECONDCOLOROVERLAYTYPE_WORLD_NOISE_2D ) float staticSwitch360 = simplePerlin2D742; #elif defined( _SECONDCOLOROVERLAYTYPE_WORLD_NOISE_3D ) float staticSwitch360 = simplePerlin3D1015; #elif defined( _SECONDCOLOROVERLAYTYPE_VERTEX_GRADIENT ) float staticSwitch360 = input.ase_texcoord7.xyz.y; #elif defined( _SECONDCOLOROVERLAYTYPE_UV_GRADIENT ) float staticSwitch360 = texCoord361.y; #else float staticSwitch360 = simplePerlin2D742; #endif float temp_output_875_0 = ( staticSwitch360 + ( 1.0 - _SecondColorOffset ) ); float lerpResult1025 = lerp( temp_output_875_0 , ( 1.0 - temp_output_875_0 ) , ( _SecondColorFade - -0.5 )); float SecondColorMask335 = saturate( lerpResult1025 ); float4 lerpResult332 = lerp( temp_output_10_0 , ( _SecondColor * tex2D( _Albedo, Tiling1032 ) ) , SecondColorMask335); #ifdef _COLOR2ENABLE_ON float4 staticSwitch1022 = lerpResult332; #else float4 staticSwitch1022 = temp_output_10_0; #endif float4 Albedo259 = staticSwitch1022; float3 unpack886 = UnpackNormalScale( tex2D( _Normal, Tiling1032 ), _NormalScale ); unpack886.z = lerp( 1, unpack886.z, saturate(_NormalScale) ); float3 Normal888 = unpack886; float Smoothness734 = saturate( ( tex2D( _SmoothnessTexture, Tiling1032 ).g * _Smoothness ) ); float AlbedoAlpha263 = tex2DNode1.a; float3 BaseColor = Albedo259.rgb; float3 Normal = Normal888; float3 Specular = 0.5; float Metallic = 0; float Smoothness = Smoothness734; float Occlusion = 1; float3 Emission = 0; float Alpha = AlbedoAlpha263; float AlphaClipThreshold = _AlphaCutoff; float AlphaClipThresholdShadow = 0.5; float3 BakedGI = 0; float3 RefractionColor = 1; float RefractionIndex = 1; float3 Transmission = 1; float3 Translucency = 1; #if defined( ASE_DEPTH_WRITE_ON ) float DeviceDepth = ClipPos.z; #endif #ifdef _CLEARCOAT float CoatMask = 0; float CoatSmoothness = 0; #endif #if defined( _ALPHATEST_ON ) AlphaDiscard( Alpha, AlphaClipThreshold ); #endif #if defined(MAIN_LIGHT_CALCULATE_SHADOWS) && defined(ASE_CHANGES_WORLD_POS) ShadowCoord = TransformWorldToShadowCoord( PositionWS ); #endif InputData inputData = (InputData)0; inputData.positionWS = PositionWS; inputData.positionCS = float4( input.positionCS.xy, ClipPos.zw / ClipPos.w ); inputData.normalizedScreenSpaceUV = ScreenPosNorm.xy; inputData.viewDirectionWS = ViewDirWS; inputData.shadowCoord = ShadowCoord; #ifdef _NORMALMAP #if _NORMAL_DROPOFF_TS inputData.normalWS = TransformTangentToWorld(Normal, half3x3(TangentWS, BitangentWS, NormalWS)); #elif _NORMAL_DROPOFF_OS inputData.normalWS = TransformObjectToWorldNormal(Normal); #elif _NORMAL_DROPOFF_WS inputData.normalWS = Normal; #endif inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS); #else inputData.normalWS = NormalWS; #endif #ifdef ASE_FOG inputData.fogCoord = InitializeInputDataFog(float4(inputData.positionWS, 1.0), input.fogFactorAndVertexLight.x); #endif #ifdef _ADDITIONAL_LIGHTS_VERTEX inputData.vertexLighting = input.fogFactorAndVertexLight.yzw; #endif #if defined( ENABLE_TERRAIN_PERPIXEL_NORMAL ) float3 SH = SampleSH(inputData.normalWS.xyz); #else float3 SH = input.lightmapUVOrVertexSH.xyz; #endif #if defined(DYNAMICLIGHTMAP_ON) inputData.bakedGI = SAMPLE_GI(input.lightmapUVOrVertexSH.xy, input.dynamicLightmapUV.xy, SH, inputData.normalWS); #else inputData.bakedGI = SAMPLE_GI(input.lightmapUVOrVertexSH.xy, SH, inputData.normalWS); #endif #ifdef ASE_BAKEDGI inputData.bakedGI = BakedGI; #endif inputData.shadowMask = SAMPLE_SHADOWMASK(input.lightmapUVOrVertexSH.xy); #if defined(DEBUG_DISPLAY) #if defined(DYNAMICLIGHTMAP_ON) inputData.dynamicLightmapUV = input.dynamicLightmapUV.xy; #endif #if defined(LIGHTMAP_ON) inputData.staticLightmapUV = input.lightmapUVOrVertexSH.xy; #else inputData.vertexSH = SH; #endif #endif SurfaceData surfaceData; surfaceData.albedo = BaseColor; surfaceData.metallic = saturate(Metallic); surfaceData.specular = Specular; surfaceData.smoothness = saturate(Smoothness), surfaceData.occlusion = Occlusion, surfaceData.emission = Emission, surfaceData.alpha = saturate(Alpha); surfaceData.normalTS = Normal; surfaceData.clearCoatMask = 0; surfaceData.clearCoatSmoothness = 1; #ifdef _CLEARCOAT surfaceData.clearCoatMask = saturate(CoatMask); surfaceData.clearCoatSmoothness = saturate(CoatSmoothness); #endif #if defined(_DBUFFER) ApplyDecalToSurfaceData(input.positionCS, surfaceData, inputData); #endif #ifdef ASE_LIGHTING_SIMPLE half4 color = UniversalFragmentBlinnPhong( inputData, surfaceData); #else half4 color = UniversalFragmentPBR( inputData, surfaceData); #endif #ifdef ASE_TRANSMISSION { float shadow = _TransmissionShadow; #define SUM_LIGHT_TRANSMISSION(Light)\ 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 += BaseColor * transmission; SUM_LIGHT_TRANSMISSION( GetMainLight( inputData.shadowCoord ) ); #if defined(_ADDITIONAL_LIGHTS) uint meshRenderingLayers = GetMeshRenderingLayer(); uint pixelLightCount = GetAdditionalLightsCount(); #if USE_FORWARD_PLUS for (uint lightIndex = 0; lightIndex < min(URP_FP_DIRECTIONAL_LIGHTS_COUNT, MAX_VISIBLE_LIGHTS); lightIndex++) { FORWARD_PLUS_SUBTRACTIVE_LIGHT_CHECK Light light = GetAdditionalLight(lightIndex, inputData.positionWS, inputData.shadowMask); #ifdef _LIGHT_LAYERS if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers)) #endif { SUM_LIGHT_TRANSMISSION( light ); } } #endif LIGHT_LOOP_BEGIN( pixelLightCount ) Light light = GetAdditionalLight(lightIndex, inputData.positionWS, inputData.shadowMask); #ifdef _LIGHT_LAYERS if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers)) #endif { SUM_LIGHT_TRANSMISSION( light ); } LIGHT_LOOP_END #endif } #endif #ifdef ASE_TRANSLUCENCY { float shadow = _TransShadow; float normal = _TransNormal; float scattering = _TransScattering; float direct = _TransDirect; float ambient = _TransAmbient; float strength = _TransStrength; #define SUM_LIGHT_TRANSLUCENCY(Light)\ 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 += BaseColor * translucency * strength; SUM_LIGHT_TRANSLUCENCY( GetMainLight( inputData.shadowCoord ) ); #if defined(_ADDITIONAL_LIGHTS) uint meshRenderingLayers = GetMeshRenderingLayer(); uint pixelLightCount = GetAdditionalLightsCount(); #if USE_FORWARD_PLUS for (uint lightIndex = 0; lightIndex < min(URP_FP_DIRECTIONAL_LIGHTS_COUNT, MAX_VISIBLE_LIGHTS); lightIndex++) { FORWARD_PLUS_SUBTRACTIVE_LIGHT_CHECK Light light = GetAdditionalLight(lightIndex, inputData.positionWS, inputData.shadowMask); #ifdef _LIGHT_LAYERS if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers)) #endif { SUM_LIGHT_TRANSLUCENCY( light ); } } #endif LIGHT_LOOP_BEGIN( pixelLightCount ) Light light = GetAdditionalLight(lightIndex, inputData.positionWS, inputData.shadowMask); #ifdef _LIGHT_LAYERS if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers)) #endif { SUM_LIGHT_TRANSLUCENCY( light ); } LIGHT_LOOP_END #endif } #endif #ifdef ASE_REFRACTION float4 projScreenPos = ScreenPos / ScreenPos.w; float3 refractionOffset = ( RefractionIndex - 1.0 ) * mul( UNITY_MATRIX_V, float4( NormalWS,0 ) ).xyz * ( 1.0 - dot( NormalWS, ViewDirWS ) ); 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), inputData.fogCoord); #else color.rgb = MixFog(color.rgb, inputData.fogCoord); #endif #endif #if defined( ASE_DEPTH_WRITE_ON ) outputDepth = DeviceDepth; #endif #ifdef _WRITE_RENDERING_LAYERS uint renderingLayers = GetMeshRenderingLayer(); outRenderingLayers = float4( EncodeMeshRenderingLayer( renderingLayers ), 0, 0, 0 ); #endif #if defined( ASE_OPAQUE_KEEP_ALPHA ) return half4( color.rgb, color.a ); #else return half4( color.rgb, OutputAlpha( color.a, isTransparent ) ); #endif } ENDHLSL } Pass { Name "ShadowCaster" Tags { "LightMode"="ShadowCaster" } ZWrite On ZTest LEqual AlphaToMask Off ColorMask 0 HLSLPROGRAM #define ASE_GEOMETRY #define _NORMAL_DROPOFF_TS 1 #pragma multi_compile_instancing #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE #define ASE_FOG 1 #pragma multi_compile_fragment _ DEBUG_DISPLAY #pragma multi_compile_local _ALPHATEST_ON #define _NORMALMAP 1 #define ASE_VERSION 19904 #define ASE_SRP_VERSION 140011 #pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW #pragma vertex vert #pragma fragment frag #if defined(_SPECULAR_SETUP) && defined(ASE_LIGHTING_SIMPLE) #define _SPECULAR_COLOR 1 #endif #define SHADERPASS SHADERPASS_SHADOWCASTER #if ASE_SRP_VERSION >=140007 #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" #endif #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" #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/Input.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" #if ASE_SRP_VERSION >=140009 #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" #endif #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" #if defined(LOD_FADE_CROSSFADE) #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" #endif #define ASE_NEEDS_VERT_POSITION #define ASE_NEEDS_TEXTURE_COORDINATES0 #define ASE_NEEDS_VERT_NORMAL #pragma shader_feature_local _ENABLEWIND_ON #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) && (SHADER_TARGET >= 45) #define ASE_SV_DEPTH SV_DepthLessEqual #define ASE_SV_POSITION_QUALIFIERS linear noperspective centroid #else #define ASE_SV_DEPTH SV_Depth #define ASE_SV_POSITION_QUALIFIERS #endif struct Attributes { float4 positionOS : POSITION; half3 normalOS : NORMAL; half4 tangentOS : TANGENT; float4 ase_texcoord : TEXCOORD0; float4 ase_color : COLOR; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct PackedVaryings { ASE_SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION; float3 positionWS : TEXCOORD0; float4 ase_texcoord1 : TEXCOORD1; UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO }; CBUFFER_START(UnityPerMaterial) float4 _MainColor; float4 _SecondColor; float _NormalScale; float _SecondColorFade; float _SecondColorOffset; float _WorldNoiseScale; float _Tiling; float _Smoothness; float _WindForce; float _GrassDistanceFadeEnable; float _GrassFadeDistance; float _GrassFade; float _UVBaseLock; float _WindFlowDensity; float _WindWavesScale; float _LightingFlatness; float _AlphaCutoff; #ifdef ASE_TRANSMISSION float _TransmissionShadow; #endif #ifdef ASE_TRANSLUCENCY float _TransStrength; float _TransNormal; float _TransScattering; float _TransDirect; float _TransAmbient; float _TransShadow; #endif #ifdef ASE_TESSELLATION float _TessPhongStrength; float _TessValue; float _TessMin; float _TessMax; float _TessEdgeLength; float _TessMaxDisp; #endif CBUFFER_END #ifdef SCENEPICKINGPASS float4 _SelectionID; #endif #ifdef SCENESELECTIONPASS int _ObjectId; int _PassValue; #endif float3 RAYGlobalDirection; float RAYGlobalWavesScale; float RAYGlobalFlowDensity; float RAYGlobalWindForce; sampler2D _Albedo; float3 _LightDirection; float3 _LightPosition; float3 mod3D289( float3 x ) { return x - floor( x / 289.0 ) * 289.0; } float4 mod3D289( float4 x ) { return x - floor( x / 289.0 ) * 289.0; } float4 permute( float4 x ) { return mod3D289( ( x * 34.0 + 1.0 ) * x ); } float4 taylorInvSqrt( float4 r ) { return 1.79284291400159 - r * 0.85373472095314; } float snoise( float3 v ) { const float2 C = float2( 1.0 / 6.0, 1.0 / 3.0 ); float3 i = floor( v + dot( v, C.yyy ) ); float3 x0 = v - i + dot( i, C.xxx ); float3 g = step( x0.yzx, x0.xyz ); float3 l = 1.0 - g; float3 i1 = min( g.xyz, l.zxy ); float3 i2 = max( g.xyz, l.zxy ); float3 x1 = x0 - i1 + C.xxx; float3 x2 = x0 - i2 + C.yyy; float3 x3 = x0 - 0.5; i = mod3D289( i); float4 p = permute( permute( permute( i.z + float4( 0.0, i1.z, i2.z, 1.0 ) ) + i.y + float4( 0.0, i1.y, i2.y, 1.0 ) ) + i.x + float4( 0.0, i1.x, i2.x, 1.0 ) ); float4 j = p - 49.0 * floor( p / 49.0 ); // mod(p,7*7) float4 x_ = floor( j / 7.0 ); float4 y_ = floor( j - 7.0 * x_ ); // mod(j,N) float4 x = ( x_ * 2.0 + 0.5 ) / 7.0 - 1.0; float4 y = ( y_ * 2.0 + 0.5 ) / 7.0 - 1.0; float4 h = 1.0 - abs( x ) - abs( y ); float4 b0 = float4( x.xy, y.xy ); float4 b1 = float4( x.zw, y.zw ); float4 s0 = floor( b0 ) * 2.0 + 1.0; float4 s1 = floor( b1 ) * 2.0 + 1.0; float4 sh = -step( h, 0.0 ); float4 a0 = b0.xzyw + s0.xzyw * sh.xxyy; float4 a1 = b1.xzyw + s1.xzyw * sh.zzww; float3 g0 = float3( a0.xy, h.x ); float3 g1 = float3( a0.zw, h.y ); float3 g2 = float3( a1.xy, h.z ); float3 g3 = float3( a1.zw, h.w ); float4 norm = taylorInvSqrt( float4( dot( g0, g0 ), dot( g1, g1 ), dot( g2, g2 ), dot( g3, g3 ) ) ); g0 *= norm.x; g1 *= norm.y; g2 *= norm.z; g3 *= norm.w; float4 m = max( 0.6 - float4( dot( x0, x0 ), dot( x1, x1 ), dot( x2, x2 ), dot( x3, x3 ) ), 0.0 ); m = m* m; m = m* m; float4 px = float4( dot( x0, g0 ), dot( x1, g1 ), dot( x2, g2 ), dot( x3, g3 ) ); return 42.0 * dot( m, px); } PackedVaryings VertexFunction( Attributes input ) { PackedVaryings output; UNITY_SETUP_INSTANCE_ID(input); UNITY_TRANSFER_INSTANCE_ID(input, output); UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( output ); float3 ase_positionWS = TransformObjectToWorld( ( input.positionOS ).xyz ); float mulTime34 = _TimeParameters.x * ( RAYGlobalWindForce * ( _WindForce * 5 ) ); float simplePerlin3D35 = snoise( ( ase_positionWS + mulTime34 )*( ( 1.0 - _WindWavesScale ) * RAYGlobalWavesScale ) ); simplePerlin3D35 = simplePerlin3D35*0.5 + 0.5; float saferPower940 = abs( simplePerlin3D35 ); float temp_output_231_0 = ( pow( saferPower940 , ( _WindFlowDensity * RAYGlobalFlowDensity ) ) * 0.01 ); float2 texCoord357 = input.ase_texcoord.xy * float2( 1,1 ) + float2( 0,0 ); float saferPower356 = abs( texCoord357.y ); float lerpResult1020 = lerp( temp_output_231_0 , ( temp_output_231_0 * pow( saferPower356 , 1.5 ) ) , _UVBaseLock); float4 transform916 = mul(GetWorldToObjectMatrix(),float4( ( RAYGlobalDirection * ( lerpResult1020 * input.ase_color.r * ( ( _WindForce * 100 ) * RAYGlobalWindForce ) ) ) , 0.0 )); #ifdef _ENABLEWIND_ON float4 staticSwitch341 = transform916; #else float4 staticSwitch341 = float4( 0,0,0,0 ); #endif float4 Wind191 = staticSwitch341; float smoothstepResult1117 = smoothstep( 1.01 , ( 1.0 - _GrassFade ) , ( length( ( _WorldSpaceCameraPos - ase_positionWS ) ) / _GrassFadeDistance )); float lerpResult1023 = lerp( 1.0 , saturate( smoothstepResult1117 ) , _GrassDistanceFadeEnable); float GrassDistanceFadeMask982 = lerpResult1023; float4 lerpResult1065 = lerp( float4( ( input.positionOS.xyz * -1 ) , 0.0 ) , Wind191 , GrassDistanceFadeMask982); float3 lerpResult1096 = lerp( input.normalOS , float3( 0, 1, 0 ) , _LightingFlatness); float3 LightingFlatness1101 = lerpResult1096; output.ase_texcoord1.xy = input.ase_texcoord.xy; //setting value to unused interpolator channels and avoid initialization warnings output.ase_texcoord1.zw = 0; #ifdef ASE_ABSOLUTE_VERTEX_POS float3 defaultVertexValue = input.positionOS.xyz; #else float3 defaultVertexValue = float3(0, 0, 0); #endif float3 vertexValue = lerpResult1065.xyz; #ifdef ASE_ABSOLUTE_VERTEX_POS input.positionOS.xyz = vertexValue; #else input.positionOS.xyz += vertexValue; #endif input.normalOS = LightingFlatness1101; input.tangentOS = input.tangentOS; float3 positionWS = TransformObjectToWorld( input.positionOS.xyz ); float3 normalWS = TransformObjectToWorldDir(input.normalOS); #if _CASTING_PUNCTUAL_LIGHT_SHADOW float3 lightDirectionWS = normalize(_LightPosition - positionWS); #else float3 lightDirectionWS = _LightDirection; #endif float4 positionCS = TransformWorldToHClip(ApplyShadowBias(positionWS, normalWS, lightDirectionWS)); #if UNITY_REVERSED_Z positionCS.z = min(positionCS.z, UNITY_NEAR_CLIP_VALUE); #else positionCS.z = max(positionCS.z, UNITY_NEAR_CLIP_VALUE); #endif output.positionCS = positionCS; output.positionWS = positionWS; return output; } #if defined(ASE_TESSELLATION) struct VertexControl { float4 positionOS : INTERNALTESSPOS; half3 normalOS : NORMAL; half4 tangentOS : TANGENT; float4 ase_texcoord : TEXCOORD0; float4 ase_color : COLOR; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct TessellationFactors { float edge[3] : SV_TessFactor; float inside : SV_InsideTessFactor; }; VertexControl vert ( Attributes input ) { VertexControl output; UNITY_SETUP_INSTANCE_ID(input); UNITY_TRANSFER_INSTANCE_ID(input, output); output.positionOS = input.positionOS; output.normalOS = input.normalOS; output.tangentOS = input.tangentOS; output.ase_texcoord = input.ase_texcoord; output.ase_color = input.ase_color; return output; } TessellationFactors TessellationFunction (InputPatch input) { TessellationFactors output; 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(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); #elif defined(ASE_LENGTH_TESSELLATION) tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); #elif defined(ASE_LENGTH_CULL_TESSELLATION) tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); #endif output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w; return output; } [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")] PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) { Attributes output = (Attributes) 0; output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; output.tangentOS = patch[0].tangentOS * bary.x + patch[1].tangentOS * bary.y + patch[2].tangentOS * bary.z; output.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; output.ase_color = patch[0].ase_color * bary.x + patch[1].ase_color * bary.y + patch[2].ase_color * bary.z; #if defined(ASE_PHONG_TESSELLATION) float3 pp[3]; for (int i = 0; i < 3; ++i) pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); float phongStrength = _TessPhongStrength; output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz; #endif UNITY_TRANSFER_INSTANCE_ID(patch[0], output); return VertexFunction(output); } #else PackedVaryings vert ( Attributes input ) { return VertexFunction( input ); } #endif half4 frag( PackedVaryings input #if defined( ASE_DEPTH_WRITE_ON ) ,out float outputDepth : ASE_SV_DEPTH #endif ) : SV_Target { UNITY_SETUP_INSTANCE_ID( input ); UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input ); #if defined(MAIN_LIGHT_CALCULATE_SHADOWS) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) float4 shadowCoord = TransformWorldToShadowCoord(input.positionWS); #else float4 shadowCoord = float4(0, 0, 0, 0); #endif float3 PositionWS = input.positionWS; float3 PositionRWS = GetCameraRelativePositionWS( input.positionWS ); float4 ShadowCoord = shadowCoord; float4 ScreenPosNorm = float4( GetNormalizedScreenSpaceUV( input.positionCS ), input.positionCS.zw ); float4 ClipPos = ComputeClipSpacePosition( ScreenPosNorm.xy, input.positionCS.z ) * input.positionCS.w; float4 ScreenPos = ComputeScreenPos( ClipPos ); float2 temp_cast_0 = (_Tiling).xx; float2 texCoord1028 = input.ase_texcoord1.xy * temp_cast_0 + float2( 0,0 ); float2 Tiling1032 = texCoord1028; float4 tex2DNode1 = tex2D( _Albedo, Tiling1032 ); float AlbedoAlpha263 = tex2DNode1.a; float Alpha = AlbedoAlpha263; float AlphaClipThreshold = _AlphaCutoff; float AlphaClipThresholdShadow = 0.5; #if defined( ASE_DEPTH_WRITE_ON ) float DeviceDepth = input.positionCS.z; #endif #if defined( _ALPHATEST_ON ) #if defined( _ALPHATEST_SHADOW_ON ) AlphaDiscard( Alpha, AlphaClipThresholdShadow ); #else AlphaDiscard( Alpha, AlphaClipThreshold ); #endif #endif #if defined(LOD_FADE_CROSSFADE) LODFadeCrossFade( input.positionCS ); #endif #if defined( ASE_DEPTH_WRITE_ON ) outputDepth = DeviceDepth; #endif return 0; } ENDHLSL } Pass { Name "DepthOnly" Tags { "LightMode"="DepthOnly" } ZWrite On ColorMask R AlphaToMask Off HLSLPROGRAM #define ASE_GEOMETRY #define _NORMAL_DROPOFF_TS 1 #pragma multi_compile_instancing #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE #define ASE_FOG 1 #pragma multi_compile_fragment _ DEBUG_DISPLAY #pragma multi_compile_local _ALPHATEST_ON #define _NORMALMAP 1 #define ASE_VERSION 19904 #define ASE_SRP_VERSION 140011 #pragma vertex vert #pragma fragment frag #if defined(_SPECULAR_SETUP) && defined(ASE_LIGHTING_SIMPLE) #define _SPECULAR_COLOR 1 #endif #define SHADERPASS SHADERPASS_DEPTHONLY #if ASE_SRP_VERSION >=140007 #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" #endif #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" #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/Input.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" #if ASE_SRP_VERSION >=140009 #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" #endif #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" #if defined(LOD_FADE_CROSSFADE) #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" #endif #define ASE_NEEDS_VERT_POSITION #define ASE_NEEDS_TEXTURE_COORDINATES0 #define ASE_NEEDS_VERT_NORMAL #pragma shader_feature_local _ENABLEWIND_ON #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) && (SHADER_TARGET >= 45) #define ASE_SV_DEPTH SV_DepthLessEqual #define ASE_SV_POSITION_QUALIFIERS linear noperspective centroid #else #define ASE_SV_DEPTH SV_Depth #define ASE_SV_POSITION_QUALIFIERS #endif struct Attributes { float4 positionOS : POSITION; half3 normalOS : NORMAL; half4 tangentOS : TANGENT; float4 ase_texcoord : TEXCOORD0; float4 ase_color : COLOR; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct PackedVaryings { ASE_SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION; float3 positionWS : TEXCOORD0; float4 ase_texcoord1 : TEXCOORD1; UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO }; CBUFFER_START(UnityPerMaterial) float4 _MainColor; float4 _SecondColor; float _NormalScale; float _SecondColorFade; float _SecondColorOffset; float _WorldNoiseScale; float _Tiling; float _Smoothness; float _WindForce; float _GrassDistanceFadeEnable; float _GrassFadeDistance; float _GrassFade; float _UVBaseLock; float _WindFlowDensity; float _WindWavesScale; float _LightingFlatness; float _AlphaCutoff; #ifdef ASE_TRANSMISSION float _TransmissionShadow; #endif #ifdef ASE_TRANSLUCENCY float _TransStrength; float _TransNormal; float _TransScattering; float _TransDirect; float _TransAmbient; float _TransShadow; #endif #ifdef ASE_TESSELLATION float _TessPhongStrength; float _TessValue; float _TessMin; float _TessMax; float _TessEdgeLength; float _TessMaxDisp; #endif CBUFFER_END #ifdef SCENEPICKINGPASS float4 _SelectionID; #endif #ifdef SCENESELECTIONPASS int _ObjectId; int _PassValue; #endif float3 RAYGlobalDirection; float RAYGlobalWavesScale; float RAYGlobalFlowDensity; float RAYGlobalWindForce; sampler2D _Albedo; float3 mod3D289( float3 x ) { return x - floor( x / 289.0 ) * 289.0; } float4 mod3D289( float4 x ) { return x - floor( x / 289.0 ) * 289.0; } float4 permute( float4 x ) { return mod3D289( ( x * 34.0 + 1.0 ) * x ); } float4 taylorInvSqrt( float4 r ) { return 1.79284291400159 - r * 0.85373472095314; } float snoise( float3 v ) { const float2 C = float2( 1.0 / 6.0, 1.0 / 3.0 ); float3 i = floor( v + dot( v, C.yyy ) ); float3 x0 = v - i + dot( i, C.xxx ); float3 g = step( x0.yzx, x0.xyz ); float3 l = 1.0 - g; float3 i1 = min( g.xyz, l.zxy ); float3 i2 = max( g.xyz, l.zxy ); float3 x1 = x0 - i1 + C.xxx; float3 x2 = x0 - i2 + C.yyy; float3 x3 = x0 - 0.5; i = mod3D289( i); float4 p = permute( permute( permute( i.z + float4( 0.0, i1.z, i2.z, 1.0 ) ) + i.y + float4( 0.0, i1.y, i2.y, 1.0 ) ) + i.x + float4( 0.0, i1.x, i2.x, 1.0 ) ); float4 j = p - 49.0 * floor( p / 49.0 ); // mod(p,7*7) float4 x_ = floor( j / 7.0 ); float4 y_ = floor( j - 7.0 * x_ ); // mod(j,N) float4 x = ( x_ * 2.0 + 0.5 ) / 7.0 - 1.0; float4 y = ( y_ * 2.0 + 0.5 ) / 7.0 - 1.0; float4 h = 1.0 - abs( x ) - abs( y ); float4 b0 = float4( x.xy, y.xy ); float4 b1 = float4( x.zw, y.zw ); float4 s0 = floor( b0 ) * 2.0 + 1.0; float4 s1 = floor( b1 ) * 2.0 + 1.0; float4 sh = -step( h, 0.0 ); float4 a0 = b0.xzyw + s0.xzyw * sh.xxyy; float4 a1 = b1.xzyw + s1.xzyw * sh.zzww; float3 g0 = float3( a0.xy, h.x ); float3 g1 = float3( a0.zw, h.y ); float3 g2 = float3( a1.xy, h.z ); float3 g3 = float3( a1.zw, h.w ); float4 norm = taylorInvSqrt( float4( dot( g0, g0 ), dot( g1, g1 ), dot( g2, g2 ), dot( g3, g3 ) ) ); g0 *= norm.x; g1 *= norm.y; g2 *= norm.z; g3 *= norm.w; float4 m = max( 0.6 - float4( dot( x0, x0 ), dot( x1, x1 ), dot( x2, x2 ), dot( x3, x3 ) ), 0.0 ); m = m* m; m = m* m; float4 px = float4( dot( x0, g0 ), dot( x1, g1 ), dot( x2, g2 ), dot( x3, g3 ) ); return 42.0 * dot( m, px); } PackedVaryings VertexFunction( Attributes input ) { PackedVaryings output = (PackedVaryings)0; UNITY_SETUP_INSTANCE_ID(input); UNITY_TRANSFER_INSTANCE_ID(input, output); UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); float3 ase_positionWS = TransformObjectToWorld( ( input.positionOS ).xyz ); float mulTime34 = _TimeParameters.x * ( RAYGlobalWindForce * ( _WindForce * 5 ) ); float simplePerlin3D35 = snoise( ( ase_positionWS + mulTime34 )*( ( 1.0 - _WindWavesScale ) * RAYGlobalWavesScale ) ); simplePerlin3D35 = simplePerlin3D35*0.5 + 0.5; float saferPower940 = abs( simplePerlin3D35 ); float temp_output_231_0 = ( pow( saferPower940 , ( _WindFlowDensity * RAYGlobalFlowDensity ) ) * 0.01 ); float2 texCoord357 = input.ase_texcoord.xy * float2( 1,1 ) + float2( 0,0 ); float saferPower356 = abs( texCoord357.y ); float lerpResult1020 = lerp( temp_output_231_0 , ( temp_output_231_0 * pow( saferPower356 , 1.5 ) ) , _UVBaseLock); float4 transform916 = mul(GetWorldToObjectMatrix(),float4( ( RAYGlobalDirection * ( lerpResult1020 * input.ase_color.r * ( ( _WindForce * 100 ) * RAYGlobalWindForce ) ) ) , 0.0 )); #ifdef _ENABLEWIND_ON float4 staticSwitch341 = transform916; #else float4 staticSwitch341 = float4( 0,0,0,0 ); #endif float4 Wind191 = staticSwitch341; float smoothstepResult1117 = smoothstep( 1.01 , ( 1.0 - _GrassFade ) , ( length( ( _WorldSpaceCameraPos - ase_positionWS ) ) / _GrassFadeDistance )); float lerpResult1023 = lerp( 1.0 , saturate( smoothstepResult1117 ) , _GrassDistanceFadeEnable); float GrassDistanceFadeMask982 = lerpResult1023; float4 lerpResult1065 = lerp( float4( ( input.positionOS.xyz * -1 ) , 0.0 ) , Wind191 , GrassDistanceFadeMask982); float3 lerpResult1096 = lerp( input.normalOS , float3( 0, 1, 0 ) , _LightingFlatness); float3 LightingFlatness1101 = lerpResult1096; output.ase_texcoord1.xy = input.ase_texcoord.xy; //setting value to unused interpolator channels and avoid initialization warnings output.ase_texcoord1.zw = 0; #ifdef ASE_ABSOLUTE_VERTEX_POS float3 defaultVertexValue = input.positionOS.xyz; #else float3 defaultVertexValue = float3(0, 0, 0); #endif float3 vertexValue = lerpResult1065.xyz; #ifdef ASE_ABSOLUTE_VERTEX_POS input.positionOS.xyz = vertexValue; #else input.positionOS.xyz += vertexValue; #endif input.normalOS = LightingFlatness1101; input.tangentOS = input.tangentOS; VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz ); output.positionCS = vertexInput.positionCS; output.positionWS = vertexInput.positionWS; return output; } #if defined(ASE_TESSELLATION) struct VertexControl { float4 positionOS : INTERNALTESSPOS; half3 normalOS : NORMAL; half4 tangentOS : TANGENT; float4 ase_texcoord : TEXCOORD0; float4 ase_color : COLOR; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct TessellationFactors { float edge[3] : SV_TessFactor; float inside : SV_InsideTessFactor; }; VertexControl vert ( Attributes input ) { VertexControl output; UNITY_SETUP_INSTANCE_ID(input); UNITY_TRANSFER_INSTANCE_ID(input, output); output.positionOS = input.positionOS; output.normalOS = input.normalOS; output.tangentOS = input.tangentOS; output.ase_texcoord = input.ase_texcoord; output.ase_color = input.ase_color; return output; } TessellationFactors TessellationFunction (InputPatch input) { TessellationFactors output; 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(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); #elif defined(ASE_LENGTH_TESSELLATION) tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); #elif defined(ASE_LENGTH_CULL_TESSELLATION) tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); #endif output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w; return output; } [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")] PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) { Attributes output = (Attributes) 0; output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; output.tangentOS = patch[0].tangentOS * bary.x + patch[1].tangentOS * bary.y + patch[2].tangentOS * bary.z; output.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; output.ase_color = patch[0].ase_color * bary.x + patch[1].ase_color * bary.y + patch[2].ase_color * bary.z; #if defined(ASE_PHONG_TESSELLATION) float3 pp[3]; for (int i = 0; i < 3; ++i) pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); float phongStrength = _TessPhongStrength; output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz; #endif UNITY_TRANSFER_INSTANCE_ID(patch[0], output); return VertexFunction(output); } #else PackedVaryings vert ( Attributes input ) { return VertexFunction( input ); } #endif half4 frag( PackedVaryings input #if defined( ASE_DEPTH_WRITE_ON ) ,out float outputDepth : ASE_SV_DEPTH #endif ) : SV_Target { UNITY_SETUP_INSTANCE_ID(input); UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input ); #if defined(MAIN_LIGHT_CALCULATE_SHADOWS) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) float4 shadowCoord = TransformWorldToShadowCoord(input.positionWS); #else float4 shadowCoord = float4(0, 0, 0, 0); #endif float3 PositionWS = input.positionWS; float3 PositionRWS = GetCameraRelativePositionWS( input.positionWS ); float4 ShadowCoord = shadowCoord; float4 ScreenPosNorm = float4( GetNormalizedScreenSpaceUV( input.positionCS ), input.positionCS.zw ); float4 ClipPos = ComputeClipSpacePosition( ScreenPosNorm.xy, input.positionCS.z ) * input.positionCS.w; float4 ScreenPos = ComputeScreenPos( ClipPos ); float2 temp_cast_0 = (_Tiling).xx; float2 texCoord1028 = input.ase_texcoord1.xy * temp_cast_0 + float2( 0,0 ); float2 Tiling1032 = texCoord1028; float4 tex2DNode1 = tex2D( _Albedo, Tiling1032 ); float AlbedoAlpha263 = tex2DNode1.a; float Alpha = AlbedoAlpha263; float AlphaClipThreshold = _AlphaCutoff; #if defined( ASE_DEPTH_WRITE_ON ) float DeviceDepth = input.positionCS.z; #endif #if defined( _ALPHATEST_ON ) AlphaDiscard( Alpha, AlphaClipThreshold ); #endif #if defined(LOD_FADE_CROSSFADE) LODFadeCrossFade( input.positionCS ); #endif #if defined( ASE_DEPTH_WRITE_ON ) outputDepth = DeviceDepth; #endif return 0; } ENDHLSL } Pass { Name "Meta" Tags { "LightMode"="Meta" } Cull Off HLSLPROGRAM #define ASE_GEOMETRY #define _NORMAL_DROPOFF_TS 1 #define ASE_FOG 1 #pragma multi_compile_fragment _ DEBUG_DISPLAY #pragma multi_compile_local_fragment _ALPHATEST_ON #define _NORMALMAP 1 #define ASE_VERSION 19904 #define ASE_SRP_VERSION 140011 #pragma shader_feature EDITOR_VISUALIZATION #pragma vertex vert #pragma fragment frag #if defined(_SPECULAR_SETUP) && defined(ASE_LIGHTING_SIMPLE) #define _SPECULAR_COLOR 1 #endif #define SHADERPASS SHADERPASS_META #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" #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/Input.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" #if ASE_SRP_VERSION >=140009 #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" #endif #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MetaInput.hlsl" #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" #define ASE_NEEDS_VERT_POSITION #define ASE_NEEDS_TEXTURE_COORDINATES0 #define ASE_NEEDS_VERT_TEXTURE_COORDINATES0 #define ASE_NEEDS_VERT_NORMAL #define ASE_NEEDS_WORLD_POSITION #define ASE_NEEDS_FRAG_WORLD_POSITION #define ASE_NEEDS_FRAG_TEXTURE_COORDINATES0 #pragma shader_feature_local _ENABLEWIND_ON #pragma shader_feature_local _COLOR2ENABLE_ON #pragma shader_feature_local _SECONDCOLOROVERLAYTYPE_WORLD_NOISE_2D _SECONDCOLOROVERLAYTYPE_WORLD_NOISE_3D _SECONDCOLOROVERLAYTYPE_VERTEX_GRADIENT _SECONDCOLOROVERLAYTYPE_UV_GRADIENT struct Attributes { float4 positionOS : POSITION; half3 normalOS : NORMAL; half4 tangentOS : TANGENT; float4 texcoord0 : TEXCOORD0; float4 texcoord1 : TEXCOORD1; float4 texcoord2 : TEXCOORD2; float4 ase_color : COLOR; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct PackedVaryings { float4 positionCS : SV_POSITION; float3 positionWS : TEXCOORD0; #ifdef EDITOR_VISUALIZATION float4 VizUV : TEXCOORD1; float4 LightCoord : TEXCOORD2; #endif float4 ase_texcoord3 : TEXCOORD3; float4 ase_texcoord4 : TEXCOORD4; UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO }; CBUFFER_START(UnityPerMaterial) float4 _MainColor; float4 _SecondColor; float _NormalScale; float _SecondColorFade; float _SecondColorOffset; float _WorldNoiseScale; float _Tiling; float _Smoothness; float _WindForce; float _GrassDistanceFadeEnable; float _GrassFadeDistance; float _GrassFade; float _UVBaseLock; float _WindFlowDensity; float _WindWavesScale; float _LightingFlatness; float _AlphaCutoff; #ifdef ASE_TRANSMISSION float _TransmissionShadow; #endif #ifdef ASE_TRANSLUCENCY float _TransStrength; float _TransNormal; float _TransScattering; float _TransDirect; float _TransAmbient; float _TransShadow; #endif #ifdef ASE_TESSELLATION float _TessPhongStrength; float _TessValue; float _TessMin; float _TessMax; float _TessEdgeLength; float _TessMaxDisp; #endif CBUFFER_END #ifdef SCENEPICKINGPASS float4 _SelectionID; #endif #ifdef SCENESELECTIONPASS int _ObjectId; int _PassValue; #endif float3 RAYGlobalDirection; float RAYGlobalWavesScale; float RAYGlobalFlowDensity; float RAYGlobalWindForce; sampler2D _Albedo; float3 mod3D289( float3 x ) { return x - floor( x / 289.0 ) * 289.0; } float4 mod3D289( float4 x ) { return x - floor( x / 289.0 ) * 289.0; } float4 permute( float4 x ) { return mod3D289( ( x * 34.0 + 1.0 ) * x ); } float4 taylorInvSqrt( float4 r ) { return 1.79284291400159 - r * 0.85373472095314; } float snoise( float3 v ) { const float2 C = float2( 1.0 / 6.0, 1.0 / 3.0 ); float3 i = floor( v + dot( v, C.yyy ) ); float3 x0 = v - i + dot( i, C.xxx ); float3 g = step( x0.yzx, x0.xyz ); float3 l = 1.0 - g; float3 i1 = min( g.xyz, l.zxy ); float3 i2 = max( g.xyz, l.zxy ); float3 x1 = x0 - i1 + C.xxx; float3 x2 = x0 - i2 + C.yyy; float3 x3 = x0 - 0.5; i = mod3D289( i); float4 p = permute( permute( permute( i.z + float4( 0.0, i1.z, i2.z, 1.0 ) ) + i.y + float4( 0.0, i1.y, i2.y, 1.0 ) ) + i.x + float4( 0.0, i1.x, i2.x, 1.0 ) ); float4 j = p - 49.0 * floor( p / 49.0 ); // mod(p,7*7) float4 x_ = floor( j / 7.0 ); float4 y_ = floor( j - 7.0 * x_ ); // mod(j,N) float4 x = ( x_ * 2.0 + 0.5 ) / 7.0 - 1.0; float4 y = ( y_ * 2.0 + 0.5 ) / 7.0 - 1.0; float4 h = 1.0 - abs( x ) - abs( y ); float4 b0 = float4( x.xy, y.xy ); float4 b1 = float4( x.zw, y.zw ); float4 s0 = floor( b0 ) * 2.0 + 1.0; float4 s1 = floor( b1 ) * 2.0 + 1.0; float4 sh = -step( h, 0.0 ); float4 a0 = b0.xzyw + s0.xzyw * sh.xxyy; float4 a1 = b1.xzyw + s1.xzyw * sh.zzww; float3 g0 = float3( a0.xy, h.x ); float3 g1 = float3( a0.zw, h.y ); float3 g2 = float3( a1.xy, h.z ); float3 g3 = float3( a1.zw, h.w ); float4 norm = taylorInvSqrt( float4( dot( g0, g0 ), dot( g1, g1 ), dot( g2, g2 ), dot( g3, g3 ) ) ); g0 *= norm.x; g1 *= norm.y; g2 *= norm.z; g3 *= norm.w; float4 m = max( 0.6 - float4( dot( x0, x0 ), dot( x1, x1 ), dot( x2, x2 ), dot( x3, x3 ) ), 0.0 ); m = m* m; m = m* m; float4 px = float4( dot( x0, g0 ), dot( x1, g1 ), dot( x2, g2 ), dot( x3, g3 ) ); return 42.0 * dot( m, px); } float3 mod2D289( float3 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; } float2 mod2D289( float2 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; } float3 permute( float3 x ) { return mod2D289( ( ( x * 34.0 ) + 1.0 ) * x ); } float snoise( float2 v ) { const float4 C = float4( 0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439 ); float2 i = floor( v + dot( v, C.yy ) ); float2 x0 = v - i + dot( i, C.xx ); float2 i1; i1 = ( x0.x > x0.y ) ? float2( 1.0, 0.0 ) : float2( 0.0, 1.0 ); float4 x12 = x0.xyxy + C.xxzz; x12.xy -= i1; i = mod2D289( i ); float3 p = permute( permute( i.y + float3( 0.0, i1.y, 1.0 ) ) + i.x + float3( 0.0, i1.x, 1.0 ) ); float3 m = max( 0.5 - float3( dot( x0, x0 ), dot( x12.xy, x12.xy ), dot( x12.zw, x12.zw ) ), 0.0 ); m = m * m; m = m * m; float3 x = 2.0 * frac( p * C.www ) - 1.0; float3 h = abs( x ) - 0.5; float3 ox = floor( x + 0.5 ); float3 a0 = x - ox; m *= 1.79284291400159 - 0.85373472095314 * ( a0 * a0 + h * h ); float3 g; g.x = a0.x * x0.x + h.x * x0.y; g.yz = a0.yz * x12.xz + h.yz * x12.yw; return 130.0 * dot( m, g ); } PackedVaryings VertexFunction( Attributes input ) { PackedVaryings output = (PackedVaryings)0; UNITY_SETUP_INSTANCE_ID(input); UNITY_TRANSFER_INSTANCE_ID(input, output); UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); float3 ase_positionWS = TransformObjectToWorld( ( input.positionOS ).xyz ); float mulTime34 = _TimeParameters.x * ( RAYGlobalWindForce * ( _WindForce * 5 ) ); float simplePerlin3D35 = snoise( ( ase_positionWS + mulTime34 )*( ( 1.0 - _WindWavesScale ) * RAYGlobalWavesScale ) ); simplePerlin3D35 = simplePerlin3D35*0.5 + 0.5; float saferPower940 = abs( simplePerlin3D35 ); float temp_output_231_0 = ( pow( saferPower940 , ( _WindFlowDensity * RAYGlobalFlowDensity ) ) * 0.01 ); float2 texCoord357 = input.texcoord0.xy * float2( 1,1 ) + float2( 0,0 ); float saferPower356 = abs( texCoord357.y ); float lerpResult1020 = lerp( temp_output_231_0 , ( temp_output_231_0 * pow( saferPower356 , 1.5 ) ) , _UVBaseLock); float4 transform916 = mul(GetWorldToObjectMatrix(),float4( ( RAYGlobalDirection * ( lerpResult1020 * input.ase_color.r * ( ( _WindForce * 100 ) * RAYGlobalWindForce ) ) ) , 0.0 )); #ifdef _ENABLEWIND_ON float4 staticSwitch341 = transform916; #else float4 staticSwitch341 = float4( 0,0,0,0 ); #endif float4 Wind191 = staticSwitch341; float smoothstepResult1117 = smoothstep( 1.01 , ( 1.0 - _GrassFade ) , ( length( ( _WorldSpaceCameraPos - ase_positionWS ) ) / _GrassFadeDistance )); float lerpResult1023 = lerp( 1.0 , saturate( smoothstepResult1117 ) , _GrassDistanceFadeEnable); float GrassDistanceFadeMask982 = lerpResult1023; float4 lerpResult1065 = lerp( float4( ( input.positionOS.xyz * -1 ) , 0.0 ) , Wind191 , GrassDistanceFadeMask982); float3 lerpResult1096 = lerp( input.normalOS , float3( 0, 1, 0 ) , _LightingFlatness); float3 LightingFlatness1101 = lerpResult1096; output.ase_texcoord3.xy = input.texcoord0.xy; output.ase_texcoord4 = input.positionOS; //setting value to unused interpolator channels and avoid initialization warnings output.ase_texcoord3.zw = 0; #ifdef ASE_ABSOLUTE_VERTEX_POS float3 defaultVertexValue = input.positionOS.xyz; #else float3 defaultVertexValue = float3(0, 0, 0); #endif float3 vertexValue = lerpResult1065.xyz; #ifdef ASE_ABSOLUTE_VERTEX_POS input.positionOS.xyz = vertexValue; #else input.positionOS.xyz += vertexValue; #endif input.normalOS = LightingFlatness1101; input.tangentOS = input.tangentOS; #ifdef EDITOR_VISUALIZATION float2 VizUV = 0; float4 LightCoord = 0; UnityEditorVizData(input.positionOS.xyz, input.texcoord0.xy, input.texcoord1.xy, input.texcoord2.xy, VizUV, LightCoord); output.VizUV = float4(VizUV, 0, 0); output.LightCoord = LightCoord; #endif output.positionCS = MetaVertexPosition( input.positionOS, input.texcoord1.xy, input.texcoord1.xy, unity_LightmapST, unity_DynamicLightmapST ); output.positionWS = TransformObjectToWorld( input.positionOS.xyz ); return output; } #if defined(ASE_TESSELLATION) struct VertexControl { float4 positionOS : INTERNALTESSPOS; half3 normalOS : NORMAL; half4 tangentOS : TANGENT; float4 ase_color : COLOR; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct TessellationFactors { float edge[3] : SV_TessFactor; float inside : SV_InsideTessFactor; }; VertexControl vert ( Attributes input ) { VertexControl output; UNITY_SETUP_INSTANCE_ID(input); UNITY_TRANSFER_INSTANCE_ID(input, output); output.positionOS = input.positionOS; output.normalOS = input.normalOS; output.tangentOS = input.tangentOS; output.ase_color = input.ase_color; return output; } TessellationFactors TessellationFunction (InputPatch input) { TessellationFactors output; 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(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); #elif defined(ASE_LENGTH_TESSELLATION) tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); #elif defined(ASE_LENGTH_CULL_TESSELLATION) tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); #endif output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w; return output; } [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")] PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) { Attributes output = (Attributes) 0; output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; output.tangentOS = patch[0].tangentOS * bary.x + patch[1].tangentOS * bary.y + patch[2].tangentOS * bary.z; output.ase_color = patch[0].ase_color * bary.x + patch[1].ase_color * bary.y + patch[2].ase_color * bary.z; #if defined(ASE_PHONG_TESSELLATION) float3 pp[3]; for (int i = 0; i < 3; ++i) pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); float phongStrength = _TessPhongStrength; output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz; #endif UNITY_TRANSFER_INSTANCE_ID(patch[0], output); return VertexFunction(output); } #else PackedVaryings vert ( Attributes input ) { return VertexFunction( input ); } #endif half4 frag(PackedVaryings input ) : SV_Target { UNITY_SETUP_INSTANCE_ID(input); UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input ); #if defined(MAIN_LIGHT_CALCULATE_SHADOWS) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) float4 shadowCoord = TransformWorldToShadowCoord(input.positionWS); #else float4 shadowCoord = float4(0, 0, 0, 0); #endif float3 PositionWS = input.positionWS; float3 PositionRWS = GetCameraRelativePositionWS( input.positionWS ); float4 ShadowCoord = shadowCoord; float2 temp_cast_0 = (_Tiling).xx; float2 texCoord1028 = input.ase_texcoord3.xy * temp_cast_0 + float2( 0,0 ); float2 Tiling1032 = texCoord1028; float4 tex2DNode1 = tex2D( _Albedo, Tiling1032 ); float4 temp_output_10_0 = ( _MainColor * tex2DNode1 ); float simplePerlin2D742 = snoise( (PositionWS).xz*_WorldNoiseScale ); simplePerlin2D742 = simplePerlin2D742*0.5 + 0.5; float simplePerlin3D1015 = snoise( PositionWS*_WorldNoiseScale ); simplePerlin3D1015 = simplePerlin3D1015*0.5 + 0.5; float2 texCoord361 = input.ase_texcoord3.xy * float2( 1,1 ) + float2( 0,0 ); #if defined( _SECONDCOLOROVERLAYTYPE_WORLD_NOISE_2D ) float staticSwitch360 = simplePerlin2D742; #elif defined( _SECONDCOLOROVERLAYTYPE_WORLD_NOISE_3D ) float staticSwitch360 = simplePerlin3D1015; #elif defined( _SECONDCOLOROVERLAYTYPE_VERTEX_GRADIENT ) float staticSwitch360 = input.ase_texcoord4.xyz.y; #elif defined( _SECONDCOLOROVERLAYTYPE_UV_GRADIENT ) float staticSwitch360 = texCoord361.y; #else float staticSwitch360 = simplePerlin2D742; #endif float temp_output_875_0 = ( staticSwitch360 + ( 1.0 - _SecondColorOffset ) ); float lerpResult1025 = lerp( temp_output_875_0 , ( 1.0 - temp_output_875_0 ) , ( _SecondColorFade - -0.5 )); float SecondColorMask335 = saturate( lerpResult1025 ); float4 lerpResult332 = lerp( temp_output_10_0 , ( _SecondColor * tex2D( _Albedo, Tiling1032 ) ) , SecondColorMask335); #ifdef _COLOR2ENABLE_ON float4 staticSwitch1022 = lerpResult332; #else float4 staticSwitch1022 = temp_output_10_0; #endif float4 Albedo259 = staticSwitch1022; float AlbedoAlpha263 = tex2DNode1.a; float3 BaseColor = Albedo259.rgb; float3 Emission = 0; float Alpha = AlbedoAlpha263; float AlphaClipThreshold = _AlphaCutoff; #if defined( _ALPHATEST_ON ) AlphaDiscard( Alpha, AlphaClipThreshold ); #endif MetaInput metaInput = (MetaInput)0; metaInput.Albedo = BaseColor; metaInput.Emission = Emission; #ifdef EDITOR_VISUALIZATION metaInput.VizUV = input.VizUV.xy; metaInput.LightCoord = input.LightCoord; #endif return UnityMetaFragment(metaInput); } ENDHLSL } Pass { Name "Universal2D" Tags { "LightMode"="Universal2D" } Blend One Zero, One Zero ZWrite On ZTest LEqual Offset 0 , 0 ColorMask RGBA HLSLPROGRAM #define ASE_GEOMETRY #define _NORMAL_DROPOFF_TS 1 #define ASE_FOG 1 #pragma multi_compile_fragment _ DEBUG_DISPLAY #pragma multi_compile_local_fragment _ALPHATEST_ON #define _NORMALMAP 1 #define ASE_VERSION 19904 #define ASE_SRP_VERSION 140011 #pragma vertex vert #pragma fragment frag #if defined(_SPECULAR_SETUP) && defined(ASE_LIGHTING_SIMPLE) #define _SPECULAR_COLOR 1 #endif #define SHADERPASS SHADERPASS_2D #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" #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/Input.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" #if ASE_SRP_VERSION >=140009 #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" #endif #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" #define ASE_NEEDS_VERT_POSITION #define ASE_NEEDS_TEXTURE_COORDINATES0 #define ASE_NEEDS_VERT_NORMAL #define ASE_NEEDS_WORLD_POSITION #define ASE_NEEDS_FRAG_WORLD_POSITION #define ASE_NEEDS_FRAG_TEXTURE_COORDINATES0 #pragma shader_feature_local _ENABLEWIND_ON #pragma shader_feature_local _COLOR2ENABLE_ON #pragma shader_feature_local _SECONDCOLOROVERLAYTYPE_WORLD_NOISE_2D _SECONDCOLOROVERLAYTYPE_WORLD_NOISE_3D _SECONDCOLOROVERLAYTYPE_VERTEX_GRADIENT _SECONDCOLOROVERLAYTYPE_UV_GRADIENT struct Attributes { float4 positionOS : POSITION; half3 normalOS : NORMAL; half4 tangentOS : TANGENT; float4 ase_texcoord : TEXCOORD0; float4 ase_color : COLOR; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct PackedVaryings { float4 positionCS : SV_POSITION; float3 positionWS : TEXCOORD0; float4 ase_texcoord1 : TEXCOORD1; float4 ase_texcoord2 : TEXCOORD2; UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO }; CBUFFER_START(UnityPerMaterial) float4 _MainColor; float4 _SecondColor; float _NormalScale; float _SecondColorFade; float _SecondColorOffset; float _WorldNoiseScale; float _Tiling; float _Smoothness; float _WindForce; float _GrassDistanceFadeEnable; float _GrassFadeDistance; float _GrassFade; float _UVBaseLock; float _WindFlowDensity; float _WindWavesScale; float _LightingFlatness; float _AlphaCutoff; #ifdef ASE_TRANSMISSION float _TransmissionShadow; #endif #ifdef ASE_TRANSLUCENCY float _TransStrength; float _TransNormal; float _TransScattering; float _TransDirect; float _TransAmbient; float _TransShadow; #endif #ifdef ASE_TESSELLATION float _TessPhongStrength; float _TessValue; float _TessMin; float _TessMax; float _TessEdgeLength; float _TessMaxDisp; #endif CBUFFER_END #ifdef SCENEPICKINGPASS float4 _SelectionID; #endif #ifdef SCENESELECTIONPASS int _ObjectId; int _PassValue; #endif float3 RAYGlobalDirection; float RAYGlobalWavesScale; float RAYGlobalFlowDensity; float RAYGlobalWindForce; sampler2D _Albedo; float3 mod3D289( float3 x ) { return x - floor( x / 289.0 ) * 289.0; } float4 mod3D289( float4 x ) { return x - floor( x / 289.0 ) * 289.0; } float4 permute( float4 x ) { return mod3D289( ( x * 34.0 + 1.0 ) * x ); } float4 taylorInvSqrt( float4 r ) { return 1.79284291400159 - r * 0.85373472095314; } float snoise( float3 v ) { const float2 C = float2( 1.0 / 6.0, 1.0 / 3.0 ); float3 i = floor( v + dot( v, C.yyy ) ); float3 x0 = v - i + dot( i, C.xxx ); float3 g = step( x0.yzx, x0.xyz ); float3 l = 1.0 - g; float3 i1 = min( g.xyz, l.zxy ); float3 i2 = max( g.xyz, l.zxy ); float3 x1 = x0 - i1 + C.xxx; float3 x2 = x0 - i2 + C.yyy; float3 x3 = x0 - 0.5; i = mod3D289( i); float4 p = permute( permute( permute( i.z + float4( 0.0, i1.z, i2.z, 1.0 ) ) + i.y + float4( 0.0, i1.y, i2.y, 1.0 ) ) + i.x + float4( 0.0, i1.x, i2.x, 1.0 ) ); float4 j = p - 49.0 * floor( p / 49.0 ); // mod(p,7*7) float4 x_ = floor( j / 7.0 ); float4 y_ = floor( j - 7.0 * x_ ); // mod(j,N) float4 x = ( x_ * 2.0 + 0.5 ) / 7.0 - 1.0; float4 y = ( y_ * 2.0 + 0.5 ) / 7.0 - 1.0; float4 h = 1.0 - abs( x ) - abs( y ); float4 b0 = float4( x.xy, y.xy ); float4 b1 = float4( x.zw, y.zw ); float4 s0 = floor( b0 ) * 2.0 + 1.0; float4 s1 = floor( b1 ) * 2.0 + 1.0; float4 sh = -step( h, 0.0 ); float4 a0 = b0.xzyw + s0.xzyw * sh.xxyy; float4 a1 = b1.xzyw + s1.xzyw * sh.zzww; float3 g0 = float3( a0.xy, h.x ); float3 g1 = float3( a0.zw, h.y ); float3 g2 = float3( a1.xy, h.z ); float3 g3 = float3( a1.zw, h.w ); float4 norm = taylorInvSqrt( float4( dot( g0, g0 ), dot( g1, g1 ), dot( g2, g2 ), dot( g3, g3 ) ) ); g0 *= norm.x; g1 *= norm.y; g2 *= norm.z; g3 *= norm.w; float4 m = max( 0.6 - float4( dot( x0, x0 ), dot( x1, x1 ), dot( x2, x2 ), dot( x3, x3 ) ), 0.0 ); m = m* m; m = m* m; float4 px = float4( dot( x0, g0 ), dot( x1, g1 ), dot( x2, g2 ), dot( x3, g3 ) ); return 42.0 * dot( m, px); } float3 mod2D289( float3 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; } float2 mod2D289( float2 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; } float3 permute( float3 x ) { return mod2D289( ( ( x * 34.0 ) + 1.0 ) * x ); } float snoise( float2 v ) { const float4 C = float4( 0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439 ); float2 i = floor( v + dot( v, C.yy ) ); float2 x0 = v - i + dot( i, C.xx ); float2 i1; i1 = ( x0.x > x0.y ) ? float2( 1.0, 0.0 ) : float2( 0.0, 1.0 ); float4 x12 = x0.xyxy + C.xxzz; x12.xy -= i1; i = mod2D289( i ); float3 p = permute( permute( i.y + float3( 0.0, i1.y, 1.0 ) ) + i.x + float3( 0.0, i1.x, 1.0 ) ); float3 m = max( 0.5 - float3( dot( x0, x0 ), dot( x12.xy, x12.xy ), dot( x12.zw, x12.zw ) ), 0.0 ); m = m * m; m = m * m; float3 x = 2.0 * frac( p * C.www ) - 1.0; float3 h = abs( x ) - 0.5; float3 ox = floor( x + 0.5 ); float3 a0 = x - ox; m *= 1.79284291400159 - 0.85373472095314 * ( a0 * a0 + h * h ); float3 g; g.x = a0.x * x0.x + h.x * x0.y; g.yz = a0.yz * x12.xz + h.yz * x12.yw; return 130.0 * dot( m, g ); } PackedVaryings VertexFunction( Attributes input ) { PackedVaryings output = (PackedVaryings)0; UNITY_SETUP_INSTANCE_ID( input ); UNITY_TRANSFER_INSTANCE_ID( input, output ); UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( output ); float3 ase_positionWS = TransformObjectToWorld( ( input.positionOS ).xyz ); float mulTime34 = _TimeParameters.x * ( RAYGlobalWindForce * ( _WindForce * 5 ) ); float simplePerlin3D35 = snoise( ( ase_positionWS + mulTime34 )*( ( 1.0 - _WindWavesScale ) * RAYGlobalWavesScale ) ); simplePerlin3D35 = simplePerlin3D35*0.5 + 0.5; float saferPower940 = abs( simplePerlin3D35 ); float temp_output_231_0 = ( pow( saferPower940 , ( _WindFlowDensity * RAYGlobalFlowDensity ) ) * 0.01 ); float2 texCoord357 = input.ase_texcoord.xy * float2( 1,1 ) + float2( 0,0 ); float saferPower356 = abs( texCoord357.y ); float lerpResult1020 = lerp( temp_output_231_0 , ( temp_output_231_0 * pow( saferPower356 , 1.5 ) ) , _UVBaseLock); float4 transform916 = mul(GetWorldToObjectMatrix(),float4( ( RAYGlobalDirection * ( lerpResult1020 * input.ase_color.r * ( ( _WindForce * 100 ) * RAYGlobalWindForce ) ) ) , 0.0 )); #ifdef _ENABLEWIND_ON float4 staticSwitch341 = transform916; #else float4 staticSwitch341 = float4( 0,0,0,0 ); #endif float4 Wind191 = staticSwitch341; float smoothstepResult1117 = smoothstep( 1.01 , ( 1.0 - _GrassFade ) , ( length( ( _WorldSpaceCameraPos - ase_positionWS ) ) / _GrassFadeDistance )); float lerpResult1023 = lerp( 1.0 , saturate( smoothstepResult1117 ) , _GrassDistanceFadeEnable); float GrassDistanceFadeMask982 = lerpResult1023; float4 lerpResult1065 = lerp( float4( ( input.positionOS.xyz * -1 ) , 0.0 ) , Wind191 , GrassDistanceFadeMask982); float3 lerpResult1096 = lerp( input.normalOS , float3( 0, 1, 0 ) , _LightingFlatness); float3 LightingFlatness1101 = lerpResult1096; output.ase_texcoord1.xy = input.ase_texcoord.xy; output.ase_texcoord2 = input.positionOS; //setting value to unused interpolator channels and avoid initialization warnings output.ase_texcoord1.zw = 0; #ifdef ASE_ABSOLUTE_VERTEX_POS float3 defaultVertexValue = input.positionOS.xyz; #else float3 defaultVertexValue = float3(0, 0, 0); #endif float3 vertexValue = lerpResult1065.xyz; #ifdef ASE_ABSOLUTE_VERTEX_POS input.positionOS.xyz = vertexValue; #else input.positionOS.xyz += vertexValue; #endif input.normalOS = LightingFlatness1101; input.tangentOS = input.tangentOS; VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz ); output.positionCS = vertexInput.positionCS; output.positionWS = vertexInput.positionWS; return output; } #if defined(ASE_TESSELLATION) struct VertexControl { float4 positionOS : INTERNALTESSPOS; half3 normalOS : NORMAL; half4 tangentOS : TANGENT; float4 ase_texcoord : TEXCOORD0; float4 ase_color : COLOR; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct TessellationFactors { float edge[3] : SV_TessFactor; float inside : SV_InsideTessFactor; }; VertexControl vert ( Attributes input ) { VertexControl output; UNITY_SETUP_INSTANCE_ID(input); UNITY_TRANSFER_INSTANCE_ID(input, output); output.positionOS = input.positionOS; output.normalOS = input.normalOS; output.tangentOS = input.tangentOS; output.ase_texcoord = input.ase_texcoord; output.ase_color = input.ase_color; return output; } TessellationFactors TessellationFunction (InputPatch input) { TessellationFactors output; 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(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); #elif defined(ASE_LENGTH_TESSELLATION) tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); #elif defined(ASE_LENGTH_CULL_TESSELLATION) tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); #endif output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w; return output; } [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")] PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) { Attributes output = (Attributes) 0; output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; output.tangentOS = patch[0].tangentOS * bary.x + patch[1].tangentOS * bary.y + patch[2].tangentOS * bary.z; output.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; output.ase_color = patch[0].ase_color * bary.x + patch[1].ase_color * bary.y + patch[2].ase_color * bary.z; #if defined(ASE_PHONG_TESSELLATION) float3 pp[3]; for (int i = 0; i < 3; ++i) pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); float phongStrength = _TessPhongStrength; output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz; #endif UNITY_TRANSFER_INSTANCE_ID(patch[0], output); return VertexFunction(output); } #else PackedVaryings vert ( Attributes input ) { return VertexFunction( input ); } #endif half4 frag(PackedVaryings input ) : SV_Target { UNITY_SETUP_INSTANCE_ID( input ); UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input ); #if defined(MAIN_LIGHT_CALCULATE_SHADOWS) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) float4 shadowCoord = TransformWorldToShadowCoord(input.positionWS); #else float4 shadowCoord = float4(0, 0, 0, 0); #endif float3 PositionWS = input.positionWS; float3 PositionRWS = GetCameraRelativePositionWS( input.positionWS ); float4 ShadowCoord = shadowCoord; float2 temp_cast_0 = (_Tiling).xx; float2 texCoord1028 = input.ase_texcoord1.xy * temp_cast_0 + float2( 0,0 ); float2 Tiling1032 = texCoord1028; float4 tex2DNode1 = tex2D( _Albedo, Tiling1032 ); float4 temp_output_10_0 = ( _MainColor * tex2DNode1 ); float simplePerlin2D742 = snoise( (PositionWS).xz*_WorldNoiseScale ); simplePerlin2D742 = simplePerlin2D742*0.5 + 0.5; float simplePerlin3D1015 = snoise( PositionWS*_WorldNoiseScale ); simplePerlin3D1015 = simplePerlin3D1015*0.5 + 0.5; float2 texCoord361 = input.ase_texcoord1.xy * float2( 1,1 ) + float2( 0,0 ); #if defined( _SECONDCOLOROVERLAYTYPE_WORLD_NOISE_2D ) float staticSwitch360 = simplePerlin2D742; #elif defined( _SECONDCOLOROVERLAYTYPE_WORLD_NOISE_3D ) float staticSwitch360 = simplePerlin3D1015; #elif defined( _SECONDCOLOROVERLAYTYPE_VERTEX_GRADIENT ) float staticSwitch360 = input.ase_texcoord2.xyz.y; #elif defined( _SECONDCOLOROVERLAYTYPE_UV_GRADIENT ) float staticSwitch360 = texCoord361.y; #else float staticSwitch360 = simplePerlin2D742; #endif float temp_output_875_0 = ( staticSwitch360 + ( 1.0 - _SecondColorOffset ) ); float lerpResult1025 = lerp( temp_output_875_0 , ( 1.0 - temp_output_875_0 ) , ( _SecondColorFade - -0.5 )); float SecondColorMask335 = saturate( lerpResult1025 ); float4 lerpResult332 = lerp( temp_output_10_0 , ( _SecondColor * tex2D( _Albedo, Tiling1032 ) ) , SecondColorMask335); #ifdef _COLOR2ENABLE_ON float4 staticSwitch1022 = lerpResult332; #else float4 staticSwitch1022 = temp_output_10_0; #endif float4 Albedo259 = staticSwitch1022; float AlbedoAlpha263 = tex2DNode1.a; float3 BaseColor = Albedo259.rgb; float Alpha = AlbedoAlpha263; float AlphaClipThreshold = _AlphaCutoff; half4 color = half4(BaseColor, Alpha ); #if defined( _ALPHATEST_ON ) AlphaDiscard( Alpha, AlphaClipThreshold ); #endif return color; } ENDHLSL } Pass { Name "DepthNormals" Tags { "LightMode"="DepthNormals" } ZWrite On Blend One Zero ZTest LEqual ZWrite On HLSLPROGRAM #define ASE_GEOMETRY #define _NORMAL_DROPOFF_TS 1 #pragma multi_compile_instancing #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE #define ASE_FOG 1 #pragma multi_compile_fragment _ DEBUG_DISPLAY #pragma multi_compile_local _ALPHATEST_ON #define _NORMALMAP 1 #define ASE_VERSION 19904 #define ASE_SRP_VERSION 140011 #pragma vertex vert #pragma fragment frag #if defined(_SPECULAR_SETUP) && defined(ASE_LIGHTING_SIMPLE) #define _SPECULAR_COLOR 1 #endif #define SHADERPASS SHADERPASS_DEPTHNORMALSONLY //#define SHADERPASS SHADERPASS_DEPTHNORMALS #if ASE_SRP_VERSION >=140007 #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" #endif #if ASE_SRP_VERSION >=140007 #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" #endif #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" #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/Input.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" #if ASE_SRP_VERSION >=140009 #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" #endif #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" #if defined(LOD_FADE_CROSSFADE) #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" #endif #if defined( UNITY_INSTANCING_ENABLED ) && defined( ASE_INSTANCED_TERRAIN ) && ( defined(_TERRAIN_INSTANCED_PERPIXEL_NORMAL) || defined(_INSTANCEDTERRAINNORMALS_PIXEL) ) #define ENABLE_TERRAIN_PERPIXEL_NORMAL #endif #define ASE_NEEDS_VERT_POSITION #define ASE_NEEDS_TEXTURE_COORDINATES0 #define ASE_NEEDS_VERT_TEXTURE_COORDINATES0 #define ASE_NEEDS_VERT_NORMAL #pragma shader_feature_local _ENABLEWIND_ON #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) && (SHADER_TARGET >= 45) #define ASE_SV_DEPTH SV_DepthLessEqual #define ASE_SV_POSITION_QUALIFIERS linear noperspective centroid #else #define ASE_SV_DEPTH SV_Depth #define ASE_SV_POSITION_QUALIFIERS #endif struct Attributes { float4 positionOS : POSITION; half3 normalOS : NORMAL; half4 tangentOS : TANGENT; half4 texcoord : TEXCOORD0; float4 ase_color : COLOR; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct PackedVaryings { ASE_SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION; float3 positionWS : TEXCOORD0; half3 normalWS : TEXCOORD1; float4 tangentWS : TEXCOORD2; // holds terrainUV ifdef ENABLE_TERRAIN_PERPIXEL_NORMAL float4 ase_texcoord3 : TEXCOORD3; UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO }; CBUFFER_START(UnityPerMaterial) float4 _MainColor; float4 _SecondColor; float _NormalScale; float _SecondColorFade; float _SecondColorOffset; float _WorldNoiseScale; float _Tiling; float _Smoothness; float _WindForce; float _GrassDistanceFadeEnable; float _GrassFadeDistance; float _GrassFade; float _UVBaseLock; float _WindFlowDensity; float _WindWavesScale; float _LightingFlatness; float _AlphaCutoff; #ifdef ASE_TRANSMISSION float _TransmissionShadow; #endif #ifdef ASE_TRANSLUCENCY float _TransStrength; float _TransNormal; float _TransScattering; float _TransDirect; float _TransAmbient; float _TransShadow; #endif #ifdef ASE_TESSELLATION float _TessPhongStrength; float _TessValue; float _TessMin; float _TessMax; float _TessEdgeLength; float _TessMaxDisp; #endif CBUFFER_END #ifdef SCENEPICKINGPASS float4 _SelectionID; #endif #ifdef SCENESELECTIONPASS int _ObjectId; int _PassValue; #endif float3 RAYGlobalDirection; float RAYGlobalWavesScale; float RAYGlobalFlowDensity; float RAYGlobalWindForce; sampler2D _Normal; sampler2D _Albedo; float3 mod3D289( float3 x ) { return x - floor( x / 289.0 ) * 289.0; } float4 mod3D289( float4 x ) { return x - floor( x / 289.0 ) * 289.0; } float4 permute( float4 x ) { return mod3D289( ( x * 34.0 + 1.0 ) * x ); } float4 taylorInvSqrt( float4 r ) { return 1.79284291400159 - r * 0.85373472095314; } float snoise( float3 v ) { const float2 C = float2( 1.0 / 6.0, 1.0 / 3.0 ); float3 i = floor( v + dot( v, C.yyy ) ); float3 x0 = v - i + dot( i, C.xxx ); float3 g = step( x0.yzx, x0.xyz ); float3 l = 1.0 - g; float3 i1 = min( g.xyz, l.zxy ); float3 i2 = max( g.xyz, l.zxy ); float3 x1 = x0 - i1 + C.xxx; float3 x2 = x0 - i2 + C.yyy; float3 x3 = x0 - 0.5; i = mod3D289( i); float4 p = permute( permute( permute( i.z + float4( 0.0, i1.z, i2.z, 1.0 ) ) + i.y + float4( 0.0, i1.y, i2.y, 1.0 ) ) + i.x + float4( 0.0, i1.x, i2.x, 1.0 ) ); float4 j = p - 49.0 * floor( p / 49.0 ); // mod(p,7*7) float4 x_ = floor( j / 7.0 ); float4 y_ = floor( j - 7.0 * x_ ); // mod(j,N) float4 x = ( x_ * 2.0 + 0.5 ) / 7.0 - 1.0; float4 y = ( y_ * 2.0 + 0.5 ) / 7.0 - 1.0; float4 h = 1.0 - abs( x ) - abs( y ); float4 b0 = float4( x.xy, y.xy ); float4 b1 = float4( x.zw, y.zw ); float4 s0 = floor( b0 ) * 2.0 + 1.0; float4 s1 = floor( b1 ) * 2.0 + 1.0; float4 sh = -step( h, 0.0 ); float4 a0 = b0.xzyw + s0.xzyw * sh.xxyy; float4 a1 = b1.xzyw + s1.xzyw * sh.zzww; float3 g0 = float3( a0.xy, h.x ); float3 g1 = float3( a0.zw, h.y ); float3 g2 = float3( a1.xy, h.z ); float3 g3 = float3( a1.zw, h.w ); float4 norm = taylorInvSqrt( float4( dot( g0, g0 ), dot( g1, g1 ), dot( g2, g2 ), dot( g3, g3 ) ) ); g0 *= norm.x; g1 *= norm.y; g2 *= norm.z; g3 *= norm.w; float4 m = max( 0.6 - float4( dot( x0, x0 ), dot( x1, x1 ), dot( x2, x2 ), dot( x3, x3 ) ), 0.0 ); m = m* m; m = m* m; float4 px = float4( dot( x0, g0 ), dot( x1, g1 ), dot( x2, g2 ), dot( x3, g3 ) ); return 42.0 * dot( m, px); } PackedVaryings VertexFunction( Attributes input ) { PackedVaryings output = (PackedVaryings)0; UNITY_SETUP_INSTANCE_ID(input); UNITY_TRANSFER_INSTANCE_ID(input, output); UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); float3 ase_positionWS = TransformObjectToWorld( ( input.positionOS ).xyz ); float mulTime34 = _TimeParameters.x * ( RAYGlobalWindForce * ( _WindForce * 5 ) ); float simplePerlin3D35 = snoise( ( ase_positionWS + mulTime34 )*( ( 1.0 - _WindWavesScale ) * RAYGlobalWavesScale ) ); simplePerlin3D35 = simplePerlin3D35*0.5 + 0.5; float saferPower940 = abs( simplePerlin3D35 ); float temp_output_231_0 = ( pow( saferPower940 , ( _WindFlowDensity * RAYGlobalFlowDensity ) ) * 0.01 ); float2 texCoord357 = input.texcoord.xy * float2( 1,1 ) + float2( 0,0 ); float saferPower356 = abs( texCoord357.y ); float lerpResult1020 = lerp( temp_output_231_0 , ( temp_output_231_0 * pow( saferPower356 , 1.5 ) ) , _UVBaseLock); float4 transform916 = mul(GetWorldToObjectMatrix(),float4( ( RAYGlobalDirection * ( lerpResult1020 * input.ase_color.r * ( ( _WindForce * 100 ) * RAYGlobalWindForce ) ) ) , 0.0 )); #ifdef _ENABLEWIND_ON float4 staticSwitch341 = transform916; #else float4 staticSwitch341 = float4( 0,0,0,0 ); #endif float4 Wind191 = staticSwitch341; float smoothstepResult1117 = smoothstep( 1.01 , ( 1.0 - _GrassFade ) , ( length( ( _WorldSpaceCameraPos - ase_positionWS ) ) / _GrassFadeDistance )); float lerpResult1023 = lerp( 1.0 , saturate( smoothstepResult1117 ) , _GrassDistanceFadeEnable); float GrassDistanceFadeMask982 = lerpResult1023; float4 lerpResult1065 = lerp( float4( ( input.positionOS.xyz * -1 ) , 0.0 ) , Wind191 , GrassDistanceFadeMask982); float3 lerpResult1096 = lerp( input.normalOS , float3( 0, 1, 0 ) , _LightingFlatness); float3 LightingFlatness1101 = lerpResult1096; output.ase_texcoord3.xy = input.texcoord.xy; //setting value to unused interpolator channels and avoid initialization warnings output.ase_texcoord3.zw = 0; #ifdef ASE_ABSOLUTE_VERTEX_POS float3 defaultVertexValue = input.positionOS.xyz; #else float3 defaultVertexValue = float3(0, 0, 0); #endif float3 vertexValue = lerpResult1065.xyz; #ifdef ASE_ABSOLUTE_VERTEX_POS input.positionOS.xyz = vertexValue; #else input.positionOS.xyz += vertexValue; #endif input.normalOS = LightingFlatness1101; input.tangentOS = input.tangentOS; VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz ); VertexNormalInputs normalInput = GetVertexNormalInputs( input.normalOS, input.tangentOS ); output.positionCS = vertexInput.positionCS; output.positionWS = vertexInput.positionWS; output.normalWS = normalInput.normalWS; output.tangentWS = float4( normalInput.tangentWS, ( input.tangentOS.w > 0.0 ? 1.0 : -1.0 ) * GetOddNegativeScale() ); #if defined( ENABLE_TERRAIN_PERPIXEL_NORMAL ) output.tangentWS.zw = input.texcoord.xy; output.tangentWS.xy = input.texcoord.xy * unity_LightmapST.xy + unity_LightmapST.zw; #endif return output; } #if defined(ASE_TESSELLATION) struct VertexControl { float4 positionOS : INTERNALTESSPOS; half3 normalOS : NORMAL; half4 tangentOS : TANGENT; float4 texcoord : TEXCOORD0; float4 ase_color : COLOR; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct TessellationFactors { float edge[3] : SV_TessFactor; float inside : SV_InsideTessFactor; }; VertexControl vert ( Attributes input ) { VertexControl output; UNITY_SETUP_INSTANCE_ID(input); UNITY_TRANSFER_INSTANCE_ID(input, output); output.positionOS = input.positionOS; output.normalOS = input.normalOS; output.tangentOS = input.tangentOS; output.texcoord = input.texcoord; output.ase_color = input.ase_color; return output; } TessellationFactors TessellationFunction (InputPatch input) { TessellationFactors output; 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(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); #elif defined(ASE_LENGTH_TESSELLATION) tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); #elif defined(ASE_LENGTH_CULL_TESSELLATION) tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); #endif output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w; return output; } [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")] PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) { Attributes output = (Attributes) 0; output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; output.tangentOS = patch[0].tangentOS * bary.x + patch[1].tangentOS * bary.y + patch[2].tangentOS * bary.z; output.texcoord = patch[0].texcoord * bary.x + patch[1].texcoord * bary.y + patch[2].texcoord * bary.z; output.ase_color = patch[0].ase_color * bary.x + patch[1].ase_color * bary.y + patch[2].ase_color * bary.z; #if defined(ASE_PHONG_TESSELLATION) float3 pp[3]; for (int i = 0; i < 3; ++i) pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); float phongStrength = _TessPhongStrength; output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz; #endif UNITY_TRANSFER_INSTANCE_ID(patch[0], output); return VertexFunction(output); } #else PackedVaryings vert ( Attributes input ) { return VertexFunction( input ); } #endif void frag( PackedVaryings input , out half4 outNormalWS : SV_Target0 #if defined( ASE_DEPTH_WRITE_ON ) ,out float outputDepth : ASE_SV_DEPTH #endif #ifdef _WRITE_RENDERING_LAYERS , out float4 outRenderingLayers : SV_Target1 #endif ) { UNITY_SETUP_INSTANCE_ID(input); UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input ); #if defined(MAIN_LIGHT_CALCULATE_SHADOWS) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) float4 shadowCoord = TransformWorldToShadowCoord(input.positionWS); #else float4 shadowCoord = float4(0, 0, 0, 0); #endif // @diogo: mikktspace compliant float renormFactor = 1.0 / max( FLT_MIN, length( input.normalWS ) ); float3 PositionWS = input.positionWS; float3 PositionRWS = GetCameraRelativePositionWS( input.positionWS ); float4 ShadowCoord = shadowCoord; float4 ScreenPosNorm = float4( GetNormalizedScreenSpaceUV( input.positionCS ), input.positionCS.zw ); float4 ClipPos = ComputeClipSpacePosition( ScreenPosNorm.xy, input.positionCS.z ) * input.positionCS.w; float4 ScreenPos = ComputeScreenPos( ClipPos ); float3 TangentWS = input.tangentWS.xyz * renormFactor; float3 BitangentWS = cross( input.normalWS, input.tangentWS.xyz ) * input.tangentWS.w * renormFactor; float3 NormalWS = input.normalWS * renormFactor; #if defined( ENABLE_TERRAIN_PERPIXEL_NORMAL ) float2 sampleCoords = (input.tangentWS.zw / _TerrainHeightmapRecipSize.zw + 0.5f) * _TerrainHeightmapRecipSize.xy; NormalWS = TransformObjectToWorldNormal(normalize(SAMPLE_TEXTURE2D(_TerrainNormalmapTexture, sampler_TerrainNormalmapTexture, sampleCoords).rgb * 2 - 1)); TangentWS = -cross(GetObjectToWorldMatrix()._13_23_33, NormalWS); BitangentWS = cross(NormalWS, -TangentWS); #endif float2 temp_cast_0 = (_Tiling).xx; float2 texCoord1028 = input.ase_texcoord3.xy * temp_cast_0 + float2( 0,0 ); float2 Tiling1032 = texCoord1028; float3 unpack886 = UnpackNormalScale( tex2D( _Normal, Tiling1032 ), _NormalScale ); unpack886.z = lerp( 1, unpack886.z, saturate(_NormalScale) ); float3 Normal888 = unpack886; float4 tex2DNode1 = tex2D( _Albedo, Tiling1032 ); float AlbedoAlpha263 = tex2DNode1.a; float3 Normal = Normal888; float Alpha = AlbedoAlpha263; float AlphaClipThreshold = _AlphaCutoff; #if defined( ASE_DEPTH_WRITE_ON ) float DeviceDepth = input.positionCS.z; #endif #if defined( _ALPHATEST_ON ) AlphaDiscard( Alpha, AlphaClipThreshold ); #endif #if defined(LOD_FADE_CROSSFADE) LODFadeCrossFade( input.positionCS ); #endif #if defined( ASE_DEPTH_WRITE_ON ) outputDepth = DeviceDepth; #endif #if defined(_GBUFFER_NORMALS_OCT) float2 octNormalWS = PackNormalOctQuadEncode(NormalWS); float2 remappedOctNormalWS = saturate(octNormalWS * 0.5 + 0.5); half3 packedNormalWS = PackFloat2To888(remappedOctNormalWS); outNormalWS = half4(packedNormalWS, 0.0); #else #if defined(_NORMALMAP) #if _NORMAL_DROPOFF_TS float3 normalWS = TransformTangentToWorld(Normal, half3x3(TangentWS, BitangentWS, NormalWS)); #elif _NORMAL_DROPOFF_OS float3 normalWS = TransformObjectToWorldNormal(Normal); #elif _NORMAL_DROPOFF_WS float3 normalWS = Normal; #endif #else float3 normalWS = NormalWS; #endif outNormalWS = half4(NormalizeNormalPerPixel(normalWS), 0.0); #endif #ifdef _WRITE_RENDERING_LAYERS uint renderingLayers = GetMeshRenderingLayer(); outRenderingLayers = float4(EncodeMeshRenderingLayer(renderingLayers), 0, 0, 0); #endif } ENDHLSL } Pass { Name "GBuffer" Tags { "LightMode"="UniversalGBuffer" } Blend One Zero, One Zero ZWrite On ZTest LEqual Offset 0 , 0 ColorMask RGBA HLSLPROGRAM #define ASE_GEOMETRY #define _NORMAL_DROPOFF_TS 1 #pragma shader_feature_local_fragment _RECEIVE_SHADOWS_OFF #pragma shader_feature_local_fragment _SPECULARHIGHLIGHTS_OFF #pragma shader_feature_local_fragment _ENVIRONMENTREFLECTIONS_OFF #pragma multi_compile_instancing #pragma instancing_options renderinglayer #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE #pragma multi_compile_fog #define ASE_FOG 1 #pragma multi_compile_fragment _ DEBUG_DISPLAY #pragma multi_compile_local_fragment _ALPHATEST_ON #define _NORMALMAP 1 #define ASE_VERSION 19904 #define ASE_SRP_VERSION 140011 #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN #pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING #pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION #pragma multi_compile_fragment _ _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 #pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT #pragma multi_compile_fragment _ _RENDER_PASS_ENABLED #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING #pragma multi_compile _ _MIXED_LIGHTING_SUBTRACTIVE #pragma multi_compile _ SHADOWS_SHADOWMASK #pragma multi_compile _ DIRLIGHTMAP_COMBINED #pragma multi_compile _ LIGHTMAP_ON #pragma multi_compile _ DYNAMICLIGHTMAP_ON #pragma vertex vert #pragma fragment frag #if defined(_SPECULAR_SETUP) && defined(ASE_LIGHTING_SIMPLE) #define _SPECULAR_COLOR 1 #endif #define SHADERPASS SHADERPASS_GBUFFER #if ASE_SRP_VERSION >=140007 #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" #endif #if ASE_SRP_VERSION >=140007 #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" #endif #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" #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/Input.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" #if ASE_SRP_VERSION >=140009 #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" #endif #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" #if defined(LOD_FADE_CROSSFADE) #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" #endif #if defined( UNITY_INSTANCING_ENABLED ) && defined( ASE_INSTANCED_TERRAIN ) && ( defined(_TERRAIN_INSTANCED_PERPIXEL_NORMAL) || defined(_INSTANCEDTERRAINNORMALS_PIXEL) ) #define ENABLE_TERRAIN_PERPIXEL_NORMAL #endif #define ASE_NEEDS_VERT_POSITION #define ASE_NEEDS_TEXTURE_COORDINATES0 #define ASE_NEEDS_VERT_TEXTURE_COORDINATES0 #define ASE_NEEDS_VERT_NORMAL #define ASE_NEEDS_WORLD_POSITION #define ASE_NEEDS_FRAG_WORLD_POSITION #define ASE_NEEDS_FRAG_TEXTURE_COORDINATES0 #pragma shader_feature_local _ENABLEWIND_ON #pragma shader_feature_local _COLOR2ENABLE_ON #pragma shader_feature_local _SECONDCOLOROVERLAYTYPE_WORLD_NOISE_2D _SECONDCOLOROVERLAYTYPE_WORLD_NOISE_3D _SECONDCOLOROVERLAYTYPE_VERTEX_GRADIENT _SECONDCOLOROVERLAYTYPE_UV_GRADIENT #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) && (SHADER_TARGET >= 45) #define ASE_SV_DEPTH SV_DepthLessEqual #define ASE_SV_POSITION_QUALIFIERS linear noperspective centroid #else #define ASE_SV_DEPTH SV_Depth #define ASE_SV_POSITION_QUALIFIERS #endif struct Attributes { float4 positionOS : POSITION; half3 normalOS : NORMAL; half4 tangentOS : TANGENT; float4 texcoord : TEXCOORD0; #if defined(LIGHTMAP_ON) || defined(ASE_NEEDS_TEXTURE_COORDINATES1) float4 texcoord1 : TEXCOORD1; #endif #if defined(DYNAMICLIGHTMAP_ON) || defined(ASE_NEEDS_TEXTURE_COORDINATES2) float4 texcoord2 : TEXCOORD2; #endif float4 ase_color : COLOR; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct PackedVaryings { ASE_SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION; float3 positionWS : TEXCOORD0; half3 normalWS : TEXCOORD1; float4 tangentWS : TEXCOORD2; // holds terrainUV ifdef ENABLE_TERRAIN_PERPIXEL_NORMAL float4 lightmapUVOrVertexSH : TEXCOORD3; #if defined(ASE_FOG) || defined(_ADDITIONAL_LIGHTS_VERTEX) half4 fogFactorAndVertexLight : TEXCOORD4; #endif #if defined(DYNAMICLIGHTMAP_ON) float2 dynamicLightmapUV : TEXCOORD5; #endif float4 ase_texcoord6 : TEXCOORD6; float4 ase_texcoord7 : TEXCOORD7; UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO }; CBUFFER_START(UnityPerMaterial) float4 _MainColor; float4 _SecondColor; float _NormalScale; float _SecondColorFade; float _SecondColorOffset; float _WorldNoiseScale; float _Tiling; float _Smoothness; float _WindForce; float _GrassDistanceFadeEnable; float _GrassFadeDistance; float _GrassFade; float _UVBaseLock; float _WindFlowDensity; float _WindWavesScale; float _LightingFlatness; float _AlphaCutoff; #ifdef ASE_TRANSMISSION float _TransmissionShadow; #endif #ifdef ASE_TRANSLUCENCY float _TransStrength; float _TransNormal; float _TransScattering; float _TransDirect; float _TransAmbient; float _TransShadow; #endif #ifdef ASE_TESSELLATION float _TessPhongStrength; float _TessValue; float _TessMin; float _TessMax; float _TessEdgeLength; float _TessMaxDisp; #endif CBUFFER_END #ifdef SCENEPICKINGPASS float4 _SelectionID; #endif #ifdef SCENESELECTIONPASS int _ObjectId; int _PassValue; #endif float3 RAYGlobalDirection; float RAYGlobalWavesScale; float RAYGlobalFlowDensity; float RAYGlobalWindForce; sampler2D _Albedo; sampler2D _Normal; sampler2D _SmoothnessTexture; #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityGBuffer.hlsl" float3 mod3D289( float3 x ) { return x - floor( x / 289.0 ) * 289.0; } float4 mod3D289( float4 x ) { return x - floor( x / 289.0 ) * 289.0; } float4 permute( float4 x ) { return mod3D289( ( x * 34.0 + 1.0 ) * x ); } float4 taylorInvSqrt( float4 r ) { return 1.79284291400159 - r * 0.85373472095314; } float snoise( float3 v ) { const float2 C = float2( 1.0 / 6.0, 1.0 / 3.0 ); float3 i = floor( v + dot( v, C.yyy ) ); float3 x0 = v - i + dot( i, C.xxx ); float3 g = step( x0.yzx, x0.xyz ); float3 l = 1.0 - g; float3 i1 = min( g.xyz, l.zxy ); float3 i2 = max( g.xyz, l.zxy ); float3 x1 = x0 - i1 + C.xxx; float3 x2 = x0 - i2 + C.yyy; float3 x3 = x0 - 0.5; i = mod3D289( i); float4 p = permute( permute( permute( i.z + float4( 0.0, i1.z, i2.z, 1.0 ) ) + i.y + float4( 0.0, i1.y, i2.y, 1.0 ) ) + i.x + float4( 0.0, i1.x, i2.x, 1.0 ) ); float4 j = p - 49.0 * floor( p / 49.0 ); // mod(p,7*7) float4 x_ = floor( j / 7.0 ); float4 y_ = floor( j - 7.0 * x_ ); // mod(j,N) float4 x = ( x_ * 2.0 + 0.5 ) / 7.0 - 1.0; float4 y = ( y_ * 2.0 + 0.5 ) / 7.0 - 1.0; float4 h = 1.0 - abs( x ) - abs( y ); float4 b0 = float4( x.xy, y.xy ); float4 b1 = float4( x.zw, y.zw ); float4 s0 = floor( b0 ) * 2.0 + 1.0; float4 s1 = floor( b1 ) * 2.0 + 1.0; float4 sh = -step( h, 0.0 ); float4 a0 = b0.xzyw + s0.xzyw * sh.xxyy; float4 a1 = b1.xzyw + s1.xzyw * sh.zzww; float3 g0 = float3( a0.xy, h.x ); float3 g1 = float3( a0.zw, h.y ); float3 g2 = float3( a1.xy, h.z ); float3 g3 = float3( a1.zw, h.w ); float4 norm = taylorInvSqrt( float4( dot( g0, g0 ), dot( g1, g1 ), dot( g2, g2 ), dot( g3, g3 ) ) ); g0 *= norm.x; g1 *= norm.y; g2 *= norm.z; g3 *= norm.w; float4 m = max( 0.6 - float4( dot( x0, x0 ), dot( x1, x1 ), dot( x2, x2 ), dot( x3, x3 ) ), 0.0 ); m = m* m; m = m* m; float4 px = float4( dot( x0, g0 ), dot( x1, g1 ), dot( x2, g2 ), dot( x3, g3 ) ); return 42.0 * dot( m, px); } float3 mod2D289( float3 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; } float2 mod2D289( float2 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; } float3 permute( float3 x ) { return mod2D289( ( ( x * 34.0 ) + 1.0 ) * x ); } float snoise( float2 v ) { const float4 C = float4( 0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439 ); float2 i = floor( v + dot( v, C.yy ) ); float2 x0 = v - i + dot( i, C.xx ); float2 i1; i1 = ( x0.x > x0.y ) ? float2( 1.0, 0.0 ) : float2( 0.0, 1.0 ); float4 x12 = x0.xyxy + C.xxzz; x12.xy -= i1; i = mod2D289( i ); float3 p = permute( permute( i.y + float3( 0.0, i1.y, 1.0 ) ) + i.x + float3( 0.0, i1.x, 1.0 ) ); float3 m = max( 0.5 - float3( dot( x0, x0 ), dot( x12.xy, x12.xy ), dot( x12.zw, x12.zw ) ), 0.0 ); m = m * m; m = m * m; float3 x = 2.0 * frac( p * C.www ) - 1.0; float3 h = abs( x ) - 0.5; float3 ox = floor( x + 0.5 ); float3 a0 = x - ox; m *= 1.79284291400159 - 0.85373472095314 * ( a0 * a0 + h * h ); float3 g; g.x = a0.x * x0.x + h.x * x0.y; g.yz = a0.yz * x12.xz + h.yz * x12.yw; return 130.0 * dot( m, g ); } PackedVaryings VertexFunction( Attributes input ) { PackedVaryings output = (PackedVaryings)0; UNITY_SETUP_INSTANCE_ID(input); UNITY_TRANSFER_INSTANCE_ID(input, output); UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); float3 ase_positionWS = TransformObjectToWorld( ( input.positionOS ).xyz ); float mulTime34 = _TimeParameters.x * ( RAYGlobalWindForce * ( _WindForce * 5 ) ); float simplePerlin3D35 = snoise( ( ase_positionWS + mulTime34 )*( ( 1.0 - _WindWavesScale ) * RAYGlobalWavesScale ) ); simplePerlin3D35 = simplePerlin3D35*0.5 + 0.5; float saferPower940 = abs( simplePerlin3D35 ); float temp_output_231_0 = ( pow( saferPower940 , ( _WindFlowDensity * RAYGlobalFlowDensity ) ) * 0.01 ); float2 texCoord357 = input.texcoord.xy * float2( 1,1 ) + float2( 0,0 ); float saferPower356 = abs( texCoord357.y ); float lerpResult1020 = lerp( temp_output_231_0 , ( temp_output_231_0 * pow( saferPower356 , 1.5 ) ) , _UVBaseLock); float4 transform916 = mul(GetWorldToObjectMatrix(),float4( ( RAYGlobalDirection * ( lerpResult1020 * input.ase_color.r * ( ( _WindForce * 100 ) * RAYGlobalWindForce ) ) ) , 0.0 )); #ifdef _ENABLEWIND_ON float4 staticSwitch341 = transform916; #else float4 staticSwitch341 = float4( 0,0,0,0 ); #endif float4 Wind191 = staticSwitch341; float smoothstepResult1117 = smoothstep( 1.01 , ( 1.0 - _GrassFade ) , ( length( ( _WorldSpaceCameraPos - ase_positionWS ) ) / _GrassFadeDistance )); float lerpResult1023 = lerp( 1.0 , saturate( smoothstepResult1117 ) , _GrassDistanceFadeEnable); float GrassDistanceFadeMask982 = lerpResult1023; float4 lerpResult1065 = lerp( float4( ( input.positionOS.xyz * -1 ) , 0.0 ) , Wind191 , GrassDistanceFadeMask982); float3 lerpResult1096 = lerp( input.normalOS , float3( 0, 1, 0 ) , _LightingFlatness); float3 LightingFlatness1101 = lerpResult1096; output.ase_texcoord6.xy = input.texcoord.xy; output.ase_texcoord7 = input.positionOS; //setting value to unused interpolator channels and avoid initialization warnings output.ase_texcoord6.zw = 0; #ifdef ASE_ABSOLUTE_VERTEX_POS float3 defaultVertexValue = input.positionOS.xyz; #else float3 defaultVertexValue = float3(0, 0, 0); #endif float3 vertexValue = lerpResult1065.xyz; #ifdef ASE_ABSOLUTE_VERTEX_POS input.positionOS.xyz = vertexValue; #else input.positionOS.xyz += vertexValue; #endif input.normalOS = LightingFlatness1101; input.tangentOS = input.tangentOS; VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz ); VertexNormalInputs normalInput = GetVertexNormalInputs( input.normalOS, input.tangentOS ); #if defined(LIGHTMAP_ON) OUTPUT_LIGHTMAP_UV(input.texcoord1, unity_LightmapST, output.lightmapUVOrVertexSH.xy); #else OUTPUT_SH(normalInput.normalWS.xyz, output.lightmapUVOrVertexSH.xyz); #endif #if defined(DYNAMICLIGHTMAP_ON) output.dynamicLightmapUV.xy = input.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; #endif #if defined(ASE_FOG) || defined(_ADDITIONAL_LIGHTS_VERTEX) output.fogFactorAndVertexLight = 0; #if defined(ASE_FOG) && !defined(_FOG_FRAGMENT) // @diogo: no fog applied in GBuffer #endif #ifdef _ADDITIONAL_LIGHTS_VERTEX half3 vertexLight = VertexLighting( vertexInput.positionWS, normalInput.normalWS ); output.fogFactorAndVertexLight.yzw = vertexLight; #endif #endif output.positionCS = vertexInput.positionCS; output.positionWS = vertexInput.positionWS; output.normalWS = normalInput.normalWS; output.tangentWS = float4( normalInput.tangentWS, ( input.tangentOS.w > 0.0 ? 1.0 : -1.0 ) * GetOddNegativeScale() ); #if defined( ENABLE_TERRAIN_PERPIXEL_NORMAL ) output.tangentWS.zw = input.texcoord.xy; output.tangentWS.xy = input.texcoord.xy * unity_LightmapST.xy + unity_LightmapST.zw; #endif return output; } #if defined(ASE_TESSELLATION) struct VertexControl { float4 positionOS : INTERNALTESSPOS; half3 normalOS : NORMAL; half4 tangentOS : TANGENT; float4 texcoord : TEXCOORD0; #if defined(LIGHTMAP_ON) || defined(ASE_NEEDS_TEXTURE_COORDINATES1) float4 texcoord1 : TEXCOORD1; #endif #if defined(DYNAMICLIGHTMAP_ON) || defined(ASE_NEEDS_TEXTURE_COORDINATES2) float4 texcoord2 : TEXCOORD2; #endif float4 ase_color : COLOR; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct TessellationFactors { float edge[3] : SV_TessFactor; float inside : SV_InsideTessFactor; }; VertexControl vert ( Attributes input ) { VertexControl output; UNITY_SETUP_INSTANCE_ID(input); UNITY_TRANSFER_INSTANCE_ID(input, output); output.positionOS = input.positionOS; output.normalOS = input.normalOS; output.tangentOS = input.tangentOS; output.texcoord = input.texcoord; #if defined(LIGHTMAP_ON) || defined(ASE_NEEDS_TEXTURE_COORDINATES1) output.texcoord1 = input.texcoord1; #endif #if defined(DYNAMICLIGHTMAP_ON) || defined(ASE_NEEDS_TEXTURE_COORDINATES2) output.texcoord2 = input.texcoord2; #endif output.ase_color = input.ase_color; return output; } TessellationFactors TessellationFunction (InputPatch input) { TessellationFactors output; 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(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); #elif defined(ASE_LENGTH_TESSELLATION) tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); #elif defined(ASE_LENGTH_CULL_TESSELLATION) tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); #endif output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w; return output; } [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")] PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) { Attributes output = (Attributes) 0; output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; output.tangentOS = patch[0].tangentOS * bary.x + patch[1].tangentOS * bary.y + patch[2].tangentOS * bary.z; output.texcoord = patch[0].texcoord * bary.x + patch[1].texcoord * bary.y + patch[2].texcoord * bary.z; #if defined(LIGHTMAP_ON) || defined(ASE_NEEDS_TEXTURE_COORDINATES1) output.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z; #endif #if defined(DYNAMICLIGHTMAP_ON) || defined(ASE_NEEDS_TEXTURE_COORDINATES2) output.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z; #endif output.ase_color = patch[0].ase_color * bary.x + patch[1].ase_color * bary.y + patch[2].ase_color * bary.z; #if defined(ASE_PHONG_TESSELLATION) float3 pp[3]; for (int i = 0; i < 3; ++i) pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); float phongStrength = _TessPhongStrength; output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz; #endif UNITY_TRANSFER_INSTANCE_ID(patch[0], output); return VertexFunction(output); } #else PackedVaryings vert ( Attributes input ) { return VertexFunction( input ); } #endif FragmentOutput frag ( PackedVaryings input #if defined( ASE_DEPTH_WRITE_ON ) ,out float outputDepth : ASE_SV_DEPTH #endif ) { UNITY_SETUP_INSTANCE_ID(input); UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); #if defined(LOD_FADE_CROSSFADE) LODFadeCrossFade( input.positionCS ); #endif #if defined(MAIN_LIGHT_CALCULATE_SHADOWS) float4 shadowCoord = TransformWorldToShadowCoord( input.positionWS ); #else float4 shadowCoord = float4(0, 0, 0, 0); #endif // @diogo: mikktspace compliant float renormFactor = 1.0 / max( FLT_MIN, length( input.normalWS ) ); float3 PositionWS = input.positionWS; float3 PositionRWS = GetCameraRelativePositionWS( PositionWS ); float3 ViewDirWS = GetWorldSpaceNormalizeViewDir( PositionWS ); float4 ShadowCoord = shadowCoord; float4 ScreenPosNorm = float4( GetNormalizedScreenSpaceUV( input.positionCS ), input.positionCS.zw ); float4 ClipPos = ComputeClipSpacePosition( ScreenPosNorm.xy, input.positionCS.z ) * input.positionCS.w; float4 ScreenPos = ComputeScreenPos( ClipPos ); float3 TangentWS = input.tangentWS.xyz * renormFactor; float3 BitangentWS = cross( input.normalWS, input.tangentWS.xyz ) * input.tangentWS.w * renormFactor; float3 NormalWS = input.normalWS * renormFactor; #if defined( ENABLE_TERRAIN_PERPIXEL_NORMAL ) float2 sampleCoords = (input.tangentWS.zw / _TerrainHeightmapRecipSize.zw + 0.5f) * _TerrainHeightmapRecipSize.xy; NormalWS = TransformObjectToWorldNormal(normalize(SAMPLE_TEXTURE2D(_TerrainNormalmapTexture, sampler_TerrainNormalmapTexture, sampleCoords).rgb * 2 - 1)); TangentWS = -cross(GetObjectToWorldMatrix()._13_23_33, NormalWS); BitangentWS = cross(NormalWS, -TangentWS); #endif float2 temp_cast_0 = (_Tiling).xx; float2 texCoord1028 = input.ase_texcoord6.xy * temp_cast_0 + float2( 0,0 ); float2 Tiling1032 = texCoord1028; float4 tex2DNode1 = tex2D( _Albedo, Tiling1032 ); float4 temp_output_10_0 = ( _MainColor * tex2DNode1 ); float simplePerlin2D742 = snoise( (PositionWS).xz*_WorldNoiseScale ); simplePerlin2D742 = simplePerlin2D742*0.5 + 0.5; float simplePerlin3D1015 = snoise( PositionWS*_WorldNoiseScale ); simplePerlin3D1015 = simplePerlin3D1015*0.5 + 0.5; float2 texCoord361 = input.ase_texcoord6.xy * float2( 1,1 ) + float2( 0,0 ); #if defined( _SECONDCOLOROVERLAYTYPE_WORLD_NOISE_2D ) float staticSwitch360 = simplePerlin2D742; #elif defined( _SECONDCOLOROVERLAYTYPE_WORLD_NOISE_3D ) float staticSwitch360 = simplePerlin3D1015; #elif defined( _SECONDCOLOROVERLAYTYPE_VERTEX_GRADIENT ) float staticSwitch360 = input.ase_texcoord7.xyz.y; #elif defined( _SECONDCOLOROVERLAYTYPE_UV_GRADIENT ) float staticSwitch360 = texCoord361.y; #else float staticSwitch360 = simplePerlin2D742; #endif float temp_output_875_0 = ( staticSwitch360 + ( 1.0 - _SecondColorOffset ) ); float lerpResult1025 = lerp( temp_output_875_0 , ( 1.0 - temp_output_875_0 ) , ( _SecondColorFade - -0.5 )); float SecondColorMask335 = saturate( lerpResult1025 ); float4 lerpResult332 = lerp( temp_output_10_0 , ( _SecondColor * tex2D( _Albedo, Tiling1032 ) ) , SecondColorMask335); #ifdef _COLOR2ENABLE_ON float4 staticSwitch1022 = lerpResult332; #else float4 staticSwitch1022 = temp_output_10_0; #endif float4 Albedo259 = staticSwitch1022; float3 unpack886 = UnpackNormalScale( tex2D( _Normal, Tiling1032 ), _NormalScale ); unpack886.z = lerp( 1, unpack886.z, saturate(_NormalScale) ); float3 Normal888 = unpack886; float Smoothness734 = saturate( ( tex2D( _SmoothnessTexture, Tiling1032 ).g * _Smoothness ) ); float AlbedoAlpha263 = tex2DNode1.a; float3 BaseColor = Albedo259.rgb; float3 Normal = Normal888; float3 Specular = 0.5; float Metallic = 0; float Smoothness = Smoothness734; float Occlusion = 1; float3 Emission = 0; float Alpha = AlbedoAlpha263; float AlphaClipThreshold = _AlphaCutoff; float AlphaClipThresholdShadow = 0.5; float3 BakedGI = 0; float3 RefractionColor = 1; float RefractionIndex = 1; float3 Transmission = 1; float3 Translucency = 1; #if defined( ASE_DEPTH_WRITE_ON ) float DeviceDepth = ClipPos.z; #endif #if defined( _ALPHATEST_ON ) AlphaDiscard( Alpha, AlphaClipThreshold ); #endif #if defined(MAIN_LIGHT_CALCULATE_SHADOWS) && defined(ASE_CHANGES_WORLD_POS) ShadowCoord = TransformWorldToShadowCoord( PositionWS ); #endif InputData inputData = (InputData)0; inputData.positionWS = PositionWS; inputData.positionCS = float4( input.positionCS.xy, ClipPos.zw / ClipPos.w ); inputData.normalizedScreenSpaceUV = ScreenPosNorm.xy; inputData.shadowCoord = ShadowCoord; #ifdef _NORMALMAP #if _NORMAL_DROPOFF_TS inputData.normalWS = TransformTangentToWorld(Normal, half3x3( TangentWS, BitangentWS, NormalWS )); #elif _NORMAL_DROPOFF_OS inputData.normalWS = TransformObjectToWorldNormal(Normal); #elif _NORMAL_DROPOFF_WS inputData.normalWS = Normal; #endif #else inputData.normalWS = NormalWS; #endif inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS); inputData.viewDirectionWS = SafeNormalize( ViewDirWS ); #ifdef ASE_FOG // @diogo: no fog applied in GBuffer #endif #ifdef _ADDITIONAL_LIGHTS_VERTEX inputData.vertexLighting = input.fogFactorAndVertexLight.yzw; #endif #if defined( ENABLE_TERRAIN_PERPIXEL_NORMAL ) float3 SH = SampleSH(inputData.normalWS.xyz); #else float3 SH = input.lightmapUVOrVertexSH.xyz; #endif #if defined(DYNAMICLIGHTMAP_ON) inputData.bakedGI = SAMPLE_GI(input.lightmapUVOrVertexSH.xy, input.dynamicLightmapUV.xy, SH, inputData.normalWS); #else inputData.bakedGI = SAMPLE_GI(input.lightmapUVOrVertexSH.xy, SH, inputData.normalWS); #endif #ifdef ASE_BAKEDGI inputData.bakedGI = BakedGI; #endif inputData.shadowMask = SAMPLE_SHADOWMASK(input.lightmapUVOrVertexSH.xy); #if defined(DEBUG_DISPLAY) #if defined(DYNAMICLIGHTMAP_ON) inputData.dynamicLightmapUV = input.dynamicLightmapUV.xy; #endif #if defined(LIGHTMAP_ON) inputData.staticLightmapUV = input.lightmapUVOrVertexSH.xy; #else inputData.vertexSH = SH; #endif #endif #ifdef _DBUFFER ApplyDecal(input.positionCS, BaseColor, Specular, inputData.normalWS, Metallic, Occlusion, Smoothness); #endif BRDFData brdfData; InitializeBRDFData(BaseColor, Metallic, Specular, Smoothness, Alpha, brdfData); Light mainLight = GetMainLight(inputData.shadowCoord, inputData.positionWS, inputData.shadowMask); half4 color; MixRealtimeAndBakedGI(mainLight, inputData.normalWS, inputData.bakedGI, inputData.shadowMask); color.rgb = GlobalIllumination(brdfData, inputData.bakedGI, Occlusion, inputData.positionWS, inputData.normalWS, inputData.viewDirectionWS); color.a = Alpha; #ifdef ASE_FINAL_COLOR_ALPHA_MULTIPLY color.rgb *= color.a; #endif #if defined( ASE_DEPTH_WRITE_ON ) outputDepth = DeviceDepth; #endif return BRDFDataToGbuffer(brdfData, inputData, Smoothness, Emission + color.rgb, Occlusion); } ENDHLSL } Pass { Name "SceneSelectionPass" Tags { "LightMode"="SceneSelectionPass" } Cull Off AlphaToMask Off HLSLPROGRAM #define ASE_GEOMETRY #define _NORMAL_DROPOFF_TS 1 #define ASE_FOG 1 #pragma multi_compile_fragment _ DEBUG_DISPLAY #define _NORMALMAP 1 #define ASE_VERSION 19904 #define ASE_SRP_VERSION 140011 #pragma vertex vert #pragma fragment frag #if defined(_SPECULAR_SETUP) && defined(ASE_LIGHTING_SIMPLE) #define _SPECULAR_COLOR 1 #endif #define SCENESELECTIONPASS 1 #define ATTRIBUTES_NEED_NORMAL #define ATTRIBUTES_NEED_TANGENT #define SHADERPASS SHADERPASS_DEPTHONLY #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" #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/Input.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" #if ASE_SRP_VERSION >=140009 #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" #endif #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" #if ASE_SRP_VERSION >=140007 #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" #endif #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" #define ASE_NEEDS_VERT_POSITION #define ASE_NEEDS_TEXTURE_COORDINATES0 #define ASE_NEEDS_VERT_NORMAL #pragma shader_feature_local _ENABLEWIND_ON #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) && (SHADER_TARGET >= 45) #define ASE_SV_DEPTH SV_DepthLessEqual #define ASE_SV_POSITION_QUALIFIERS linear noperspective centroid #else #define ASE_SV_DEPTH SV_Depth #define ASE_SV_POSITION_QUALIFIERS #endif struct Attributes { float4 positionOS : POSITION; half3 normalOS : NORMAL; half4 tangentOS : TANGENT; float4 ase_texcoord : TEXCOORD0; float4 ase_color : COLOR; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct PackedVaryings { ASE_SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION; float3 positionWS : TEXCOORD0; float4 ase_texcoord1 : TEXCOORD1; UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO }; CBUFFER_START(UnityPerMaterial) float4 _MainColor; float4 _SecondColor; float _NormalScale; float _SecondColorFade; float _SecondColorOffset; float _WorldNoiseScale; float _Tiling; float _Smoothness; float _WindForce; float _GrassDistanceFadeEnable; float _GrassFadeDistance; float _GrassFade; float _UVBaseLock; float _WindFlowDensity; float _WindWavesScale; float _LightingFlatness; float _AlphaCutoff; #ifdef ASE_TRANSMISSION float _TransmissionShadow; #endif #ifdef ASE_TRANSLUCENCY float _TransStrength; float _TransNormal; float _TransScattering; float _TransDirect; float _TransAmbient; float _TransShadow; #endif #ifdef ASE_TESSELLATION float _TessPhongStrength; float _TessValue; float _TessMin; float _TessMax; float _TessEdgeLength; float _TessMaxDisp; #endif CBUFFER_END #ifdef SCENEPICKINGPASS float4 _SelectionID; #endif #ifdef SCENESELECTIONPASS int _ObjectId; int _PassValue; #endif float3 RAYGlobalDirection; float RAYGlobalWavesScale; float RAYGlobalFlowDensity; float RAYGlobalWindForce; sampler2D _Albedo; float3 mod3D289( float3 x ) { return x - floor( x / 289.0 ) * 289.0; } float4 mod3D289( float4 x ) { return x - floor( x / 289.0 ) * 289.0; } float4 permute( float4 x ) { return mod3D289( ( x * 34.0 + 1.0 ) * x ); } float4 taylorInvSqrt( float4 r ) { return 1.79284291400159 - r * 0.85373472095314; } float snoise( float3 v ) { const float2 C = float2( 1.0 / 6.0, 1.0 / 3.0 ); float3 i = floor( v + dot( v, C.yyy ) ); float3 x0 = v - i + dot( i, C.xxx ); float3 g = step( x0.yzx, x0.xyz ); float3 l = 1.0 - g; float3 i1 = min( g.xyz, l.zxy ); float3 i2 = max( g.xyz, l.zxy ); float3 x1 = x0 - i1 + C.xxx; float3 x2 = x0 - i2 + C.yyy; float3 x3 = x0 - 0.5; i = mod3D289( i); float4 p = permute( permute( permute( i.z + float4( 0.0, i1.z, i2.z, 1.0 ) ) + i.y + float4( 0.0, i1.y, i2.y, 1.0 ) ) + i.x + float4( 0.0, i1.x, i2.x, 1.0 ) ); float4 j = p - 49.0 * floor( p / 49.0 ); // mod(p,7*7) float4 x_ = floor( j / 7.0 ); float4 y_ = floor( j - 7.0 * x_ ); // mod(j,N) float4 x = ( x_ * 2.0 + 0.5 ) / 7.0 - 1.0; float4 y = ( y_ * 2.0 + 0.5 ) / 7.0 - 1.0; float4 h = 1.0 - abs( x ) - abs( y ); float4 b0 = float4( x.xy, y.xy ); float4 b1 = float4( x.zw, y.zw ); float4 s0 = floor( b0 ) * 2.0 + 1.0; float4 s1 = floor( b1 ) * 2.0 + 1.0; float4 sh = -step( h, 0.0 ); float4 a0 = b0.xzyw + s0.xzyw * sh.xxyy; float4 a1 = b1.xzyw + s1.xzyw * sh.zzww; float3 g0 = float3( a0.xy, h.x ); float3 g1 = float3( a0.zw, h.y ); float3 g2 = float3( a1.xy, h.z ); float3 g3 = float3( a1.zw, h.w ); float4 norm = taylorInvSqrt( float4( dot( g0, g0 ), dot( g1, g1 ), dot( g2, g2 ), dot( g3, g3 ) ) ); g0 *= norm.x; g1 *= norm.y; g2 *= norm.z; g3 *= norm.w; float4 m = max( 0.6 - float4( dot( x0, x0 ), dot( x1, x1 ), dot( x2, x2 ), dot( x3, x3 ) ), 0.0 ); m = m* m; m = m* m; float4 px = float4( dot( x0, g0 ), dot( x1, g1 ), dot( x2, g2 ), dot( x3, g3 ) ); return 42.0 * dot( m, px); } struct SurfaceDescription { float Alpha; float AlphaClipThreshold; }; PackedVaryings VertexFunction(Attributes input ) { PackedVaryings output; ZERO_INITIALIZE(PackedVaryings, output); UNITY_SETUP_INSTANCE_ID(input); UNITY_TRANSFER_INSTANCE_ID(input, output); UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); float3 ase_positionWS = TransformObjectToWorld( ( input.positionOS ).xyz ); float mulTime34 = _TimeParameters.x * ( RAYGlobalWindForce * ( _WindForce * 5 ) ); float simplePerlin3D35 = snoise( ( ase_positionWS + mulTime34 )*( ( 1.0 - _WindWavesScale ) * RAYGlobalWavesScale ) ); simplePerlin3D35 = simplePerlin3D35*0.5 + 0.5; float saferPower940 = abs( simplePerlin3D35 ); float temp_output_231_0 = ( pow( saferPower940 , ( _WindFlowDensity * RAYGlobalFlowDensity ) ) * 0.01 ); float2 texCoord357 = input.ase_texcoord.xy * float2( 1,1 ) + float2( 0,0 ); float saferPower356 = abs( texCoord357.y ); float lerpResult1020 = lerp( temp_output_231_0 , ( temp_output_231_0 * pow( saferPower356 , 1.5 ) ) , _UVBaseLock); float4 transform916 = mul(GetWorldToObjectMatrix(),float4( ( RAYGlobalDirection * ( lerpResult1020 * input.ase_color.r * ( ( _WindForce * 100 ) * RAYGlobalWindForce ) ) ) , 0.0 )); #ifdef _ENABLEWIND_ON float4 staticSwitch341 = transform916; #else float4 staticSwitch341 = float4( 0,0,0,0 ); #endif float4 Wind191 = staticSwitch341; float smoothstepResult1117 = smoothstep( 1.01 , ( 1.0 - _GrassFade ) , ( length( ( _WorldSpaceCameraPos - ase_positionWS ) ) / _GrassFadeDistance )); float lerpResult1023 = lerp( 1.0 , saturate( smoothstepResult1117 ) , _GrassDistanceFadeEnable); float GrassDistanceFadeMask982 = lerpResult1023; float4 lerpResult1065 = lerp( float4( ( input.positionOS.xyz * -1 ) , 0.0 ) , Wind191 , GrassDistanceFadeMask982); float3 lerpResult1096 = lerp( input.normalOS , float3( 0, 1, 0 ) , _LightingFlatness); float3 LightingFlatness1101 = lerpResult1096; output.ase_texcoord1.xy = input.ase_texcoord.xy; //setting value to unused interpolator channels and avoid initialization warnings output.ase_texcoord1.zw = 0; #ifdef ASE_ABSOLUTE_VERTEX_POS float3 defaultVertexValue = input.positionOS.xyz; #else float3 defaultVertexValue = float3(0, 0, 0); #endif float3 vertexValue = lerpResult1065.xyz; #ifdef ASE_ABSOLUTE_VERTEX_POS input.positionOS.xyz = vertexValue; #else input.positionOS.xyz += vertexValue; #endif input.normalOS = LightingFlatness1101; VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz ); output.positionCS = vertexInput.positionCS; output.positionWS = vertexInput.positionWS; return output; } #if defined(ASE_TESSELLATION) struct VertexControl { float4 positionOS : INTERNALTESSPOS; half3 normalOS : NORMAL; half4 tangentOS : TANGENT; float4 ase_texcoord : TEXCOORD0; float4 ase_color : COLOR; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct TessellationFactors { float edge[3] : SV_TessFactor; float inside : SV_InsideTessFactor; }; VertexControl vert ( Attributes input ) { VertexControl output; UNITY_SETUP_INSTANCE_ID(input); UNITY_TRANSFER_INSTANCE_ID(input, output); output.positionOS = input.positionOS; output.normalOS = input.normalOS; output.tangentOS = input.tangentOS; output.ase_texcoord = input.ase_texcoord; output.ase_color = input.ase_color; return output; } TessellationFactors TessellationFunction (InputPatch input) { TessellationFactors output; 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(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); #elif defined(ASE_LENGTH_TESSELLATION) tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); #elif defined(ASE_LENGTH_CULL_TESSELLATION) tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); #endif output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w; return output; } [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")] PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) { Attributes output = (Attributes) 0; output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; output.tangentOS = patch[0].tangentOS * bary.x + patch[1].tangentOS * bary.y + patch[2].tangentOS * bary.z; output.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; output.ase_color = patch[0].ase_color * bary.x + patch[1].ase_color * bary.y + patch[2].ase_color * bary.z; #if defined(ASE_PHONG_TESSELLATION) float3 pp[3]; for (int i = 0; i < 3; ++i) pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); float phongStrength = _TessPhongStrength; output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz; #endif UNITY_TRANSFER_INSTANCE_ID(patch[0], output); return VertexFunction(output); } #else PackedVaryings vert ( Attributes input ) { return VertexFunction( input ); } #endif half4 frag( PackedVaryings input #if defined( ASE_DEPTH_WRITE_ON ) ,out float outputDepth : ASE_SV_DEPTH #endif ) : SV_Target { SurfaceDescription surfaceDescription = (SurfaceDescription)0; float3 PositionWS = input.positionWS; float3 PositionRWS = GetCameraRelativePositionWS( PositionWS ); float4 ScreenPosNorm = float4( GetNormalizedScreenSpaceUV( input.positionCS ), input.positionCS.zw ); float4 ClipPos = ComputeClipSpacePosition( ScreenPosNorm.xy, input.positionCS.z ) * input.positionCS.w; float2 temp_cast_0 = (_Tiling).xx; float2 texCoord1028 = input.ase_texcoord1.xy * temp_cast_0 + float2( 0,0 ); float2 Tiling1032 = texCoord1028; float4 tex2DNode1 = tex2D( _Albedo, Tiling1032 ); float AlbedoAlpha263 = tex2DNode1.a; surfaceDescription.Alpha = AlbedoAlpha263; surfaceDescription.AlphaClipThreshold = _AlphaCutoff; #if defined( ASE_DEPTH_WRITE_ON ) float DeviceDepth = input.positionCS.z; #endif #if _ALPHATEST_ON float alphaClipThreshold = 0.01f; #if ALPHA_CLIP_THRESHOLD alphaClipThreshold = surfaceDescription.AlphaClipThreshold; #endif clip(surfaceDescription.Alpha - alphaClipThreshold); #endif #if defined( ASE_DEPTH_WRITE_ON ) outputDepth = DeviceDepth; #endif return half4( _ObjectId, _PassValue, 1.0, 1.0 ); } ENDHLSL } Pass { Name "ScenePickingPass" Tags { "LightMode"="Picking" } AlphaToMask Off HLSLPROGRAM #define ASE_GEOMETRY #define _NORMAL_DROPOFF_TS 1 #define ASE_FOG 1 #pragma multi_compile_fragment _ DEBUG_DISPLAY #define _NORMALMAP 1 #define ASE_VERSION 19904 #define ASE_SRP_VERSION 140011 #pragma vertex vert #pragma fragment frag #if defined(_SPECULAR_SETUP) && defined(ASE_LIGHTING_SIMPLE) #define _SPECULAR_COLOR 1 #endif #define SCENEPICKINGPASS 1 #define ATTRIBUTES_NEED_NORMAL #define ATTRIBUTES_NEED_TANGENT #define SHADERPASS SHADERPASS_DEPTHONLY #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" #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/Input.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" #if ASE_SRP_VERSION >=140009 #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" #endif #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" #if ASE_SRP_VERSION >=140007 #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" #endif #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" #define ASE_NEEDS_VERT_POSITION #define ASE_NEEDS_TEXTURE_COORDINATES0 #define ASE_NEEDS_VERT_NORMAL #pragma shader_feature_local _ENABLEWIND_ON #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) && (SHADER_TARGET >= 45) #define ASE_SV_DEPTH SV_DepthLessEqual #define ASE_SV_POSITION_QUALIFIERS linear noperspective centroid #else #define ASE_SV_DEPTH SV_Depth #define ASE_SV_POSITION_QUALIFIERS #endif struct Attributes { float4 positionOS : POSITION; half3 normalOS : NORMAL; half4 tangentOS : TANGENT; float4 ase_texcoord : TEXCOORD0; float4 ase_color : COLOR; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct PackedVaryings { ASE_SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION; float3 positionWS : TEXCOORD0; float4 ase_texcoord1 : TEXCOORD1; UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO }; CBUFFER_START(UnityPerMaterial) float4 _MainColor; float4 _SecondColor; float _NormalScale; float _SecondColorFade; float _SecondColorOffset; float _WorldNoiseScale; float _Tiling; float _Smoothness; float _WindForce; float _GrassDistanceFadeEnable; float _GrassFadeDistance; float _GrassFade; float _UVBaseLock; float _WindFlowDensity; float _WindWavesScale; float _LightingFlatness; float _AlphaCutoff; #ifdef ASE_TRANSMISSION float _TransmissionShadow; #endif #ifdef ASE_TRANSLUCENCY float _TransStrength; float _TransNormal; float _TransScattering; float _TransDirect; float _TransAmbient; float _TransShadow; #endif #ifdef ASE_TESSELLATION float _TessPhongStrength; float _TessValue; float _TessMin; float _TessMax; float _TessEdgeLength; float _TessMaxDisp; #endif CBUFFER_END #ifdef SCENEPICKINGPASS float4 _SelectionID; #endif #ifdef SCENESELECTIONPASS int _ObjectId; int _PassValue; #endif float3 RAYGlobalDirection; float RAYGlobalWavesScale; float RAYGlobalFlowDensity; float RAYGlobalWindForce; sampler2D _Albedo; float3 mod3D289( float3 x ) { return x - floor( x / 289.0 ) * 289.0; } float4 mod3D289( float4 x ) { return x - floor( x / 289.0 ) * 289.0; } float4 permute( float4 x ) { return mod3D289( ( x * 34.0 + 1.0 ) * x ); } float4 taylorInvSqrt( float4 r ) { return 1.79284291400159 - r * 0.85373472095314; } float snoise( float3 v ) { const float2 C = float2( 1.0 / 6.0, 1.0 / 3.0 ); float3 i = floor( v + dot( v, C.yyy ) ); float3 x0 = v - i + dot( i, C.xxx ); float3 g = step( x0.yzx, x0.xyz ); float3 l = 1.0 - g; float3 i1 = min( g.xyz, l.zxy ); float3 i2 = max( g.xyz, l.zxy ); float3 x1 = x0 - i1 + C.xxx; float3 x2 = x0 - i2 + C.yyy; float3 x3 = x0 - 0.5; i = mod3D289( i); float4 p = permute( permute( permute( i.z + float4( 0.0, i1.z, i2.z, 1.0 ) ) + i.y + float4( 0.0, i1.y, i2.y, 1.0 ) ) + i.x + float4( 0.0, i1.x, i2.x, 1.0 ) ); float4 j = p - 49.0 * floor( p / 49.0 ); // mod(p,7*7) float4 x_ = floor( j / 7.0 ); float4 y_ = floor( j - 7.0 * x_ ); // mod(j,N) float4 x = ( x_ * 2.0 + 0.5 ) / 7.0 - 1.0; float4 y = ( y_ * 2.0 + 0.5 ) / 7.0 - 1.0; float4 h = 1.0 - abs( x ) - abs( y ); float4 b0 = float4( x.xy, y.xy ); float4 b1 = float4( x.zw, y.zw ); float4 s0 = floor( b0 ) * 2.0 + 1.0; float4 s1 = floor( b1 ) * 2.0 + 1.0; float4 sh = -step( h, 0.0 ); float4 a0 = b0.xzyw + s0.xzyw * sh.xxyy; float4 a1 = b1.xzyw + s1.xzyw * sh.zzww; float3 g0 = float3( a0.xy, h.x ); float3 g1 = float3( a0.zw, h.y ); float3 g2 = float3( a1.xy, h.z ); float3 g3 = float3( a1.zw, h.w ); float4 norm = taylorInvSqrt( float4( dot( g0, g0 ), dot( g1, g1 ), dot( g2, g2 ), dot( g3, g3 ) ) ); g0 *= norm.x; g1 *= norm.y; g2 *= norm.z; g3 *= norm.w; float4 m = max( 0.6 - float4( dot( x0, x0 ), dot( x1, x1 ), dot( x2, x2 ), dot( x3, x3 ) ), 0.0 ); m = m* m; m = m* m; float4 px = float4( dot( x0, g0 ), dot( x1, g1 ), dot( x2, g2 ), dot( x3, g3 ) ); return 42.0 * dot( m, px); } struct SurfaceDescription { float Alpha; float AlphaClipThreshold; }; PackedVaryings VertexFunction( Attributes input ) { PackedVaryings output; ZERO_INITIALIZE(PackedVaryings, output); UNITY_SETUP_INSTANCE_ID(input); UNITY_TRANSFER_INSTANCE_ID(input, output); UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); float3 ase_positionWS = TransformObjectToWorld( ( input.positionOS ).xyz ); float mulTime34 = _TimeParameters.x * ( RAYGlobalWindForce * ( _WindForce * 5 ) ); float simplePerlin3D35 = snoise( ( ase_positionWS + mulTime34 )*( ( 1.0 - _WindWavesScale ) * RAYGlobalWavesScale ) ); simplePerlin3D35 = simplePerlin3D35*0.5 + 0.5; float saferPower940 = abs( simplePerlin3D35 ); float temp_output_231_0 = ( pow( saferPower940 , ( _WindFlowDensity * RAYGlobalFlowDensity ) ) * 0.01 ); float2 texCoord357 = input.ase_texcoord.xy * float2( 1,1 ) + float2( 0,0 ); float saferPower356 = abs( texCoord357.y ); float lerpResult1020 = lerp( temp_output_231_0 , ( temp_output_231_0 * pow( saferPower356 , 1.5 ) ) , _UVBaseLock); float4 transform916 = mul(GetWorldToObjectMatrix(),float4( ( RAYGlobalDirection * ( lerpResult1020 * input.ase_color.r * ( ( _WindForce * 100 ) * RAYGlobalWindForce ) ) ) , 0.0 )); #ifdef _ENABLEWIND_ON float4 staticSwitch341 = transform916; #else float4 staticSwitch341 = float4( 0,0,0,0 ); #endif float4 Wind191 = staticSwitch341; float smoothstepResult1117 = smoothstep( 1.01 , ( 1.0 - _GrassFade ) , ( length( ( _WorldSpaceCameraPos - ase_positionWS ) ) / _GrassFadeDistance )); float lerpResult1023 = lerp( 1.0 , saturate( smoothstepResult1117 ) , _GrassDistanceFadeEnable); float GrassDistanceFadeMask982 = lerpResult1023; float4 lerpResult1065 = lerp( float4( ( input.positionOS.xyz * -1 ) , 0.0 ) , Wind191 , GrassDistanceFadeMask982); float3 lerpResult1096 = lerp( input.normalOS , float3( 0, 1, 0 ) , _LightingFlatness); float3 LightingFlatness1101 = lerpResult1096; output.ase_texcoord1.xy = input.ase_texcoord.xy; //setting value to unused interpolator channels and avoid initialization warnings output.ase_texcoord1.zw = 0; #ifdef ASE_ABSOLUTE_VERTEX_POS float3 defaultVertexValue = input.positionOS.xyz; #else float3 defaultVertexValue = float3(0, 0, 0); #endif float3 vertexValue = lerpResult1065.xyz; #ifdef ASE_ABSOLUTE_VERTEX_POS input.positionOS.xyz = vertexValue; #else input.positionOS.xyz += vertexValue; #endif input.normalOS = LightingFlatness1101; VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz ); output.positionCS = vertexInput.positionCS; output.positionWS = vertexInput.positionWS; return output; } #if defined(ASE_TESSELLATION) struct VertexControl { float4 positionOS : INTERNALTESSPOS; half3 normalOS : NORMAL; half4 tangentOS : TANGENT; float4 ase_texcoord : TEXCOORD0; float4 ase_color : COLOR; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct TessellationFactors { float edge[3] : SV_TessFactor; float inside : SV_InsideTessFactor; }; VertexControl vert ( Attributes input ) { VertexControl output; UNITY_SETUP_INSTANCE_ID(input); UNITY_TRANSFER_INSTANCE_ID(input, output); output.positionOS = input.positionOS; output.normalOS = input.normalOS; output.tangentOS = input.tangentOS; output.ase_texcoord = input.ase_texcoord; output.ase_color = input.ase_color; return output; } TessellationFactors TessellationFunction (InputPatch input) { TessellationFactors output; 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(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); #elif defined(ASE_LENGTH_TESSELLATION) tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); #elif defined(ASE_LENGTH_CULL_TESSELLATION) tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); #endif output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w; return output; } [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")] PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) { Attributes output = (Attributes) 0; output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; output.tangentOS = patch[0].tangentOS * bary.x + patch[1].tangentOS * bary.y + patch[2].tangentOS * bary.z; output.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; output.ase_color = patch[0].ase_color * bary.x + patch[1].ase_color * bary.y + patch[2].ase_color * bary.z; #if defined(ASE_PHONG_TESSELLATION) float3 pp[3]; for (int i = 0; i < 3; ++i) pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); float phongStrength = _TessPhongStrength; output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz; #endif UNITY_TRANSFER_INSTANCE_ID(patch[0], output); return VertexFunction(output); } #else PackedVaryings vert ( Attributes input ) { return VertexFunction( input ); } #endif half4 frag( PackedVaryings input #if defined( ASE_DEPTH_WRITE_ON ) ,out float outputDepth : ASE_SV_DEPTH #endif ) : SV_Target { SurfaceDescription surfaceDescription = (SurfaceDescription)0; float3 PositionWS = input.positionWS; float3 PositionRWS = GetCameraRelativePositionWS( PositionWS ); float4 ScreenPosNorm = float4( GetNormalizedScreenSpaceUV( input.positionCS ), input.positionCS.zw ); float4 ClipPos = ComputeClipSpacePosition( ScreenPosNorm.xy, input.positionCS.z ) * input.positionCS.w; float2 temp_cast_0 = (_Tiling).xx; float2 texCoord1028 = input.ase_texcoord1.xy * temp_cast_0 + float2( 0,0 ); float2 Tiling1032 = texCoord1028; float4 tex2DNode1 = tex2D( _Albedo, Tiling1032 ); float AlbedoAlpha263 = tex2DNode1.a; surfaceDescription.Alpha = AlbedoAlpha263; surfaceDescription.AlphaClipThreshold = _AlphaCutoff; #if defined( ASE_DEPTH_WRITE_ON ) float DeviceDepth = input.positionCS.z; #endif #if _ALPHATEST_ON float alphaClipThreshold = 0.01f; #if ALPHA_CLIP_THRESHOLD alphaClipThreshold = surfaceDescription.AlphaClipThreshold; #endif clip(surfaceDescription.Alpha - alphaClipThreshold); #endif #if defined( ASE_DEPTH_WRITE_ON ) outputDepth = DeviceDepth; #endif return unity_SelectionID; } ENDHLSL } } CustomEditor "UnityEditor.ShaderGraphLitGUI" FallBack "Hidden/Shader Graph/FallbackError" Fallback Off } /*ASEBEGIN Version=19904 Node;AmplifyShaderEditor.CommentaryNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;66;-5631.718,-260.3194;Inherit;False;3919.657;965.9094;;34;1066;35;1067;941;779;945;190;182;228;947;344;780;803;34;777;1021;915;775;188;359;358;341;1020;191;345;776;916;914;769;357;356;231;940;56;Wind;1,1,1,1;0;0 Node;AmplifyShaderEditor.RangedFloatNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;56;-5592.354,490.0497;Inherit;False;Property;_WindForce;Force;15;0;Create;False;0;0;0;False;1;Space(10);False;0.6696684;0.27;0;1;0;1;FLOAT;0 Node;AmplifyShaderEditor.WireNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;947;-5249.32,236.4667;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.ScaleNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;344;-5177.039,43.42474;Inherit;False;5;1;0;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;945;-5270.597,-71.62838;Inherit;False;Global;RAYGlobalWindForce;RAYGlobalWindForce;20;0;Fetch;True;0;0;0;False;0;False;0;1;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;777;-4953.549,-29.21493;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;190;-5016.729,122.1841;Inherit;False;Property;_WindWavesScale;Waves Scale;16;0;Create;False;0;0;0;False;0;False;0.25;0.47;0;1;0;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleTimeNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;34;-4789.77,-29.02846;Inherit;False;1;0;FLOAT;1;False;1;FLOAT;0 Node;AmplifyShaderEditor.OneMinusNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;803;-4723.601,122.0921;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.WorldPosInputsNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;228;-4788.961,-197.7769;Inherit;False;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 Node;AmplifyShaderEditor.RangedFloatNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;779;-4819.625,244.3927;Float;False;Global;RAYGlobalWavesScale;RAYGlobalWavesScale;23;0;Create;True;0;0;0;False;0;False;1;1;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;780;-4531.625,169.3926;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleAddOpNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;182;-4498.28,-131.7945;Inherit;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;1;FLOAT3;0 Node;AmplifyShaderEditor.RangedFloatNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;941;-4532.451,286.8994;Inherit;False;Property;_WindFlowDensity;Flow Density;17;0;Create;False;0;0;0;False;0;False;1;1;0.5;5;0;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1067;-4499.72,378.3408;Float;False;Global;RAYGlobalFlowDensity;RAYGlobalFlowDensity;23;0;Create;True;0;0;0;False;0;False;1;1;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1066;-4191.94,315.3503;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.NoiseGeneratorNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;35;-4276.886,-6.457231;Inherit;True;Simplex3D;True;False;2;0;FLOAT3;0,0,0;False;1;FLOAT;0.4;False;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;358;-3906.87,437.1895;Inherit;False;Constant;_Float0;Float 0;15;0;Create;True;0;0;0;False;0;False;1.5;2;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.TextureCoordinatesNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;357;-3972.463,307.049;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.CommentaryNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;981;-3440,-848;Inherit;False;1904.663;501.0551;;14;982;1023;1024;1095;1117;1118;1120;1113;1115;960;1111;1109;1107;1110;Grass Distance Fade Mask;1,1,1,1;0;0 Node;AmplifyShaderEditor.WorldSpaceCameraPos, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1110;-3376,-800;Inherit;False;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 Node;AmplifyShaderEditor.WorldPosInputsNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1107;-3312,-640;Inherit;False;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 Node;AmplifyShaderEditor.PowerNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;940;-3910.744,140.0812;Inherit;False;True;2;0;FLOAT;0;False;1;FLOAT;1;False;1;FLOAT;0 Node;AmplifyShaderEditor.PowerNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;356;-3708.32,384.8364;Inherit;False;True;2;0;FLOAT;0;False;1;FLOAT;1;False;1;FLOAT;0 Node;AmplifyShaderEditor.CommentaryNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1033;-3398.161,1244.392;Inherit;False;788.1025;243.0056;;3;1031;1032;1028;Tiling;1,1,1,1;0;0 Node;AmplifyShaderEditor.ScaleNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;231;-3710.768,139.7341;Inherit;False;0.01;1;0;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.ScaleNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;345;-3388.276,490.2618;Inherit;False;100;1;0;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;359;-3507.656,244.4772;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;775;-3481.333,577.2404;Float;False;Global;RAYGlobalWindForce;RAYGlobalWindForce;23;0;Create;True;0;0;0;False;0;False;1;1;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1021;-3525.292,359.9566;Inherit;False;Property;_UVBaseLock;UV Base Lock;18;1;[Toggle];Create;True;0;0;0;False;0;False;0;0;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleSubtractOpNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1109;-3040,-736;Inherit;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0 Node;AmplifyShaderEditor.RangedFloatNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1031;-3343.456,1346.191;Inherit;False;Property;_Tiling;Tiling;0;0;Create;True;0;0;0;False;2;Header(Maps);Space(5);False;1;1;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.VertexColorNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;769;-3203.848,273.3365;Inherit;False;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.SimpleMultiplyOpNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;776;-3172.288,519.1628;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.LerpOp, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1020;-3273.709,141.7515;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.LengthOpNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1111;-2848,-736;Inherit;False;1;0;FLOAT3;0,0,0;False;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;960;-2848,-640;Inherit;False;Property;_GrassFadeDistance;Distance;20;0;Create;False;0;0;0;False;1;Space(10);False;30;0;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1115;-2976,-464;Inherit;False;Property;_GrassFade;Fade;21;0;Create;False;0;0;0;False;0;False;1;0;0;1;0;1;FLOAT;0 Node;AmplifyShaderEditor.TextureCoordinatesNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1028;-3121.726,1322.873;Inherit;False;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.SimpleMultiplyOpNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;188;-2920.548,274.0343;Inherit;False;3;3;0;FLOAT;0;False;1;FLOAT;-1;False;2;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.Vector3Node, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;915;-2986.027,101.7881;Inherit;False;Global;RAYGlobalDirection;RAYGlobalDirection;25;0;Create;True;0;0;0;False;0;False;0,0,0;-0.5571425,0,0.8304169;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 Node;AmplifyShaderEditor.SimpleDivideOpNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1113;-2640,-704;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.OneMinusNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1120;-2672,-464;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1118;-2848,-560;Inherit;False;Constant;_Float1;Float 1;23;0;Create;True;0;0;0;False;0;False;1.01;0;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.CommentaryNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;262;-5626.675,-1242.181;Inherit;False;2115.644;893.7669;;15;1034;1035;1036;368;247;3;1022;337;259;263;332;367;10;1;366;Albedo;1,1,1,1;0;0 Node;AmplifyShaderEditor.RegisterLocalVarNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1032;-2856.821,1321.974;Inherit;False;Tiling;-1;True;1;0;FLOAT2;0,0;False;1;FLOAT2;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;914;-2691.047,180.5614;Inherit;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;1;FLOAT3;0 Node;AmplifyShaderEditor.SmoothstepOpNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1117;-2432,-592;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;1;False;1;FLOAT;0 Node;AmplifyShaderEditor.GetLocalVarNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1034;-5568.744,-763.387;Inherit;False;1032;Tiling;1;0;OBJECT;;False;1;FLOAT2;0 Node;AmplifyShaderEditor.WorldToObjectTransfNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;916;-2498.345,180.6679;Inherit;False;1;0;FLOAT4;0,0,0,1;False;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.CommentaryNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1102;-2096,784;Inherit;False;900;483;;5;1097;1098;1099;1096;1101;Lighting Flatness;1,1,1,1;0;0 Node;AmplifyShaderEditor.SaturateNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1095;-2192,-592;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1024;-2192,-480;Inherit;False;Property;_GrassDistanceFadeEnable;Enable;19;1;[Toggle];Create;False;0;0;0;False;2;Header(Grass Distance Fade);Space(5);False;0;0;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.WireNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1035;-5328.594,-883.5371;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0 Node;AmplifyShaderEditor.TexturePropertyNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;368;-5310.445,-786.1342;Inherit;True;Property;_Albedo;Base;1;1;[NoScaleOffset];Create;False;0;0;0;False;1;Space(5);False;None;None;False;white;Auto;Texture2D;False;-1;0;2;SAMPLER2D;0;SAMPLERSTATE;1 Node;AmplifyShaderEditor.StaticSwitch, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;341;-2236.624,154.9358;Inherit;False;Property;_EnableWind;Enable;14;0;Create;False;0;0;0;False;2;Header(Wind);Space(5);False;0;1;1;True;;Toggle;2;;;Create;True;True;All;9;1;FLOAT4;0,0,0,0;False;0;FLOAT4;0,0,0,0;False;2;FLOAT4;0,0,0,0;False;3;FLOAT4;0,0,0,0;False;4;FLOAT4;0,0,0,0;False;5;FLOAT4;0,0,0,0;False;6;FLOAT4;0,0,0,0;False;7;FLOAT4;0,0,0,0;False;8;FLOAT4;0,0,0,0;False;1;FLOAT4;0 Node;AmplifyShaderEditor.Vector3Node, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1097;-1952,992;Inherit;False;Constant;_Vector0;Vector 0;22;0;Create;True;0;0;0;False;0;False;0,1,0;0,0,0;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 Node;AmplifyShaderEditor.NormalVertexDataNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1099;-1952,832;Inherit;False;0;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.RangedFloatNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1098;-2048,1152;Inherit;False;Property;_LightingFlatness;Lighting Flatness;22;0;Create;True;0;0;0;False;2;Header(Lighting);Space(5);False;0;0;0;1;0;1;FLOAT;0 Node;AmplifyShaderEditor.LerpOp, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1023;-1984,-576;Inherit;False;3;0;FLOAT;1;False;1;FLOAT;0;False;2;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SamplerNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1;-5031.256,-981.5227;Inherit;True;Property;_LeavesTexture;Leaves Texture;0;0;Create;True;0;0;0;False;0;False;-1;None;None;True;0;False;white;Auto;False;Instance;-1;Auto;Texture2D;False;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;6;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT3;5 Node;AmplifyShaderEditor.RegisterLocalVarNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;191;-1950.11,154.1265;Inherit;False;Wind;-1;True;1;0;FLOAT4;0,0,0,0;False;1;FLOAT4;0 Node;AmplifyShaderEditor.LerpOp, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1096;-1664,960;Inherit;False;3;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT;0;False;1;FLOAT3;0 Node;AmplifyShaderEditor.PosVertexDataNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1058;-1456,64;Inherit;False;0;0;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.RegisterLocalVarNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;982;-1792,-576;Inherit;False;GrassDistanceFadeMask;-1;True;1;0;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.CommentaryNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;336;-5630.573,772.877;Inherit;False;2182.876;716.7827;;18;334;335;1025;248;1026;360;743;310;745;1027;875;1017;871;361;1015;939;742;1048;Second Color Mask;1,1,1,1;0;0 Node;AmplifyShaderEditor.CommentaryNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;733;-3401.677,782.6193;Inherit;False;1241.814;395.4615;;6;1038;681;708;734;893;709;Smoothness;1,1,1,1;0;0 Node;AmplifyShaderEditor.CommentaryNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;892;-3447.783,-1235.904;Inherit;False;939.5;345.4;;4;887;1037;886;888;Normal;1,1,1,1;0;0 Node;AmplifyShaderEditor.RegisterLocalVarNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1101;-1440,960;Inherit;False;LightingFlatness;-1;True;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0 Node;AmplifyShaderEditor.GetLocalVarNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;917;-1232,160;Inherit;False;191;Wind;1;0;OBJECT;0;False;1;FLOAT4;0 Node;AmplifyShaderEditor.ScaleNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1060;-1200,64;Inherit;False;-1;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0 Node;AmplifyShaderEditor.GetLocalVarNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1064;-1296,256;Inherit;False;982;GrassDistanceFadeMask;1;0;OBJECT;;False;1;FLOAT;0 Node;AmplifyShaderEditor.RegisterLocalVarNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;263;-4658.396,-940.4174;Inherit;False;AlbedoAlpha;-1;True;1;0;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.WorldPosInputsNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;745;-5577.272,891.5659;Inherit;False;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 Node;AmplifyShaderEditor.SwizzleNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;939;-5322.134,890.9437;Inherit;False;FLOAT2;0;2;2;3;1;0;FLOAT3;0,0,0;False;1;FLOAT2;0 Node;AmplifyShaderEditor.WorldPosInputsNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1017;-5352.771,1093.87;Inherit;False;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3 Node;AmplifyShaderEditor.RangedFloatNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;743;-5384.468,1002.72;Inherit;False;Property;_WorldNoiseScale;World Noise Scale;13;0;Create;True;0;0;0;False;0;False;1;1;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.NoiseGeneratorNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;742;-5092.825,933.2988;Inherit;False;Simplex2D;True;False;2;0;FLOAT2;0,0;False;1;FLOAT;1;False;1;FLOAT;0 Node;AmplifyShaderEditor.NoiseGeneratorNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1015;-5094.324,1048.603;Inherit;False;Simplex3D;True;False;2;0;FLOAT3;0,0,0;False;1;FLOAT;1;False;1;FLOAT;0 Node;AmplifyShaderEditor.TextureCoordinatesNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;361;-5095.055,1322.688;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.PosVertexDataNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;871;-5061.946,1153.86;Inherit;False;0;0;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.RangedFloatNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;310;-4702.921,1260.388;Inherit;False;Property;_SecondColorOffset;Offset;11;0;Create;False;0;0;0;False;0;False;1;-0.39;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.OneMinusNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1027;-4541.701,1250.711;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.StaticSwitch, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;360;-4766.671,1082.927;Inherit;False;Property;_SecondColorOverlayType;Overlay Method;10;0;Create;False;0;0;0;False;0;False;0;0;0;True;;KeywordEnum;4;World_Noise_2D;World_Noise_3D;Vertex_Gradient;UV_Gradient;Create;True;True;All;9;1;FLOAT;0;False;0;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;4;FLOAT;0;False;5;FLOAT;0;False;6;FLOAT;0;False;7;FLOAT;0;False;8;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleAddOpNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;875;-4392.424,1150.373;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;248;-4434.502,1334.592;Inherit;False;Property;_SecondColorFade;Balance;12;0;Create;False;0;0;0;False;0;False;1;0.41;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.OneMinusNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1026;-4242.623,1224.432;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleSubtractOpNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1048;-4244.53,1333.965;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;-0.5;False;1;FLOAT;0 Node;AmplifyShaderEditor.LerpOp, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1025;-4055.623,1149.432;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.WireNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1036;-5327.594,-570.4702;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0 Node;AmplifyShaderEditor.SaturateNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;334;-3870.359,1149.847;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SamplerNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;366;-5030.424,-590.7482;Inherit;True;Property;_TextureSample0;Texture Sample 0;18;0;Create;True;0;0;0;False;0;False;-1;None;None;True;0;False;white;Auto;False;Instance;-1;Auto;Texture2D;False;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;6;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT3;5 Node;AmplifyShaderEditor.ColorNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;247;-4946.804,-777.2593;Inherit;False;Property;_SecondColor;Second Color;9;0;Create;True;0;0;0;False;1;Space(10);False;0,0,0,0;0.09481568,0.6156863,0.3505847,0;True;True;0;6;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT3;5 Node;AmplifyShaderEditor.RegisterLocalVarNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;335;-3688.51,1149.484;Inherit;False;SecondColorMask;-1;True;1;0;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.ColorNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;3;-4949.521,-1171.078;Inherit;False;Property;_MainColor;Main Color;5;0;Create;True;0;0;0;False;2;Header(Settings);Space(5);False;1,1,1,0;0.263263,0.4790527,0.574,0;True;True;0;6;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT3;5 Node;AmplifyShaderEditor.GetLocalVarNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1038;-3350.293,875.436;Inherit;False;1032;Tiling;1;0;OBJECT;;False;1;FLOAT2;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;10;-4626.809,-1081.864;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;367;-4629.995,-688.4203;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.GetLocalVarNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;337;-4656.514,-853.1598;Inherit;False;335;SecondColorMask;1;0;OBJECT;;False;1;FLOAT;0 Node;AmplifyShaderEditor.SamplerNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;708;-3109.486,851.5749;Inherit;True;Property;_SmoothnessTexture;Smoothness;3;1;[NoScaleOffset];Create;False;0;0;0;False;0;False;-1;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;False;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;6;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT3;5 Node;AmplifyShaderEditor.RangedFloatNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;681;-3103.936,1059.007;Inherit;False;Property;_Smoothness;Smoothness;7;0;Create;True;0;0;0;False;0;False;0;1;0;1;0;1;FLOAT;0 Node;AmplifyShaderEditor.LerpOp, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;332;-4360.349,-901.5045;Inherit;True;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.GetLocalVarNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1037;-3382.031,-1151.313;Inherit;False;1032;Tiling;1;0;OBJECT;;False;1;FLOAT2;0 Node;AmplifyShaderEditor.RangedFloatNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;887;-3348.085,-1042.008;Inherit;False;Property;_NormalScale;Normal;6;0;Create;False;0;0;0;False;0;False;1;1;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;709;-2752.487,976.5747;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.StaticSwitch, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1022;-4034.959,-1081.689;Inherit;False;Property;_Color2Enable;Enable;8;0;Create;False;0;0;0;False;2;Header(Second Color);Space(5);False;0;0;0;True;;Toggle;2;Key0;Key1;Create;True;True;All;9;1;COLOR;0,0,0,0;False;0;COLOR;0,0,0,0;False;2;COLOR;0,0,0,0;False;3;COLOR;0,0,0,0;False;4;COLOR;0,0,0,0;False;5;COLOR;0,0,0,0;False;6;COLOR;0,0,0,0;False;7;COLOR;0,0,0,0;False;8;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.SamplerNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;886;-3107.923,-1134.495;Inherit;True;Property;_Normal;Normal;2;2;[NoScaleOffset];[Normal];Create;True;0;0;0;False;0;False;-1;None;None;True;0;True;bump;Auto;True;Object;-1;Auto;Texture2D;False;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;6;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT3;5 Node;AmplifyShaderEditor.SaturateNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;893;-2580.616,976.8357;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.RegisterLocalVarNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;259;-3757.885,-1082.028;Inherit;False;Albedo;-1;True;1;0;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.RegisterLocalVarNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;888;-2772.554,-1133.705;Inherit;False;Normal;-1;True;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0 Node;AmplifyShaderEditor.RegisterLocalVarNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;734;-2406.864,976.4997;Inherit;False;Smoothness;-1;True;1;0;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.GetLocalVarNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;889;-992,-144;Inherit;False;888;Normal;1;0;OBJECT;;False;1;FLOAT3;0 Node;AmplifyShaderEditor.GetLocalVarNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;806;-992,-48;Inherit;False;734;Smoothness;1;0;OBJECT;;False;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;156;-1088,-336;Inherit;False;Property;_AlphaCutoff;Opacity Cutoff;4;0;Create;False;0;0;0;False;0;False;0.35;0.7;0;1;0;1;FLOAT;0 Node;AmplifyShaderEditor.GetLocalVarNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;804;-992,-224;Inherit;False;259;Albedo;1;0;OBJECT;;False;1;COLOR;0 Node;AmplifyShaderEditor.GetLocalVarNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;774;-992,32;Inherit;False;263;AlbedoAlpha;1;0;OBJECT;;False;1;FLOAT;0 Node;AmplifyShaderEditor.LerpOp, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1065;-960,128;Inherit;False;3;0;FLOAT4;0,-3,0,0;False;1;FLOAT4;0,0,0,0;False;2;FLOAT;0;False;1;FLOAT4;0 Node;AmplifyShaderEditor.GetLocalVarNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1103;-1024,320;Inherit;False;1101;LightingFlatness;1;0;OBJECT;;False;1;FLOAT3;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1121;-736,-192;Float;False;False;-1;3;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;ExtraPrePass;0;0;ExtraPrePass;6;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;;False;True;0;False;;False;False;False;False;False;False;False;False;False;True;False;0;False;;255;False;;255;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;4;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;UniversalMaterialType=Lit;True;5;True;12;all;0;False;True;1;1;False;;0;False;;0;1;False;;0;False;;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;;False;True;True;True;True;True;0;False;;False;False;False;False;False;False;False;True;False;0;False;;255;False;;255;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;0;False;False;0;;0;0;Standard;0;False;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1122;-736,-192;Float;False;True;-1;3;UnityEditor.ShaderGraphLitGUI;0;12;Raygeas/URP/Vegetation;94348b07e5e8bab40bd6c8a1e3df54cd;True;Forward;0;1;Forward;21;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;;False;True;2;False;;False;False;False;False;False;False;False;False;False;True;False;0;False;;255;False;;255;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;4;RenderPipeline=UniversalPipeline;RenderType=TransparentCutout=RenderType;Queue=AlphaTest=Queue=0;UniversalMaterialType=Lit;True;5;True;12;all;0;False;True;1;1;False;;0;False;;1;1;False;;0;False;;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;;False;False;False;False;False;False;False;True;False;0;False;;255;False;;255;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;1;LightMode=UniversalForward;False;False;0;;0;0;Standard;48;Category;0;0; Instanced Terrain Normals;1;0;Lighting Model;0;0;Workflow;1;0;Surface;0;638964663723384041; Keep Alpha;0;638964663744396468; Refraction Model;0;0; Blend;0;0;Two Sided;0;638964664194995276;Alpha Clipping;1;638964663768724910; Use Shadow Threshold;0;0;Fragment Normal Space;0;0;Forward Only;0;0;Transmission;0;0; Transmission Shadow;0.5,False,;0;Translucency;0;0; Translucency Strength;1,False,;0; Normal Distortion;0.5,False,;0; Scattering;2,False,;0; Direct;0.9,False,;0; Ambient;0.1,False,;0; Shadow;0.5,False,;0;Cast Shadows;1;0;Receive Shadows;2;0;Specular Highlights;2;0;Environment Reflections;2;0;Receive SSAO;1;0;GPU Instancing;1;0;LOD CrossFade;1;0;Built-in Fog;1;0;_FinalColorxAlpha;0;0;Meta Pass;1;0;Override Baked GI;0;0;Extra Pre Pass;0;0;Tessellation;0;0; Phong;0;0; Strength;0.5,False,;0; Type;0;0; Tess;16,False,;0; Min;10,False,;0; Max;25,False,;0; Edge Length;16,False,;0; Max Displacement;25,False,;0;Write Depth;0;0; Early Z;0;0;Vertex Position;1;0;Debug Display;1;0;Clear Coat;0;0;0;10;False;True;True;True;True;True;True;True;True;True;False;;False;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1123;-736,-192;Float;False;False;-1;3;UnityEditor.ShaderGraphLitGUI;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;;False;True;0;False;;False;False;False;False;False;False;False;False;False;True;False;0;False;;255;False;;255;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;4;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;UniversalMaterialType=Lit;True;5;True;12;all;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;;False;False;False;True;False;False;False;False;0;False;;False;False;False;False;False;False;False;False;False;True;1;False;;True;3;False;;False;True;1;LightMode=ShadowCaster;False;False;0;;0;0;Standard;0;False;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1124;-736,-192;Float;False;False;-1;3;UnityEditor.ShaderGraphLitGUI;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;;False;True;0;False;;False;False;False;False;False;False;False;False;False;True;False;0;False;;255;False;;255;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;4;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;UniversalMaterialType=Lit;True;5;True;12;all;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;;False;False;False;True;True;False;False;False;0;False;;False;False;False;False;False;False;False;False;False;True;1;False;;False;False;True;1;LightMode=DepthOnly;False;False;0;;0;0;Standard;0;False;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1125;-736,-192;Float;False;False;-1;3;UnityEditor.ShaderGraphLitGUI;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;;False;True;0;False;;False;False;False;False;False;False;False;False;False;True;False;0;False;;255;False;;255;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;4;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;UniversalMaterialType=Lit;True;5;True;12;all;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Meta;False;False;0;;0;0;Standard;0;False;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1126;-736,-192;Float;False;False;-1;3;UnityEditor.ShaderGraphLitGUI;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;;False;True;0;False;;False;False;False;False;False;False;False;False;False;True;False;0;False;;255;False;;255;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;4;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;UniversalMaterialType=Lit;True;5;True;12;all;0;False;True;1;1;False;;0;False;;1;1;False;;0;False;;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;;False;False;False;False;False;False;False;False;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;1;LightMode=Universal2D;False;False;0;;0;0;Standard;0;False;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1127;-736,-192;Float;False;False;-1;3;UnityEditor.ShaderGraphLitGUI;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;;False;True;0;False;;False;False;False;False;False;False;False;False;False;True;False;0;False;;255;False;;255;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;4;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;UniversalMaterialType=Lit;True;5;True;12;all;0;False;True;1;1;False;;0;False;;0;1;False;;0;False;;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;False;;True;3;False;;False;True;1;LightMode=DepthNormals;False;False;0;;0;0;Standard;0;False;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1128;-736,-192;Float;False;False;-1;3;UnityEditor.ShaderGraphLitGUI;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;;False;True;0;False;;False;False;False;False;False;False;False;False;False;True;False;0;False;;255;False;;255;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;4;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;UniversalMaterialType=Lit;True;5;True;12;all;0;False;True;1;1;False;;0;False;;1;1;False;;0;False;;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;;False;False;False;False;False;False;False;True;False;0;False;;255;False;;255;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;1;LightMode=UniversalGBuffer;False;False;0;;0;0;Standard;0;False;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1129;-736,-192;Float;False;False;-1;3;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;SceneSelectionPass;0;8;SceneSelectionPass;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;;False;True;0;False;;False;False;False;False;False;False;False;False;False;True;False;0;False;;255;False;;255;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;4;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;UniversalMaterialType=Lit;True;5;True;12;all;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;;False;True;2;False;;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=SceneSelectionPass;False;False;0;;0;0;Standard;0;False;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;1130;-736,-192;Float;False;False;-1;3;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;ScenePickingPass;0;9;ScenePickingPass;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;;False;True;0;False;;False;False;False;False;False;False;False;False;False;True;False;0;False;;255;False;;255;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;4;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;UniversalMaterialType=Lit;True;5;True;12;all;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Picking;False;False;0;;0;0;Standard;0;False;0 WireConnection;947;0;56;0 WireConnection;344;0;947;0 WireConnection;777;0;945;0 WireConnection;777;1;344;0 WireConnection;34;0;777;0 WireConnection;803;0;190;0 WireConnection;780;0;803;0 WireConnection;780;1;779;0 WireConnection;182;0;228;0 WireConnection;182;1;34;0 WireConnection;1066;0;941;0 WireConnection;1066;1;1067;0 WireConnection;35;0;182;0 WireConnection;35;1;780;0 WireConnection;940;0;35;0 WireConnection;940;1;1066;0 WireConnection;356;0;357;2 WireConnection;356;1;358;0 WireConnection;231;0;940;0 WireConnection;345;0;56;0 WireConnection;359;0;231;0 WireConnection;359;1;356;0 WireConnection;1109;0;1110;0 WireConnection;1109;1;1107;0 WireConnection;776;0;345;0 WireConnection;776;1;775;0 WireConnection;1020;0;231;0 WireConnection;1020;1;359;0 WireConnection;1020;2;1021;0 WireConnection;1111;0;1109;0 WireConnection;1028;0;1031;0 WireConnection;188;0;1020;0 WireConnection;188;1;769;1 WireConnection;188;2;776;0 WireConnection;1113;0;1111;0 WireConnection;1113;1;960;0 WireConnection;1120;0;1115;0 WireConnection;1032;0;1028;0 WireConnection;914;0;915;0 WireConnection;914;1;188;0 WireConnection;1117;0;1113;0 WireConnection;1117;1;1118;0 WireConnection;1117;2;1120;0 WireConnection;916;0;914;0 WireConnection;1095;0;1117;0 WireConnection;1035;0;1034;0 WireConnection;341;0;916;0 WireConnection;1023;1;1095;0 WireConnection;1023;2;1024;0 WireConnection;1;0;368;0 WireConnection;1;1;1035;0 WireConnection;191;0;341;0 WireConnection;1096;0;1099;0 WireConnection;1096;1;1097;0 WireConnection;1096;2;1098;0 WireConnection;982;0;1023;0 WireConnection;1101;0;1096;0 WireConnection;1060;0;1058;0 WireConnection;263;0;1;4 WireConnection;939;0;745;0 WireConnection;742;0;939;0 WireConnection;742;1;743;0 WireConnection;1015;0;1017;0 WireConnection;1015;1;743;0 WireConnection;1027;0;310;0 WireConnection;360;1;742;0 WireConnection;360;0;1015;0 WireConnection;360;2;871;2 WireConnection;360;3;361;2 WireConnection;875;0;360;0 WireConnection;875;1;1027;0 WireConnection;1026;0;875;0 WireConnection;1048;0;248;0 WireConnection;1025;0;875;0 WireConnection;1025;1;1026;0 WireConnection;1025;2;1048;0 WireConnection;1036;0;1034;0 WireConnection;334;0;1025;0 WireConnection;366;0;368;0 WireConnection;366;1;1036;0 WireConnection;335;0;334;0 WireConnection;10;0;3;0 WireConnection;10;1;1;0 WireConnection;367;0;247;0 WireConnection;367;1;366;0 WireConnection;708;1;1038;0 WireConnection;332;0;10;0 WireConnection;332;1;367;0 WireConnection;332;2;337;0 WireConnection;709;0;708;2 WireConnection;709;1;681;0 WireConnection;1022;1;10;0 WireConnection;1022;0;332;0 WireConnection;886;1;1037;0 WireConnection;886;5;887;0 WireConnection;893;0;709;0 WireConnection;259;0;1022;0 WireConnection;888;0;886;0 WireConnection;734;0;893;0 WireConnection;1065;0;1060;0 WireConnection;1065;1;917;0 WireConnection;1065;2;1064;0 WireConnection;1122;0;804;0 WireConnection;1122;1;889;0 WireConnection;1122;4;806;0 WireConnection;1122;6;774;0 WireConnection;1122;7;156;0 WireConnection;1122;8;1065;0 WireConnection;1122;10;1103;0 ASEEND*/ //CHKSM=426BA04C569AD9DAEB0EEEB27BFA4E1C5456ABD6