Search Unity

[Best Tool Asset Store Award] Amplify Shader Editor - Node-based Shader Creation Tool

Discussion in 'Assets and Asset Store' started by Amplify_Ricardo, Sep 13, 2016.

  1. DEEnvironment

    DEEnvironment

    Joined:
    Dec 30, 2018
    Posts:
    437
    static switch will include the branch behind it.
    it's also a very heavy switch and should be avoided, when possible, better to use a lerp for branching when just two operations.

    if you're looking for a way to not include the branch best to use a "Shader Function Switch" as the entire cod behind it would not be included in the compile
     
  2. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,074
    Why ? And what do you mean by heavy ?


    I need to be able to control the switch from my material.
    I could not find a way to do it with "Shader Function Switch"

    I have created a function that can be used to to output object or world space triaplanar projection.
    As you can see on a shader I got static switch on the output of this function.

    The question is: Is one of those TriplanarProjection nodes going to be removed from execution ? (not compiled)

     
  3. DEEnvironment

    DEEnvironment

    Joined:
    Dec 30, 2018
    Posts:
    437
    I could not find a way to do it with "Shader Function Switch"


    corrnc
    thy should both be included / working


    And what do you mean by heavy ?

    what i mean is if you use a lerp with a Int to change 0 or 1 is a lot faster than use static switch
    that switch i slower.
     
  4. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,074
    But to my understanding static switch is translated into conditional #if #endif and is culling part of a shader so how can it be slower than actual operations in a shader ?
     
  5. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,074
    I have just discovered ProceduralSample Function in ASE.

    It's great but in the current state as I understand it, it is lacking.
    I'm using it in triplanar 2d mode but how can I use it with normal maps ?
    There in no button on it or anything like on Triplanar Sampler.
     
  6. DEEnvironment

    DEEnvironment

    Joined:
    Dec 30, 2018
    Posts:
    437
    set the texture object as Bump but dont unpack it till after the sample and use
    http://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Unpack_Scale_Normal
     
  7. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,074
  8. DEEnvironment

    DEEnvironment

    Joined:
    Dec 30, 2018
    Posts:
    437
    koirat likes this.
  9. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,074
    But do I have to mark my texture as "default" texture instead of "normal map" in texture importer ?
     
  10. DEEnvironment

    DEEnvironment

    Joined:
    Dec 30, 2018
    Posts:
    437

    nope make them as normal map same as you do any others

    on the texture Object set like this upload_2023-3-14_14-45-40.png
     
    koirat likes this.
  11. ptm_oo

    ptm_oo

    Joined:
    Oct 30, 2014
    Posts:
    35
    [is that a bug?]
    'Vertex position node' works differently when material GPU instancing is turned on.
    When ON - vertex position node outputs local positions
    When OFF - vertex positions outputs world space positions (it's not supposed to do that)
    Please help?
    ASE 1.9.1.5 Unity 2022.2.6 Build-in renderer.
     
  12. XenopVertigo

    XenopVertigo

    Joined:
    Aug 29, 2019
    Posts:
    1
    I still have this issue. It seems that it goes correctly here

    Code (CSharp):
    1. VertexOutput VertexFunction ( VertexInput v , uint ase_instanceId : SV_InstanceId )
    2.             {
    But its missing in these spots


    Code (CSharp):
    1. VertexOutput vert ( VertexInput v )
    2.             {
    3.                 return VertexFunction( v );
    4.             }
    Using URP btw unity 2021.3.6f1

    EDIT:
    For know I do this

    Code (CSharp):
    1. #if defined(useSV)
    2.                 VertexOutput vert(VertexInput v, uint ase_instanceId : SV_InstanceId)
    3.                 {
    4.                     return VertexFunction(v, ase_instanceId);
    5.                 }
    6.             #else
    7.                 VertexOutput vert ( VertexInput v )
    8.                 {
    9.                     return VertexFunction( v );
    10.                 }
    11.             #endif
    and add the define in amplify
     
    Last edited: Mar 30, 2023
  13. Amplify_David

    Amplify_David

    Joined:
    Mar 29, 2023
    Posts:
    194

    hello, can you send this info to me in email support@amplify.pt
    i will make certain it gets attention and bumped up in the workflow for coming updates.
    please include as much info as possible so it can be reproduced.

    thank you
     
  14. ckohlmeyer

    ckohlmeyer

    Joined:
    Apr 17, 2021
    Posts:
    40
    Has this been solved? I'm having the same problem.

    I'm on Unity 2021.3.16 and ASE 1.9.1.5.

    With URP Lit and URP Unlit templates the alpha clip isn't baking shadows correctly. Here are images comparing the built in URP Unlit to an Amplify URP Unlit upload_2023-4-4_10-48-7.png upload_2023-4-4_10-48-2.png
     
    Last edited: Apr 11, 2023
  15. Yon940

    Yon940

    Joined:
    Aug 26, 2017
    Posts:
    6
    I'm want to modify the fake interior shader so not every room looks the same. any way to add randomness to it with multiple textures? also a night version with the lights on - how do I make them glow?
     
  16. boorch

    boorch

    Joined:
    Oct 7, 2015
    Posts:
    40
    hey I've been using Amplify for a while, and lately I started to have this weird problem:

    I'm mostly working on UI and while using the UI-Default template, if I use Panner or Rotator I receive this error and the shader fails to compile:

    "Attempting to write data into inexistant tag /*ase_pragma*/. Please review the template Hidden/Templates/UI-Default body and consider adding the missing tag."

    Any idea?
     
    Last edited: Apr 8, 2023
  17. boorch

    boorch

    Joined:
    Oct 7, 2015
    Posts:
    40

    I was able to extract v 1.8.9r35 from a very old repo of mine (which has the "Legacy/Default UI" Template) and I can confirm this does not happen on that particular version within the exact same Unity project. Bummer...

    P.S: Adding ase_pragma tag to template (exactly where it was before on the Legacy/UI_Default) does not fix this issue.
     
  18. Amplify_David

    Amplify_David

    Joined:
    Mar 29, 2023
    Posts:
    194

    hello,
    We will need a bit more information such as what unity version and pipeline.
     
  19. boorch

    boorch

    Joined:
    Oct 7, 2015
    Posts:
    40
    Unity 2021.3.22f1, Built-in rendering pipeline. I highly doubt this is related to the Unity version tho. I can confirm I had the same problem in the past couple of months using Unity 2020.x (can't remember which version) but just decided to ask here now.
    Steps to reproduce:
    - Create a UI Default Shader
    - Add Texture Sampler, Texture Coordinates, Connect UVs, Connect TS2D output to Color shader output
    - Use Rotator or Panner with Time input connected to any sort of time node
    - Compile shader
    - See error log on the Amplify console
    - There's also another error in the Unity console but can't exactly tell now since I urgently need to deliver some work therefore as mentioned, I deleted 1.9.1.5 and installed 1.8.9r35 from one of my old repos and everything seems to be working fine (using the Legacy/UI-Default template)
     
  20. Amplify_David

    Amplify_David

    Joined:
    Mar 29, 2023
    Posts:
    194

    thank you for the detail report.
    I was not able to reproduce any errors.

    when you have time could you please send me thru email support@amplify.pt a copy of the subject shader for a more detail look
     
  21. Spookysaw

    Spookysaw

    Joined:
    Apr 22, 2021
    Posts:
    3
    Hello, I am making a game with marching cubes terrain and have been struggling to understand the shader code that the standard pipeline requires you to use. As I already have Amplify Shader Editor, I am wondering if ASE has the capabilities that a marching cubes terrain shader needs. Is ASE capable of having an array of textures that can be applied to individual vertices?
     
  22. ckohlmeyer

    ckohlmeyer

    Joined:
    Apr 17, 2021
    Posts:
    40
    Any updates on getting alpha clip to work with baked shadows in URP?
    Thanks
     
  23. Amplify_David

    Amplify_David

    Joined:
    Mar 29, 2023
    Posts:
    194

    make certain you your baseColor uses the property _MainTex
     
  24. Raven8000Tris

    Raven8000Tris

    Joined:
    Apr 12, 2023
    Posts:
    3
    Hello there ! Working on Unity 2020.2.1 and 2022.2.5. I have long compilation time (1 hour) for specific shaders. They are based on a "uber" method : I create an amplify function that is a uber for the logic of the shader, and I drop the function node in several shaders. So the main logic is easy to be maintained among the shaders (these shaders have minor changes between them). The uber shader function use itself other functions (functions from amplify but also custom functions).
    Do you know why the shaders using the uber shader function take so much time to be compiled (i'm speaking compilation time in editor, not when building) ? Does it come from nesting shader functions ? Is it linked to the usage of static switches ?
    I have already tried to delete the library folder to compile on a clean state for the shader, but it change nothing.
    Thank you for your help
     
  25. Amplify_David

    Amplify_David

    Joined:
    Mar 29, 2023
    Posts:
    194

    It’s likely the use of too many static switches
    for faster compile time you would be better to use other type of switch when possible, such as local no keywork toggles.
     
  26. ckohlmeyer

    ckohlmeyer

    Joined:
    Apr 17, 2021
    Posts:
    40
    I've done that. It no longer works
     
  27. Yon940

    Yon940

    Joined:
    Aug 26, 2017
    Posts:
    6
    is there a shader graphs "random range"
    equivalent in amplify?
     
  28. Amplify_David

    Amplify_David

    Joined:
    Mar 29, 2023
    Posts:
    194
    yes it's a function called Random Range in amplify.
     
  29. Amplify_David

    Amplify_David

    Joined:
    Mar 29, 2023
    Posts:
    194

    can you reach out to me in discord or email with the shader you're having trouble with?
     
  30. Raven8000Tris

    Raven8000Tris

    Joined:
    Apr 12, 2023
    Posts:
    3
    Okay, thank you for your reply :)
     
  31. makaolachsiungca

    makaolachsiungca

    Joined:
    Sep 27, 2019
    Posts:
    31
    Hi,
    I want to import shaders from AssetStore asset,
    mainly the combination of toon shader and special effect shader.
    Where should I start please?
    upload_2023-4-15_11-34-22.png
     
  32. Amplify_David

    Amplify_David

    Joined:
    Mar 29, 2023
    Posts:
    194
  33. makaolachsiungca

    makaolachsiungca

    Joined:
    Sep 27, 2019
    Posts:
    31
  34. Amplify_David

    Amplify_David

    Joined:
    Mar 29, 2023
    Posts:
    194
    I recommend first start off with Amplify Shader Editor Beginner Tutorial Series
    they are a bit older but still can give you the basics.
    https://www.youtube.com/playlist?list=PL83m62O3BixCFobu0fRS4W9xTittd3rl8

    Amplify also has a very large active community in discord that may be helpful as you learn more.
     
    makaolachsiungca likes this.
  35. ununion

    ununion

    Joined:
    Dec 2, 2018
    Posts:
    275
    BUG report!
    every time i reopen ase canvas ,the property ref of ztest/zwrite will be lossed,and then if I press complie,every thing will be pink. every thing will loss include shader name,
    really simple shader here

    Code (CSharp):
    1. // Made with Amplify Shader Editor v1.9.1.5
    2. // Available at the Unity Asset Store - http://u3d.as/y3X
    3. Shader "Sh_Main"
    4. {
    5.     Properties
    6.     {
    7.         [HideInInspector] _AlphaCutoff("Alpha Cutoff ", Range(0, 1)) = 0.5
    8.         [HideInInspector] _EmissionColor("Emission Color", Color) = (1,1,1,1)
    9.         [ASEBegin][Enum(UnityEngine.Rendering.CompareFunction)]_ZTestMode("ZTestMode", Int) = 4
    10.         [Toggle]_ZWriteMode("ZWriteMode", Float) = 1
    11.         _MainTex("MainTex", 2D) = "white" {}
    12.         _AlphaClip("AlphaClip", Range( 0 , 1)) = 0.5
    13.         _ShadowAlphaClip("ShadowAlphaClip", Range( 0 , 1)) = 0.5
    14.         [ASEEnd]_StencilValue("StencilValue", Float) = 0
    15.         [HideInInspector] _texcoord( "", 2D ) = "white" {}
    16.  
    17.  
    18.         //_TransmissionShadow( "Transmission Shadow", Range( 0, 1 ) ) = 0.5
    19.         //_TransStrength( "Trans Strength", Range( 0, 50 ) ) = 1
    20.         //_TransNormal( "Trans Normal Distortion", Range( 0, 1 ) ) = 0.5
    21.         //_TransScattering( "Trans Scattering", Range( 1, 50 ) ) = 2
    22.         //_TransDirect( "Trans Direct", Range( 0, 1 ) ) = 0.9
    23.         //_TransAmbient( "Trans Ambient", Range( 0, 1 ) ) = 0.1
    24.         //_TransShadow( "Trans Shadow", Range( 0, 1 ) ) = 0.5
    25.         //_TessPhongStrength( "Tess Phong Strength", Range( 0, 1 ) ) = 0.5
    26.         //_TessValue( "Tess Max Tessellation", Range( 1, 32 ) ) = 16
    27.         //_TessMin( "Tess Min Distance", Float ) = 10
    28.         //_TessMax( "Tess Max Distance", Float ) = 25
    29.         //_TessEdgeLength ( "Tess Edge length", Range( 2, 50 ) ) = 16
    30.         //_TessMaxDisp( "Tess Max Displacement", Float ) = 25
    31.  
    32.         [HideInInspector][ToggleOff] _SpecularHighlights("Specular Highlights", Float) = 1.0
    33.         [HideInInspector][ToggleOff] _EnvironmentReflections("Environment Reflections", Float) = 1.0
    34.         [HideInInspector][ToggleOff] _ReceiveShadows("Receive Shadows", Float) = 1.0
    35.  
    36.         [HideInInspector] _QueueOffset("_QueueOffset", Float) = 0
    37.         [HideInInspector] _QueueControl("_QueueControl", Float) = -1
    38.  
    39.         [HideInInspector][NoScaleOffset] unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {}
    40.         [HideInInspector][NoScaleOffset] unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {}
    41.         [HideInInspector][NoScaleOffset] unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {}
    42.     }
    43.  
    44.     SubShader
    45.     {
    46.         LOD 0
    47.  
    48.        
    49.  
    50.         Tags { "RenderPipeline"="UniversalPipeline" "RenderType"="Opaque" "Queue"="Geometry" "UniversalMaterialType"="Lit" }
    51.  
    52.         Cull Back
    53.         ZWrite On
    54.         ZTest LEqual
    55.         Offset 0 , 0
    56.         AlphaToMask Off
    57.  
    58.        
    59.  
    60.         HLSLINCLUDE
    61.         #pragma target 3.5
    62.         #pragma prefer_hlslcc gles
    63.         // ensure rendering platforms toggle list is visible
    64.  
    65.         #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
    66.         #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Filtering.hlsl"
    67.  
    68.         #ifndef ASE_TESS_FUNCS
    69.         #define ASE_TESS_FUNCS
    70.         float4 FixedTess( float tessValue )
    71.         {
    72.             return tessValue;
    73.         }
    74.  
    75.         float CalcDistanceTessFactor (float4 vertex, float minDist, float maxDist, float tess, float4x4 o2w, float3 cameraPos )
    76.         {
    77.             float3 wpos = mul(o2w,vertex).xyz;
    78.             float dist = distance (wpos, cameraPos);
    79.             float f = clamp(1.0 - (dist - minDist) / (maxDist - minDist), 0.01, 1.0) * tess;
    80.             return f;
    81.         }
    82.  
    83.         float4 CalcTriEdgeTessFactors (float3 triVertexFactors)
    84.         {
    85.             float4 tess;
    86.             tess.x = 0.5 * (triVertexFactors.y + triVertexFactors.z);
    87.             tess.y = 0.5 * (triVertexFactors.x + triVertexFactors.z);
    88.             tess.z = 0.5 * (triVertexFactors.x + triVertexFactors.y);
    89.             tess.w = (triVertexFactors.x + triVertexFactors.y + triVertexFactors.z) / 3.0f;
    90.             return tess;
    91.         }
    92.  
    93.         float CalcEdgeTessFactor (float3 wpos0, float3 wpos1, float edgeLen, float3 cameraPos, float4 scParams )
    94.         {
    95.             float dist = distance (0.5 * (wpos0+wpos1), cameraPos);
    96.             float len = distance(wpos0, wpos1);
    97.             float f = max(len * scParams.y / (edgeLen * dist), 1.0);
    98.             return f;
    99.         }
    100.  
    101.         float DistanceFromPlane (float3 pos, float4 plane)
    102.         {
    103.             float d = dot (float4(pos,1.0f), plane);
    104.             return d;
    105.         }
    106.  
    107.         bool WorldViewFrustumCull (float3 wpos0, float3 wpos1, float3 wpos2, float cullEps, float4 planes[6] )
    108.         {
    109.             float4 planeTest;
    110.             planeTest.x = (( DistanceFromPlane(wpos0, planes[0]) > -cullEps) ? 1.0f : 0.0f ) +
    111.                             (( DistanceFromPlane(wpos1, planes[0]) > -cullEps) ? 1.0f : 0.0f ) +
    112.                             (( DistanceFromPlane(wpos2, planes[0]) > -cullEps) ? 1.0f : 0.0f );
    113.             planeTest.y = (( DistanceFromPlane(wpos0, planes[1]) > -cullEps) ? 1.0f : 0.0f ) +
    114.                             (( DistanceFromPlane(wpos1, planes[1]) > -cullEps) ? 1.0f : 0.0f ) +
    115.                             (( DistanceFromPlane(wpos2, planes[1]) > -cullEps) ? 1.0f : 0.0f );
    116.             planeTest.z = (( DistanceFromPlane(wpos0, planes[2]) > -cullEps) ? 1.0f : 0.0f ) +
    117.                             (( DistanceFromPlane(wpos1, planes[2]) > -cullEps) ? 1.0f : 0.0f ) +
    118.                             (( DistanceFromPlane(wpos2, planes[2]) > -cullEps) ? 1.0f : 0.0f );
    119.             planeTest.w = (( DistanceFromPlane(wpos0, planes[3]) > -cullEps) ? 1.0f : 0.0f ) +
    120.                             (( DistanceFromPlane(wpos1, planes[3]) > -cullEps) ? 1.0f : 0.0f ) +
    121.                             (( DistanceFromPlane(wpos2, planes[3]) > -cullEps) ? 1.0f : 0.0f );
    122.             return !all (planeTest);
    123.         }
    124.  
    125.         float4 DistanceBasedTess( float4 v0, float4 v1, float4 v2, float tess, float minDist, float maxDist, float4x4 o2w, float3 cameraPos )
    126.         {
    127.             float3 f;
    128.             f.x = CalcDistanceTessFactor (v0,minDist,maxDist,tess,o2w,cameraPos);
    129.             f.y = CalcDistanceTessFactor (v1,minDist,maxDist,tess,o2w,cameraPos);
    130.             f.z = CalcDistanceTessFactor (v2,minDist,maxDist,tess,o2w,cameraPos);
    131.  
    132.             return CalcTriEdgeTessFactors (f);
    133.         }
    134.  
    135.         float4 EdgeLengthBasedTess( float4 v0, float4 v1, float4 v2, float edgeLength, float4x4 o2w, float3 cameraPos, float4 scParams )
    136.         {
    137.             float3 pos0 = mul(o2w,v0).xyz;
    138.             float3 pos1 = mul(o2w,v1).xyz;
    139.             float3 pos2 = mul(o2w,v2).xyz;
    140.             float4 tess;
    141.             tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams);
    142.             tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams);
    143.             tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams);
    144.             tess.w = (tess.x + tess.y + tess.z) / 3.0f;
    145.             return tess;
    146.         }
    147.  
    148.         float4 EdgeLengthBasedTessCull( float4 v0, float4 v1, float4 v2, float edgeLength, float maxDisplacement, float4x4 o2w, float3 cameraPos, float4 scParams, float4 planes[6] )
    149.         {
    150.             float3 pos0 = mul(o2w,v0).xyz;
    151.             float3 pos1 = mul(o2w,v1).xyz;
    152.             float3 pos2 = mul(o2w,v2).xyz;
    153.             float4 tess;
    154.  
    155.             if (WorldViewFrustumCull(pos0, pos1, pos2, maxDisplacement, planes))
    156.             {
    157.                 tess = 0.0f;
    158.             }
    159.             else
    160.             {
    161.                 tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams);
    162.                 tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams);
    163.                 tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams);
    164.                 tess.w = (tess.x + tess.y + tess.z) / 3.0f;
    165.             }
    166.             return tess;
    167.         }
    168.         #endif //ASE_TESS_FUNCS
    169.         ENDHLSL
    170.  
    171.        
    172.         Pass
    173.         {
    174.            
    175.             Name "Forward"
    176.             Tags { "LightMode"="UniversalForward" }
    177.  
    178.             Blend One Zero, One Zero
    179.             ZWrite [_ZWriteMode]
    180.             ZTest [_ZTestMode]
    181.             Offset 0 , 0
    182.             ColorMask RGBA
    183.  
    184.             Stencil
    185.             {
    186.                 Ref [_StencilValue]
    187.                 Comp Always
    188.                 Pass Replace
    189.             }
    190.  
    191.             HLSLPROGRAM
    192.  
    193.             #define _NORMAL_DROPOFF_TS 1
    194.             #pragma multi_compile_instancing
    195.             #pragma instancing_options renderinglayer
    196.             #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE
    197.             #pragma multi_compile_fog
    198.             #define ASE_FOG 1
    199.             #define _ALPHATEST_SHADOW_ON 1
    200.             #define _ALPHATEST_ON 1
    201.             #define ASE_SRP_VERSION 120107
    202.  
    203.  
    204.             #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN
    205.             #pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS
    206.             #pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS
    207.             #pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING
    208.             #pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION
    209.             #pragma multi_compile_fragment _ _SHADOWS_SOFT
    210.             #pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION
    211.             #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3
    212.             #pragma multi_compile_fragment _ _LIGHT_LAYERS
    213.             #pragma multi_compile_fragment _ _LIGHT_COOKIES
    214.             #pragma multi_compile _ _CLUSTERED_RENDERING
    215.             #pragma shader_feature_local _RECEIVE_SHADOWS_OFF
    216.             #pragma shader_feature_local_fragment _SPECULARHIGHLIGHTS_OFF
    217.             #pragma shader_feature_local_fragment _ENVIRONMENTREFLECTIONS_OFF
    218.  
    219.             #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING
    220.             #pragma multi_compile _ SHADOWS_SHADOWMASK
    221.             #pragma multi_compile _ DIRLIGHTMAP_COMBINED
    222.             #pragma multi_compile _ LIGHTMAP_ON
    223.             #pragma multi_compile _ DYNAMICLIGHTMAP_ON
    224.             #pragma multi_compile_fragment _ DEBUG_DISPLAY
    225.  
    226.             #pragma vertex vert
    227.             #pragma fragment frag
    228.  
    229.             #define SHADERPASS SHADERPASS_FORWARD
    230.  
    231.             #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
    232.             #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
    233.             #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
    234.             #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
    235.             #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
    236.             #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
    237.             #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl"
    238.             #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
    239.             #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl"
    240.             #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
    241.  
    242.             #if defined(UNITY_INSTANCING_ENABLED) && defined(_TERRAIN_INSTANCED_PERPIXEL_NORMAL)
    243.                 #define ENABLE_TERRAIN_PERPIXEL_NORMAL
    244.             #endif
    245.  
    246.            
    247.  
    248.             struct VertexInput
    249.             {
    250.                 float4 vertex : POSITION;
    251.                 float3 ase_normal : NORMAL;
    252.                 float4 ase_tangent : TANGENT;
    253.                 float4 texcoord : TEXCOORD0;
    254.                 float4 texcoord1 : TEXCOORD1;
    255.                 float4 texcoord2 : TEXCOORD2;
    256.                
    257.                 UNITY_VERTEX_INPUT_INSTANCE_ID
    258.             };
    259.  
    260.             struct VertexOutput
    261.             {
    262.                 float4 clipPos : SV_POSITION;
    263.                 float4 lightmapUVOrVertexSH : TEXCOORD0;
    264.                 half4 fogFactorAndVertexLight : TEXCOORD1;
    265.                 #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
    266.                     float4 shadowCoord : TEXCOORD2;
    267.                 #endif
    268.                 float4 tSpace0 : TEXCOORD3;
    269.                 float4 tSpace1 : TEXCOORD4;
    270.                 float4 tSpace2 : TEXCOORD5;
    271.                 #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION)
    272.                     float4 screenPos : TEXCOORD6;
    273.                 #endif
    274.                 #if defined(DYNAMICLIGHTMAP_ON)
    275.                     float2 dynamicLightmapUV : TEXCOORD7;
    276.                 #endif
    277.                 float4 ase_texcoord8 : TEXCOORD8;
    278.                 UNITY_VERTEX_INPUT_INSTANCE_ID
    279.                 UNITY_VERTEX_OUTPUT_STEREO
    280.             };
    281.  
    282.             CBUFFER_START(UnityPerMaterial)
    283.             float4 _MainTex_ST;
    284.             float _ZWriteMode;
    285.             int _ZTestMode;
    286.             float _StencilValue;
    287.             float _AlphaClip;
    288.             float _ShadowAlphaClip;
    289.             #ifdef ASE_TRANSMISSION
    290.                 float _TransmissionShadow;
    291.             #endif
    292.             #ifdef ASE_TRANSLUCENCY
    293.                 float _TransStrength;
    294.                 float _TransNormal;
    295.                 float _TransScattering;
    296.                 float _TransDirect;
    297.                 float _TransAmbient;
    298.                 float _TransShadow;
    299.             #endif
    300.             #ifdef ASE_TESSELLATION
    301.                 float _TessPhongStrength;
    302.                 float _TessValue;
    303.                 float _TessMin;
    304.                 float _TessMax;
    305.                 float _TessEdgeLength;
    306.                 float _TessMaxDisp;
    307.             #endif
    308.             CBUFFER_END
    309.  
    310.             // Property used by ScenePickingPass
    311.             #ifdef SCENEPICKINGPASS
    312.                 float4 _SelectionID;
    313.             #endif
    314.  
    315.             // Properties used by SceneSelectionPass
    316.             #ifdef SCENESELECTIONPASS
    317.                 int _ObjectId;
    318.                 int _PassValue;
    319.             #endif
    320.  
    321.             sampler2D _MainTex;
    322.  
    323.  
    324.             //#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/Varyings.hlsl"
    325.             //#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/PBRForwardPass.hlsl"
    326.  
    327.             //#ifdef HAVE_VFX_MODIFICATION
    328.             //#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/VisualEffectVertex.hlsl"
    329.             //#endif
    330.  
    331.            
    332.             VertexOutput VertexFunction( VertexInput v  )
    333.             {
    334.                 VertexOutput o = (VertexOutput)0;
    335.                 UNITY_SETUP_INSTANCE_ID(v);
    336.                 UNITY_TRANSFER_INSTANCE_ID(v, o);
    337.                 UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
    338.  
    339.                 o.ase_texcoord8.xy = v.texcoord.xy;
    340.                
    341.                 //setting value to unused interpolator channels and avoid initialization warnings
    342.                 o.ase_texcoord8.zw = 0;
    343.  
    344.                 #ifdef ASE_ABSOLUTE_VERTEX_POS
    345.                     float3 defaultVertexValue = v.vertex.xyz;
    346.                 #else
    347.                     float3 defaultVertexValue = float3(0, 0, 0);
    348.                 #endif
    349.  
    350.                 float3 vertexValue = defaultVertexValue;
    351.  
    352.                 #ifdef ASE_ABSOLUTE_VERTEX_POS
    353.                     v.vertex.xyz = vertexValue;
    354.                 #else
    355.                     v.vertex.xyz += vertexValue;
    356.                 #endif
    357.                 v.ase_normal = v.ase_normal;
    358.  
    359.                 float3 positionWS = TransformObjectToWorld( v.vertex.xyz );
    360.                 float3 positionVS = TransformWorldToView( positionWS );
    361.                 float4 positionCS = TransformWorldToHClip( positionWS );
    362.  
    363.                 VertexNormalInputs normalInput = GetVertexNormalInputs( v.ase_normal, v.ase_tangent );
    364.  
    365.                 o.tSpace0 = float4( normalInput.normalWS, positionWS.x);
    366.                 o.tSpace1 = float4( normalInput.tangentWS, positionWS.y);
    367.                 o.tSpace2 = float4( normalInput.bitangentWS, positionWS.z);
    368.  
    369.                 #if defined(LIGHTMAP_ON)
    370.                     OUTPUT_LIGHTMAP_UV( v.texcoord1, unity_LightmapST, o.lightmapUVOrVertexSH.xy );
    371.                 #endif
    372.  
    373.                 #if !defined(LIGHTMAP_ON)
    374.                     OUTPUT_SH( normalInput.normalWS.xyz, o.lightmapUVOrVertexSH.xyz );
    375.                 #endif
    376.  
    377.                 #if defined(DYNAMICLIGHTMAP_ON)
    378.                     o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw;
    379.                 #endif
    380.  
    381.                 #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL)
    382.                     o.lightmapUVOrVertexSH.zw = v.texcoord;
    383.                     o.lightmapUVOrVertexSH.xy = v.texcoord * unity_LightmapST.xy + unity_LightmapST.zw;
    384.                 #endif
    385.  
    386.                 half3 vertexLight = VertexLighting( positionWS, normalInput.normalWS );
    387.  
    388.                 #ifdef ASE_FOG
    389.                     half fogFactor = ComputeFogFactor( positionCS.z );
    390.                 #else
    391.                     half fogFactor = 0;
    392.                 #endif
    393.  
    394.                 o.fogFactorAndVertexLight = half4(fogFactor, vertexLight);
    395.  
    396.                 #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
    397.                     VertexPositionInputs vertexInput = (VertexPositionInputs)0;
    398.                     vertexInput.positionWS = positionWS;
    399.                     vertexInput.positionCS = positionCS;
    400.                     o.shadowCoord = GetShadowCoord( vertexInput );
    401.                 #endif
    402.  
    403.                 o.clipPos = positionCS;
    404.  
    405.                 #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION)
    406.                     o.screenPos = ComputeScreenPos(positionCS);
    407.                 #endif
    408.  
    409.                 return o;
    410.             }
    411.  
    412.             #if defined(ASE_TESSELLATION)
    413.             struct VertexControl
    414.             {
    415.                 float4 vertex : INTERNALTESSPOS;
    416.                 float3 ase_normal : NORMAL;
    417.                 float4 ase_tangent : TANGENT;
    418.                 float4 texcoord : TEXCOORD0;
    419.                 float4 texcoord1 : TEXCOORD1;
    420.                 float4 texcoord2 : TEXCOORD2;
    421.                
    422.                 UNITY_VERTEX_INPUT_INSTANCE_ID
    423.             };
    424.  
    425.             struct TessellationFactors
    426.             {
    427.                 float edge[3] : SV_TessFactor;
    428.                 float inside : SV_InsideTessFactor;
    429.             };
    430.  
    431.             VertexControl vert ( VertexInput v )
    432.             {
    433.                 VertexControl o;
    434.                 UNITY_SETUP_INSTANCE_ID(v);
    435.                 UNITY_TRANSFER_INSTANCE_ID(v, o);
    436.                 o.vertex = v.vertex;
    437.                 o.ase_normal = v.ase_normal;
    438.                 o.ase_tangent = v.ase_tangent;
    439.                 o.texcoord = v.texcoord;
    440.                 o.texcoord1 = v.texcoord1;
    441.                 o.texcoord2 = v.texcoord2;
    442.                
    443.                 return o;
    444.             }
    445.  
    446.             TessellationFactors TessellationFunction (InputPatch<VertexControl,3> v)
    447.             {
    448.                 TessellationFactors o;
    449.                 float4 tf = 1;
    450.                 float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
    451.                 float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
    452.                 #if defined(ASE_FIXED_TESSELLATION)
    453.                 tf = FixedTess( tessValue );
    454.                 #elif defined(ASE_DISTANCE_TESSELLATION)
    455.                 tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
    456.                 #elif defined(ASE_LENGTH_TESSELLATION)
    457.                 tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
    458.                 #elif defined(ASE_LENGTH_CULL_TESSELLATION)
    459.                 tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
    460.                 #endif
    461.                 o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w;
    462.                 return o;
    463.             }
    464.  
    465.             [domain("tri")]
    466.             [partitioning("fractional_odd")]
    467.             [outputtopology("triangle_cw")]
    468.             [patchconstantfunc("TessellationFunction")]
    469.             [outputcontrolpoints(3)]
    470.             VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
    471.             {
    472.                 return patch[id];
    473.             }
    474.  
    475.             [domain("tri")]
    476.             VertexOutput DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
    477.             {
    478.                 VertexInput o = (VertexInput) 0;
    479.                 o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
    480.                 o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z;
    481.                 o.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * bary.z;
    482.                 o.texcoord = patch[0].texcoord * bary.x + patch[1].texcoord * bary.y + patch[2].texcoord * bary.z;
    483.                 o.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z;
    484.                 o.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z;
    485.                
    486.                 #if defined(ASE_PHONG_TESSELLATION)
    487.                 float3 pp[3];
    488.                 for (int i = 0; i < 3; ++i)
    489.                     pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal));
    490.                 float phongStrength = _TessPhongStrength;
    491.                 o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz;
    492.                 #endif
    493.                 UNITY_TRANSFER_INSTANCE_ID(patch[0], o);
    494.                 return VertexFunction(o);
    495.             }
    496.             #else
    497.             VertexOutput vert ( VertexInput v )
    498.             {
    499.                 return VertexFunction( v );
    500.             }
    501.             #endif
    502.  
    503.             #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE)
    504.                 #define ASE_SV_DEPTH SV_DepthLessEqual
    505.             #else
    506.                 #define ASE_SV_DEPTH SV_Depth
    507.             #endif
    508.  
    509.             half4 frag ( VertexOutput IN
    510.                         #ifdef ASE_DEPTH_WRITE_ON
    511.                         ,out float outputDepth : ASE_SV_DEPTH
    512.                         #endif
    513.                          ) : SV_Target
    514.             {
    515.                 UNITY_SETUP_INSTANCE_ID(IN);
    516.                 UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN);
    517.  
    518.                 #ifdef LOD_FADE_CROSSFADE
    519.                     LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x );
    520.                 #endif
    521.  
    522.                 #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL)
    523.                     float2 sampleCoords = (IN.lightmapUVOrVertexSH.zw / _TerrainHeightmapRecipSize.zw + 0.5f) * _TerrainHeightmapRecipSize.xy;
    524.                     float3 WorldNormal = TransformObjectToWorldNormal(normalize(SAMPLE_TEXTURE2D(_TerrainNormalmapTexture, sampler_TerrainNormalmapTexture, sampleCoords).rgb * 2 - 1));
    525.                     float3 WorldTangent = -cross(GetObjectToWorldMatrix()._13_23_33, WorldNormal);
    526.                     float3 WorldBiTangent = cross(WorldNormal, -WorldTangent);
    527.                 #else
    528.                     float3 WorldNormal = normalize( IN.tSpace0.xyz );
    529.                     float3 WorldTangent = IN.tSpace1.xyz;
    530.                     float3 WorldBiTangent = IN.tSpace2.xyz;
    531.                 #endif
    532.  
    533.                 float3 WorldPosition = float3(IN.tSpace0.w,IN.tSpace1.w,IN.tSpace2.w);
    534.                 float3 WorldViewDirection = _WorldSpaceCameraPos.xyz  - WorldPosition;
    535.                 float4 ShadowCoords = float4( 0, 0, 0, 0 );
    536.  
    537.                 #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION)
    538.                     float4 ScreenPos = IN.screenPos;
    539.                 #endif
    540.  
    541.                 float2 NormalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.clipPos);
    542.  
    543.                 #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
    544.                     ShadowCoords = IN.shadowCoord;
    545.                 #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
    546.                     ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
    547.                 #endif
    548.  
    549.                 WorldViewDirection = SafeNormalize( WorldViewDirection );
    550.  
    551.                 float2 uv_MainTex = IN.ase_texcoord8.xy * _MainTex_ST.xy + _MainTex_ST.zw;
    552.                 float4 tex2DNode13 = tex2D( _MainTex, uv_MainTex );
    553.                
    554.  
    555.                 float3 BaseColor = tex2DNode13.rgb;
    556.                 float3 Normal = float3(0, 0, 1);
    557.                 float3 Emission = 0;
    558.                 float3 Specular = 0.5;
    559.                 float Metallic = 0.0;
    560.                 float Smoothness = 0.0;
    561.                 float Occlusion = 1.0;
    562.                 float Alpha = ( tex2DNode13.a * 1.0 );
    563.                 float AlphaClipThreshold = _AlphaClip;
    564.                 float AlphaClipThresholdShadow = _ShadowAlphaClip;
    565.                 float3 BakedGI = 0;
    566.                 float3 RefractionColor = 1;
    567.                 float RefractionIndex = 1;
    568.                 float3 Transmission = 1;
    569.                 float3 Translucency = 1;
    570.  
    571.                 #ifdef ASE_DEPTH_WRITE_ON
    572.                     float DepthValue = 0;
    573.                 #endif
    574.  
    575.                 #ifdef _CLEARCOAT
    576.                     float CoatMask = 0;
    577.                     float CoatSmoothness = 0;
    578.                 #endif
    579.  
    580.                 #ifdef _ALPHATEST_ON
    581.                     clip(Alpha - AlphaClipThreshold);
    582.                 #endif
    583.  
    584.                 InputData inputData = (InputData)0;
    585.                 inputData.positionWS = WorldPosition;
    586.                 inputData.viewDirectionWS = WorldViewDirection;
    587.  
    588.                 #ifdef _NORMALMAP
    589.                         #if _NORMAL_DROPOFF_TS
    590.                             inputData.normalWS = TransformTangentToWorld(Normal, half3x3(WorldTangent, WorldBiTangent, WorldNormal));
    591.                         #elif _NORMAL_DROPOFF_OS
    592.                             inputData.normalWS = TransformObjectToWorldNormal(Normal);
    593.                         #elif _NORMAL_DROPOFF_WS
    594.                             inputData.normalWS = Normal;
    595.                         #endif
    596.                     inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS);
    597.                 #else
    598.                     inputData.normalWS = WorldNormal;
    599.                 #endif
    600.  
    601.                 #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
    602.                     inputData.shadowCoord = ShadowCoords;
    603.                 #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
    604.                     inputData.shadowCoord = TransformWorldToShadowCoord(inputData.positionWS);
    605.                 #else
    606.                     inputData.shadowCoord = float4(0, 0, 0, 0);
    607.                 #endif
    608.  
    609.                 #ifdef ASE_FOG
    610.                     inputData.fogCoord = IN.fogFactorAndVertexLight.x;
    611.                 #endif
    612.                     inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw;
    613.  
    614.                 #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL)
    615.                     float3 SH = SampleSH(inputData.normalWS.xyz);
    616.                 #else
    617.                     float3 SH = IN.lightmapUVOrVertexSH.xyz;
    618.                 #endif
    619.  
    620.                 #if defined(DYNAMICLIGHTMAP_ON)
    621.                     inputData.bakedGI = SAMPLE_GI(IN.lightmapUVOrVertexSH.xy, IN.dynamicLightmapUV.xy, SH, inputData.normalWS);
    622.                 #else
    623.                     inputData.bakedGI = SAMPLE_GI(IN.lightmapUVOrVertexSH.xy, SH, inputData.normalWS);
    624.                 #endif
    625.  
    626.                 #ifdef ASE_BAKEDGI
    627.                     inputData.bakedGI = BakedGI;
    628.                 #endif
    629.  
    630.                 inputData.normalizedScreenSpaceUV = NormalizedScreenSpaceUV;
    631.                 inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUVOrVertexSH.xy);
    632.  
    633.                 #if defined(DEBUG_DISPLAY)
    634.                     #if defined(DYNAMICLIGHTMAP_ON)
    635.                         inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy;
    636.                     #endif
    637.                     #if defined(LIGHTMAP_ON)
    638.                         inputData.staticLightmapUV = IN.lightmapUVOrVertexSH.xy;
    639.                     #else
    640.                         inputData.vertexSH = SH;
    641.                     #endif
    642.                 #endif
    643.  
    644.                 SurfaceData surfaceData;
    645.                 surfaceData.albedo              = BaseColor;
    646.                 surfaceData.metallic            = saturate(Metallic);
    647.                 surfaceData.specular            = Specular;
    648.                 surfaceData.smoothness          = saturate(Smoothness),
    649.                 surfaceData.occlusion           = Occlusion,
    650.                 surfaceData.emission            = Emission,
    651.                 surfaceData.alpha               = saturate(Alpha);
    652.                 surfaceData.normalTS            = Normal;
    653.                 surfaceData.clearCoatMask       = 0;
    654.                 surfaceData.clearCoatSmoothness = 1;
    655.  
    656.                 #ifdef _CLEARCOAT
    657.                     surfaceData.clearCoatMask       = saturate(CoatMask);
    658.                     surfaceData.clearCoatSmoothness = saturate(CoatSmoothness);
    659.                 #endif
    660.  
    661.                 #ifdef _DBUFFER
    662.                     ApplyDecalToSurfaceData(IN.clipPos, surfaceData, inputData);
    663.                 #endif
    664.  
    665.                 half4 color = UniversalFragmentPBR( inputData, surfaceData);
    666.  
    667.                 #ifdef ASE_TRANSMISSION
    668.                 {
    669.                     float shadow = _TransmissionShadow;
    670.  
    671.                     Light mainLight = GetMainLight( inputData.shadowCoord );
    672.                     float3 mainAtten = mainLight.color * mainLight.distanceAttenuation;
    673.                     mainAtten = lerp( mainAtten, mainAtten * mainLight.shadowAttenuation, shadow );
    674.                     half3 mainTransmission = max(0 , -dot(inputData.normalWS, mainLight.direction)) * mainAtten * Transmission;
    675.                     color.rgb += BaseColor * mainTransmission;
    676.  
    677.                     #ifdef _ADDITIONAL_LIGHTS
    678.                         int transPixelLightCount = GetAdditionalLightsCount();
    679.                         for (int i = 0; i < transPixelLightCount; ++i)
    680.                         {
    681.                             Light light = GetAdditionalLight(i, inputData.positionWS);
    682.                             float3 atten = light.color * light.distanceAttenuation;
    683.                             atten = lerp( atten, atten * light.shadowAttenuation, shadow );
    684.  
    685.                             half3 transmission = max(0 , -dot(inputData.normalWS, light.direction)) * atten * Transmission;
    686.                             color.rgb += BaseColor * transmission;
    687.                         }
    688.                     #endif
    689.                 }
    690.                 #endif
    691.  
    692.                 #ifdef ASE_TRANSLUCENCY
    693.                 {
    694.                     float shadow = _TransShadow;
    695.                     float normal = _TransNormal;
    696.                     float scattering = _TransScattering;
    697.                     float direct = _TransDirect;
    698.                     float ambient = _TransAmbient;
    699.                     float strength = _TransStrength;
    700.  
    701.                     Light mainLight = GetMainLight( inputData.shadowCoord );
    702.                     float3 mainAtten = mainLight.color * mainLight.distanceAttenuation;
    703.                     mainAtten = lerp( mainAtten, mainAtten * mainLight.shadowAttenuation, shadow );
    704.  
    705.                     half3 mainLightDir = mainLight.direction + inputData.normalWS * normal;
    706.                     half mainVdotL = pow( saturate( dot( inputData.viewDirectionWS, -mainLightDir ) ), scattering );
    707.                     half3 mainTranslucency = mainAtten * ( mainVdotL * direct + inputData.bakedGI * ambient ) * Translucency;
    708.                     color.rgb += BaseColor * mainTranslucency * strength;
    709.  
    710.                     #ifdef _ADDITIONAL_LIGHTS
    711.                         int transPixelLightCount = GetAdditionalLightsCount();
    712.                         for (int i = 0; i < transPixelLightCount; ++i)
    713.                         {
    714.                             Light light = GetAdditionalLight(i, inputData.positionWS);
    715.                             float3 atten = light.color * light.distanceAttenuation;
    716.                             atten = lerp( atten, atten * light.shadowAttenuation, shadow );
    717.  
    718.                             half3 lightDir = light.direction + inputData.normalWS * normal;
    719.                             half VdotL = pow( saturate( dot( inputData.viewDirectionWS, -lightDir ) ), scattering );
    720.                             half3 translucency = atten * ( VdotL * direct + inputData.bakedGI * ambient ) * Translucency;
    721.                             color.rgb += BaseColor * translucency * strength;
    722.                         }
    723.                     #endif
    724.                 }
    725.                 #endif
    726.  
    727.                 #ifdef ASE_REFRACTION
    728.                     float4 projScreenPos = ScreenPos / ScreenPos.w;
    729.                     float3 refractionOffset = ( RefractionIndex - 1.0 ) * mul( UNITY_MATRIX_V, float4( WorldNormal,0 ) ).xyz * ( 1.0 - dot( WorldNormal, WorldViewDirection ) );
    730.                     projScreenPos.xy += refractionOffset.xy;
    731.                     float3 refraction = SHADERGRAPH_SAMPLE_SCENE_COLOR( projScreenPos.xy ) * RefractionColor;
    732.                     color.rgb = lerp( refraction, color.rgb, color.a );
    733.                     color.a = 1;
    734.                 #endif
    735.  
    736.                 #ifdef ASE_FINAL_COLOR_ALPHA_MULTIPLY
    737.                     color.rgb *= color.a;
    738.                 #endif
    739.  
    740.                 #ifdef ASE_FOG
    741.                     #ifdef TERRAIN_SPLAT_ADDPASS
    742.                         color.rgb = MixFogColor(color.rgb, half3( 0, 0, 0 ), IN.fogFactorAndVertexLight.x );
    743.                     #else
    744.                         color.rgb = MixFog(color.rgb, IN.fogFactorAndVertexLight.x);
    745.                     #endif
    746.                 #endif
    747.  
    748.                 #ifdef ASE_DEPTH_WRITE_ON
    749.                     outputDepth = DepthValue;
    750.                 #endif
    751.  
    752.                 return color;
    753.             }
    754.  
    755.             ENDHLSL
    756.         }
    757.  
    758.        
    759.         Pass
    760.         {
    761.            
    762.             Name "ShadowCaster"
    763.             Tags { "LightMode"="ShadowCaster" }
    764.  
    765.             ZWrite On
    766.             ZTest LEqual
    767.             AlphaToMask Off
    768.             ColorMask 0
    769.  
    770.             HLSLPROGRAM
    771.  
    772.             #define _NORMAL_DROPOFF_TS 1
    773.             #pragma multi_compile_instancing
    774.             #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE
    775.             #define ASE_FOG 1
    776.             #define _ALPHATEST_SHADOW_ON 1
    777.             #define _ALPHATEST_ON 1
    778.             #define ASE_SRP_VERSION 120107
    779.  
    780.  
    781.             #pragma vertex vert
    782.             #pragma fragment frag
    783.  
    784.             #pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW
    785.  
    786.             #define SHADERPASS SHADERPASS_SHADOWCASTER
    787.  
    788.             #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
    789.             #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
    790.             #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
    791.             #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
    792.             #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
    793.             #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
    794.             #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
    795.             #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
    796.  
    797.            
    798.  
    799.             struct VertexInput
    800.             {
    801.                 float4 vertex : POSITION;
    802.                 float3 ase_normal : NORMAL;
    803.                 float4 ase_texcoord : TEXCOORD0;
    804.                 UNITY_VERTEX_INPUT_INSTANCE_ID
    805.             };
    806.  
    807.             struct VertexOutput
    808.             {
    809.                 float4 clipPos : SV_POSITION;
    810.                 #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
    811.                     float3 worldPos : TEXCOORD0;
    812.                 #endif
    813.                 #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
    814.                     float4 shadowCoord : TEXCOORD1;
    815.                 #endif
    816.                 float4 ase_texcoord2 : TEXCOORD2;
    817.                 UNITY_VERTEX_INPUT_INSTANCE_ID
    818.                 UNITY_VERTEX_OUTPUT_STEREO
    819.             };
    820.  
    821.             CBUFFER_START(UnityPerMaterial)
    822.             float4 _MainTex_ST;
    823.             float _ZWriteMode;
    824.             int _ZTestMode;
    825.             float _StencilValue;
    826.             float _AlphaClip;
    827.             float _ShadowAlphaClip;
    828.             #ifdef ASE_TRANSMISSION
    829.                 float _TransmissionShadow;
    830.             #endif
    831.             #ifdef ASE_TRANSLUCENCY
    832.                 float _TransStrength;
    833.                 float _TransNormal;
    834.                 float _TransScattering;
    835.                 float _TransDirect;
    836.                 float _TransAmbient;
    837.                 float _TransShadow;
    838.             #endif
    839.             #ifdef ASE_TESSELLATION
    840.                 float _TessPhongStrength;
    841.                 float _TessValue;
    842.                 float _TessMin;
    843.                 float _TessMax;
    844.                 float _TessEdgeLength;
    845.                 float _TessMaxDisp;
    846.             #endif
    847.             CBUFFER_END
    848.  
    849.             // Property used by ScenePickingPass
    850.             #ifdef SCENEPICKINGPASS
    851.                 float4 _SelectionID;
    852.             #endif
    853.  
    854.             // Properties used by SceneSelectionPass
    855.             #ifdef SCENESELECTIONPASS
    856.                 int _ObjectId;
    857.                 int _PassValue;
    858.             #endif
    859.  
    860.             sampler2D _MainTex;
    861.  
    862.  
    863.             //#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/Varyings.hlsl"
    864.             //#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShadowCasterPass.hlsl"
    865.  
    866.             //#ifdef HAVE_VFX_MODIFICATION
    867.             //#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/VisualEffectVertex.hlsl"
    868.             //#endif
    869.  
    870.            
    871.             float3 _LightDirection;
    872.             float3 _LightPosition;
    873.  
    874.             VertexOutput VertexFunction( VertexInput v )
    875.             {
    876.                 VertexOutput o;
    877.                 UNITY_SETUP_INSTANCE_ID(v);
    878.                 UNITY_TRANSFER_INSTANCE_ID(v, o);
    879.                 UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o );
    880.  
    881.                 o.ase_texcoord2.xy = v.ase_texcoord.xy;
    882.                
    883.                 //setting value to unused interpolator channels and avoid initialization warnings
    884.                 o.ase_texcoord2.zw = 0;
    885.  
    886.                 #ifdef ASE_ABSOLUTE_VERTEX_POS
    887.                     float3 defaultVertexValue = v.vertex.xyz;
    888.                 #else
    889.                     float3 defaultVertexValue = float3(0, 0, 0);
    890.                 #endif
    891.  
    892.                 float3 vertexValue = defaultVertexValue;
    893.                 #ifdef ASE_ABSOLUTE_VERTEX_POS
    894.                     v.vertex.xyz = vertexValue;
    895.                 #else
    896.                     v.vertex.xyz += vertexValue;
    897.                 #endif
    898.  
    899.                 v.ase_normal = v.ase_normal;
    900.  
    901.                 float3 positionWS = TransformObjectToWorld( v.vertex.xyz );
    902.  
    903.                 #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
    904.                     o.worldPos = positionWS;
    905.                 #endif
    906.  
    907.                 float3 normalWS = TransformObjectToWorldDir(v.ase_normal);
    908.  
    909.                 #if _CASTING_PUNCTUAL_LIGHT_SHADOW
    910.                     float3 lightDirectionWS = normalize(_LightPosition - positionWS);
    911.                 #else
    912.                     float3 lightDirectionWS = _LightDirection;
    913.                 #endif
    914.  
    915.                 float4 clipPos = TransformWorldToHClip(ApplyShadowBias(positionWS, normalWS, lightDirectionWS));
    916.  
    917.                 #if UNITY_REVERSED_Z
    918.                     clipPos.z = min(clipPos.z, UNITY_NEAR_CLIP_VALUE);
    919.                 #else
    920.                     clipPos.z = max(clipPos.z, UNITY_NEAR_CLIP_VALUE);
    921.                 #endif
    922.  
    923.                 #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
    924.                     VertexPositionInputs vertexInput = (VertexPositionInputs)0;
    925.                     vertexInput.positionWS = positionWS;
    926.                     vertexInput.positionCS = clipPos;
    927.                     o.shadowCoord = GetShadowCoord( vertexInput );
    928.                 #endif
    929.  
    930.                 o.clipPos = clipPos;
    931.  
    932.                 return o;
    933.             }
    934.  
    935.             #if defined(ASE_TESSELLATION)
    936.             struct VertexControl
    937.             {
    938.                 float4 vertex : INTERNALTESSPOS;
    939.                 float3 ase_normal : NORMAL;
    940.                 float4 ase_texcoord : TEXCOORD0;
    941.  
    942.                 UNITY_VERTEX_INPUT_INSTANCE_ID
    943.             };
    944.  
    945.             struct TessellationFactors
    946.             {
    947.                 float edge[3] : SV_TessFactor;
    948.                 float inside : SV_InsideTessFactor;
    949.             };
    950.  
    951.             VertexControl vert ( VertexInput v )
    952.             {
    953.                 VertexControl o;
    954.                 UNITY_SETUP_INSTANCE_ID(v);
    955.                 UNITY_TRANSFER_INSTANCE_ID(v, o);
    956.                 o.vertex = v.vertex;
    957.                 o.ase_normal = v.ase_normal;
    958.                 o.ase_texcoord = v.ase_texcoord;
    959.                 return o;
    960.             }
    961.  
    962.             TessellationFactors TessellationFunction (InputPatch<VertexControl,3> v)
    963.             {
    964.                 TessellationFactors o;
    965.                 float4 tf = 1;
    966.                 float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
    967.                 float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
    968.                 #if defined(ASE_FIXED_TESSELLATION)
    969.                 tf = FixedTess( tessValue );
    970.                 #elif defined(ASE_DISTANCE_TESSELLATION)
    971.                 tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
    972.                 #elif defined(ASE_LENGTH_TESSELLATION)
    973.                 tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
    974.                 #elif defined(ASE_LENGTH_CULL_TESSELLATION)
    975.                 tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
    976.                 #endif
    977.                 o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w;
    978.                 return o;
    979.             }
    980.  
    981.             [domain("tri")]
    982.             [partitioning("fractional_odd")]
    983.             [outputtopology("triangle_cw")]
    984.             [patchconstantfunc("TessellationFunction")]
    985.             [outputcontrolpoints(3)]
    986.             VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
    987.             {
    988.                 return patch[id];
    989.             }
    990.  
    991.             [domain("tri")]
    992.             VertexOutput DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
    993.             {
    994.                 VertexInput o = (VertexInput) 0;
    995.                 o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
    996.                 o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z;
    997.                 o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z;
    998.                 #if defined(ASE_PHONG_TESSELLATION)
    999.                 float3 pp[3];
    1000.                 for (int i = 0; i < 3; ++i)
    1001.                     pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal));
    1002.                 float phongStrength = _TessPhongStrength;
    1003.                 o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz;
    1004.                 #endif
    1005.                 UNITY_TRANSFER_INSTANCE_ID(patch[0], o);
    1006.                 return VertexFunction(o);
    1007.             }
    1008.             #else
    1009.             VertexOutput vert ( VertexInput v )
    1010.             {
    1011.                 return VertexFunction( v );
    1012.             }
    1013.             #endif
    1014.  
    1015.             #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE)
    1016.                 #define ASE_SV_DEPTH SV_DepthLessEqual
    1017.             #else
    1018.                 #define ASE_SV_DEPTH SV_Depth
    1019.             #endif
    1020.  
    1021.             half4 frag(    VertexOutput IN
    1022.                         #ifdef ASE_DEPTH_WRITE_ON
    1023.                         ,out float outputDepth : ASE_SV_DEPTH
    1024.                         #endif
    1025.                          ) : SV_TARGET
    1026.             {
    1027.                 UNITY_SETUP_INSTANCE_ID( IN );
    1028.                 UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN );
    1029.  
    1030.                 #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
    1031.                     float3 WorldPosition = IN.worldPos;
    1032.                 #endif
    1033.  
    1034.                 float4 ShadowCoords = float4( 0, 0, 0, 0 );
    1035.  
    1036.                 #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
    1037.                     #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
    1038.                         ShadowCoords = IN.shadowCoord;
    1039.                     #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
    1040.                         ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
    1041.                     #endif
    1042.                 #endif
    1043.  
    1044.                 float2 uv_MainTex = IN.ase_texcoord2.xy * _MainTex_ST.xy + _MainTex_ST.zw;
    1045.                 float4 tex2DNode13 = tex2D( _MainTex, uv_MainTex );
    1046.                
    1047.  
    1048.                 float Alpha = ( tex2DNode13.a * 1.0 );
    1049.                 float AlphaClipThreshold = _AlphaClip;
    1050.                 float AlphaClipThresholdShadow = _ShadowAlphaClip;
    1051.  
    1052.                 #ifdef ASE_DEPTH_WRITE_ON
    1053.                     float DepthValue = 0;
    1054.                 #endif
    1055.  
    1056.                 #ifdef _ALPHATEST_ON
    1057.                     #ifdef _ALPHATEST_SHADOW_ON
    1058.                         clip(Alpha - AlphaClipThresholdShadow);
    1059.                     #else
    1060.                         clip(Alpha - AlphaClipThreshold);
    1061.                     #endif
    1062.                 #endif
    1063.  
    1064.                 #ifdef LOD_FADE_CROSSFADE
    1065.                     LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x );
    1066.                 #endif
    1067.  
    1068.                 #ifdef ASE_DEPTH_WRITE_ON
    1069.                     outputDepth = DepthValue;
    1070.                 #endif
    1071.  
    1072.                 return 0;
    1073.             }
    1074.             ENDHLSL
    1075.         }
    1076.  
    1077.        
    1078.         Pass
    1079.         {
    1080.            
    1081.             Name "DepthOnly"
    1082.             Tags { "LightMode"="DepthOnly" }
    1083.  
    1084.             ZWrite On
    1085.             ColorMask 0
    1086.             AlphaToMask Off
    1087.  
    1088.             HLSLPROGRAM
    1089.  
    1090.             #define _NORMAL_DROPOFF_TS 1
    1091.             #pragma multi_compile_instancing
    1092.             #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE
    1093.             #define ASE_FOG 1
    1094.             #define _ALPHATEST_SHADOW_ON 1
    1095.             #define _ALPHATEST_ON 1
    1096.             #define ASE_SRP_VERSION 120107
    1097.  
    1098.  
    1099.             #pragma vertex vert
    1100.             #pragma fragment frag
    1101.  
    1102.             #define SHADERPASS SHADERPASS_DEPTHONLY
    1103.  
    1104.             #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
    1105.             #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
    1106.             #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
    1107.             #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
    1108.             #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
    1109.             #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
    1110.             #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
    1111.             #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
    1112.  
    1113.            
    1114.  
    1115.             struct VertexInput
    1116.             {
    1117.                 float4 vertex : POSITION;
    1118.                 float3 ase_normal : NORMAL;
    1119.                 float4 ase_texcoord : TEXCOORD0;
    1120.                 UNITY_VERTEX_INPUT_INSTANCE_ID
    1121.             };
    1122.  
    1123.             struct VertexOutput
    1124.             {
    1125.                 float4 clipPos : SV_POSITION;
    1126.                 #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
    1127.                 float3 worldPos : TEXCOORD0;
    1128.                 #endif
    1129.                 #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
    1130.                 float4 shadowCoord : TEXCOORD1;
    1131.                 #endif
    1132.                 float4 ase_texcoord2 : TEXCOORD2;
    1133.                 UNITY_VERTEX_INPUT_INSTANCE_ID
    1134.                 UNITY_VERTEX_OUTPUT_STEREO
    1135.             };
    1136.  
    1137.             CBUFFER_START(UnityPerMaterial)
    1138.             float4 _MainTex_ST;
    1139.             float _ZWriteMode;
    1140.             int _ZTestMode;
    1141.             float _StencilValue;
    1142.             float _AlphaClip;
    1143.             float _ShadowAlphaClip;
    1144.             #ifdef ASE_TRANSMISSION
    1145.                 float _TransmissionShadow;
    1146.             #endif
    1147.             #ifdef ASE_TRANSLUCENCY
    1148.                 float _TransStrength;
    1149.                 float _TransNormal;
    1150.                 float _TransScattering;
    1151.                 float _TransDirect;
    1152.                 float _TransAmbient;
    1153.                 float _TransShadow;
    1154.             #endif
    1155.             #ifdef ASE_TESSELLATION
    1156.                 float _TessPhongStrength;
    1157.                 float _TessValue;
    1158.                 float _TessMin;
    1159.                 float _TessMax;
    1160.                 float _TessEdgeLength;
    1161.                 float _TessMaxDisp;
    1162.             #endif
    1163.             CBUFFER_END
    1164.  
    1165.             // Property used by ScenePickingPass
    1166.             #ifdef SCENEPICKINGPASS
    1167.                 float4 _SelectionID;
    1168.             #endif
    1169.  
    1170.             // Properties used by SceneSelectionPass
    1171.             #ifdef SCENESELECTIONPASS
    1172.                 int _ObjectId;
    1173.                 int _PassValue;
    1174.             #endif
    1175.  
    1176.             sampler2D _MainTex;
    1177.  
    1178.  
    1179.             //#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/Varyings.hlsl"
    1180.             //#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/DepthOnlyPass.hlsl"
    1181.  
    1182.             //#ifdef HAVE_VFX_MODIFICATION
    1183.             //#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/VisualEffectVertex.hlsl"
    1184.             //#endif
    1185.  
    1186.            
    1187.             VertexOutput VertexFunction( VertexInput v  )
    1188.             {
    1189.                 VertexOutput o = (VertexOutput)0;
    1190.                 UNITY_SETUP_INSTANCE_ID(v);
    1191.                 UNITY_TRANSFER_INSTANCE_ID(v, o);
    1192.                 UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
    1193.  
    1194.                 o.ase_texcoord2.xy = v.ase_texcoord.xy;
    1195.                
    1196.                 //setting value to unused interpolator channels and avoid initialization warnings
    1197.                 o.ase_texcoord2.zw = 0;
    1198.  
    1199.                 #ifdef ASE_ABSOLUTE_VERTEX_POS
    1200.                     float3 defaultVertexValue = v.vertex.xyz;
    1201.                 #else
    1202.                     float3 defaultVertexValue = float3(0, 0, 0);
    1203.                 #endif
    1204.  
    1205.                 float3 vertexValue = defaultVertexValue;
    1206.  
    1207.                 #ifdef ASE_ABSOLUTE_VERTEX_POS
    1208.                     v.vertex.xyz = vertexValue;
    1209.                 #else
    1210.                     v.vertex.xyz += vertexValue;
    1211.                 #endif
    1212.  
    1213.                 v.ase_normal = v.ase_normal;
    1214.                 float3 positionWS = TransformObjectToWorld( v.vertex.xyz );
    1215.                 float4 positionCS = TransformWorldToHClip( positionWS );
    1216.  
    1217.                 #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
    1218.                     o.worldPos = positionWS;
    1219.                 #endif
    1220.  
    1221.                 #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
    1222.                     VertexPositionInputs vertexInput = (VertexPositionInputs)0;
    1223.                     vertexInput.positionWS = positionWS;
    1224.                     vertexInput.positionCS = positionCS;
    1225.                     o.shadowCoord = GetShadowCoord( vertexInput );
    1226.                 #endif
    1227.  
    1228.                 o.clipPos = positionCS;
    1229.  
    1230.                 return o;
    1231.             }
    1232.  
    1233.             #if defined(ASE_TESSELLATION)
    1234.             struct VertexControl
    1235.             {
    1236.                 float4 vertex : INTERNALTESSPOS;
    1237.                 float3 ase_normal : NORMAL;
    1238.                 float4 ase_texcoord : TEXCOORD0;
    1239.  
    1240.                 UNITY_VERTEX_INPUT_INSTANCE_ID
    1241.             };
    1242.  
    1243.             struct TessellationFactors
    1244.             {
    1245.                 float edge[3] : SV_TessFactor;
    1246.                 float inside : SV_InsideTessFactor;
    1247.             };
    1248.  
    1249.             VertexControl vert ( VertexInput v )
    1250.             {
    1251.                 VertexControl o;
    1252.                 UNITY_SETUP_INSTANCE_ID(v);
    1253.                 UNITY_TRANSFER_INSTANCE_ID(v, o);
    1254.                 o.vertex = v.vertex;
    1255.                 o.ase_normal = v.ase_normal;
    1256.                 o.ase_texcoord = v.ase_texcoord;
    1257.                 return o;
    1258.             }
    1259.  
    1260.             TessellationFactors TessellationFunction (InputPatch<VertexControl,3> v)
    1261.             {
    1262.                 TessellationFactors o;
    1263.                 float4 tf = 1;
    1264.                 float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
    1265.                 float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
    1266.                 #if defined(ASE_FIXED_TESSELLATION)
    1267.                 tf = FixedTess( tessValue );
    1268.                 #elif defined(ASE_DISTANCE_TESSELLATION)
    1269.                 tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
    1270.                 #elif defined(ASE_LENGTH_TESSELLATION)
    1271.                 tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
    1272.                 #elif defined(ASE_LENGTH_CULL_TESSELLATION)
    1273.                 tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
    1274.                 #endif
    1275.                 o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w;
    1276.                 return o;
    1277.             }
    1278.  
    1279.             [domain("tri")]
    1280.             [partitioning("fractional_odd")]
    1281.             [outputtopology("triangle_cw")]
    1282.             [patchconstantfunc("TessellationFunction")]
    1283.             [outputcontrolpoints(3)]
    1284.             VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
    1285.             {
    1286.                 return patch[id];
    1287.             }
    1288.  
    1289.             [domain("tri")]
    1290.             VertexOutput DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
    1291.             {
    1292.                 VertexInput o = (VertexInput) 0;
    1293.                 o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
    1294.                 o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z;
    1295.                 o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z;
    1296.                 #if defined(ASE_PHONG_TESSELLATION)
    1297.                 float3 pp[3];
    1298.                 for (int i = 0; i < 3; ++i)
    1299.                     pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal));
    1300.                 float phongStrength = _TessPhongStrength;
    1301.                 o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz;
    1302.                 #endif
    1303.                 UNITY_TRANSFER_INSTANCE_ID(patch[0], o);
    1304.                 return VertexFunction(o);
    1305.             }
    1306.             #else
    1307.             VertexOutput vert ( VertexInput v )
    1308.             {
    1309.                 return VertexFunction( v );
    1310.             }
    1311.             #endif
    1312.  
    1313.             #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE)
    1314.                 #define ASE_SV_DEPTH SV_DepthLessEqual
    1315.             #else
    1316.                 #define ASE_SV_DEPTH SV_Depth
    1317.             #endif
    1318.  
    1319.             half4 frag(    VertexOutput IN
    1320.                         #ifdef ASE_DEPTH_WRITE_ON
    1321.                         ,out float outputDepth : ASE_SV_DEPTH
    1322.                         #endif
    1323.                          ) : SV_TARGET
    1324.             {
    1325.                 UNITY_SETUP_INSTANCE_ID(IN);
    1326.                 UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN );
    1327.  
    1328.                 #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
    1329.                 float3 WorldPosition = IN.worldPos;
    1330.                 #endif
    1331.  
    1332.                 float4 ShadowCoords = float4( 0, 0, 0, 0 );
    1333.  
    1334.                 #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
    1335.                     #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
    1336.                         ShadowCoords = IN.shadowCoord;
    1337.                     #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
    1338.                         ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
    1339.                     #endif
    1340.                 #endif
    1341.  
    1342.                 float2 uv_MainTex = IN.ase_texcoord2.xy * _MainTex_ST.xy + _MainTex_ST.zw;
    1343.                 float4 tex2DNode13 = tex2D( _MainTex, uv_MainTex );
    1344.                
    1345.  
    1346.                 float Alpha = ( tex2DNode13.a * 1.0 );
    1347.                 float AlphaClipThreshold = _AlphaClip;
    1348.                 #ifdef ASE_DEPTH_WRITE_ON
    1349.                     float DepthValue = 0;
    1350.                 #endif
    1351.  
    1352.                 #ifdef _ALPHATEST_ON
    1353.                     clip(Alpha - AlphaClipThreshold);
    1354.                 #endif
    1355.  
    1356.                 #ifdef LOD_FADE_CROSSFADE
    1357.                     LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x );
    1358.                 #endif
    1359.  
    1360.                 #ifdef ASE_DEPTH_WRITE_ON
    1361.                     outputDepth = DepthValue;
    1362.                 #endif
    1363.  
    1364.                 return 0;
    1365.             }
    1366.             ENDHLSL
    1367.         }
    1368.  
    1369.        
    1370.         Pass
    1371.         {
    1372.            
    1373.             Name "Meta"
    1374.             Tags { "LightMode"="Meta" }
    1375.  
    1376.             Cull Off
    1377.  
    1378.             HLSLPROGRAM
    1379.  
    1380.             #define _NORMAL_DROPOFF_TS 1
    1381.             #define ASE_FOG 1
    1382.             #define _ALPHATEST_SHADOW_ON 1
    1383.             #define _ALPHATEST_ON 1
    1384.             #define ASE_SRP_VERSION 120107
    1385.  
    1386.  
    1387.             #pragma vertex vert
    1388.             #pragma fragment frag
    1389.  
    1390.             #pragma shader_feature EDITOR_VISUALIZATION
    1391.  
    1392.             #define SHADERPASS SHADERPASS_META
    1393.  
    1394.             #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
    1395.             #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
    1396.             #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
    1397.             #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
    1398.             #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
    1399.             #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
    1400.             #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
    1401.             #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MetaInput.hlsl"
    1402.             #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
    1403.  
    1404.            
    1405.  
    1406.             struct VertexInput
    1407.             {
    1408.                 float4 vertex : POSITION;
    1409.                 float3 ase_normal : NORMAL;
    1410.                 float4 texcoord0 : TEXCOORD0;
    1411.                 float4 texcoord1 : TEXCOORD1;
    1412.                 float4 texcoord2 : TEXCOORD2;
    1413.                
    1414.                 UNITY_VERTEX_INPUT_INSTANCE_ID
    1415.             };
    1416.  
    1417.             struct VertexOutput
    1418.             {
    1419.                 float4 clipPos : SV_POSITION;
    1420.                 #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
    1421.                     float3 worldPos : TEXCOORD0;
    1422.                 #endif
    1423.                 #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
    1424.                     float4 shadowCoord : TEXCOORD1;
    1425.                 #endif
    1426.                 #ifdef EDITOR_VISUALIZATION
    1427.                     float4 VizUV : TEXCOORD2;
    1428.                     float4 LightCoord : TEXCOORD3;
    1429.                 #endif
    1430.                 float4 ase_texcoord4 : TEXCOORD4;
    1431.                 UNITY_VERTEX_INPUT_INSTANCE_ID
    1432.                 UNITY_VERTEX_OUTPUT_STEREO
    1433.             };
    1434.  
    1435.             CBUFFER_START(UnityPerMaterial)
    1436.             float4 _MainTex_ST;
    1437.             float _ZWriteMode;
    1438.             int _ZTestMode;
    1439.             float _StencilValue;
    1440.             float _AlphaClip;
    1441.             float _ShadowAlphaClip;
    1442.             #ifdef ASE_TRANSMISSION
    1443.                 float _TransmissionShadow;
    1444.             #endif
    1445.             #ifdef ASE_TRANSLUCENCY
    1446.                 float _TransStrength;
    1447.                 float _TransNormal;
    1448.                 float _TransScattering;
    1449.                 float _TransDirect;
    1450.                 float _TransAmbient;
    1451.                 float _TransShadow;
    1452.             #endif
    1453.             #ifdef ASE_TESSELLATION
    1454.                 float _TessPhongStrength;
    1455.                 float _TessValue;
    1456.                 float _TessMin;
    1457.                 float _TessMax;
    1458.                 float _TessEdgeLength;
    1459.                 float _TessMaxDisp;
    1460.             #endif
    1461.             CBUFFER_END
    1462.  
    1463.             // Property used by ScenePickingPass
    1464.             #ifdef SCENEPICKINGPASS
    1465.                 float4 _SelectionID;
    1466.             #endif
    1467.  
    1468.             // Properties used by SceneSelectionPass
    1469.             #ifdef SCENESELECTIONPASS
    1470.                 int _ObjectId;
    1471.                 int _PassValue;
    1472.             #endif
    1473.  
    1474.             sampler2D _MainTex;
    1475.  
    1476.  
    1477.             //#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/Varyings.hlsl"
    1478.             //#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/LightingMetaPass.hlsl"
    1479.  
    1480.             //#ifdef HAVE_VFX_MODIFICATION
    1481.             //#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/VisualEffectVertex.hlsl"
    1482.             //#endif
    1483.  
    1484.            
    1485.             VertexOutput VertexFunction( VertexInput v  )
    1486.             {
    1487.                 VertexOutput o = (VertexOutput)0;
    1488.                 UNITY_SETUP_INSTANCE_ID(v);
    1489.                 UNITY_TRANSFER_INSTANCE_ID(v, o);
    1490.                 UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
    1491.  
    1492.                 o.ase_texcoord4.xy = v.texcoord0.xy;
    1493.                
    1494.                 //setting value to unused interpolator channels and avoid initialization warnings
    1495.                 o.ase_texcoord4.zw = 0;
    1496.  
    1497.                 #ifdef ASE_ABSOLUTE_VERTEX_POS
    1498.                     float3 defaultVertexValue = v.vertex.xyz;
    1499.                 #else
    1500.                     float3 defaultVertexValue = float3(0, 0, 0);
    1501.                 #endif
    1502.  
    1503.                 float3 vertexValue = defaultVertexValue;
    1504.  
    1505.                 #ifdef ASE_ABSOLUTE_VERTEX_POS
    1506.                     v.vertex.xyz = vertexValue;
    1507.                 #else
    1508.                     v.vertex.xyz += vertexValue;
    1509.                 #endif
    1510.  
    1511.                 v.ase_normal = v.ase_normal;
    1512.  
    1513.                 float3 positionWS = TransformObjectToWorld( v.vertex.xyz );
    1514.  
    1515.                 #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
    1516.                     o.worldPos = positionWS;
    1517.                 #endif
    1518.  
    1519.                 o.clipPos = MetaVertexPosition( v.vertex, v.texcoord1.xy, v.texcoord1.xy, unity_LightmapST, unity_DynamicLightmapST );
    1520.  
    1521.                 #ifdef EDITOR_VISUALIZATION
    1522.                     float2 VizUV = 0;
    1523.                     float4 LightCoord = 0;
    1524.                     UnityEditorVizData(v.vertex.xyz, v.texcoord0.xy, v.texcoord1.xy, v.texcoord2.xy, VizUV, LightCoord);
    1525.                     o.VizUV = float4(VizUV, 0, 0);
    1526.                     o.LightCoord = LightCoord;
    1527.                 #endif
    1528.  
    1529.                 #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
    1530.                     VertexPositionInputs vertexInput = (VertexPositionInputs)0;
    1531.                     vertexInput.positionWS = positionWS;
    1532.                     vertexInput.positionCS = o.clipPos;
    1533.                     o.shadowCoord = GetShadowCoord( vertexInput );
    1534.                 #endif
    1535.  
    1536.                 return o;
    1537.             }
    1538.  
    1539.             #if defined(ASE_TESSELLATION)
    1540.             struct VertexControl
    1541.             {
    1542.                 float4 vertex : INTERNALTESSPOS;
    1543.                 float3 ase_normal : NORMAL;
    1544.                 float4 texcoord0 : TEXCOORD0;
    1545.                 float4 texcoord1 : TEXCOORD1;
    1546.                 float4 texcoord2 : TEXCOORD2;
    1547.                
    1548.                 UNITY_VERTEX_INPUT_INSTANCE_ID
    1549.             };
    1550.  
    1551.             struct TessellationFactors
    1552.             {
    1553.                 float edge[3] : SV_TessFactor;
    1554.                 float inside : SV_InsideTessFactor;
    1555.             };
    1556.  
    1557.             VertexControl vert ( VertexInput v )
    1558.             {
    1559.                 VertexControl o;
    1560.                 UNITY_SETUP_INSTANCE_ID(v);
    1561.                 UNITY_TRANSFER_INSTANCE_ID(v, o);
    1562.                 o.vertex = v.vertex;
    1563.                 o.ase_normal = v.ase_normal;
    1564.                 o.texcoord0 = v.texcoord0;
    1565.                 o.texcoord1 = v.texcoord1;
    1566.                 o.texcoord2 = v.texcoord2;
    1567.                
    1568.                 return o;
    1569.             }
    1570.  
    1571.             TessellationFactors TessellationFunction (InputPatch<VertexControl,3> v)
    1572.             {
    1573.                 TessellationFactors o;
    1574.                 float4 tf = 1;
    1575.                 float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
    1576.                 float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
    1577.                 #if defined(ASE_FIXED_TESSELLATION)
    1578.                 tf = FixedTess( tessValue );
    1579.                 #elif defined(ASE_DISTANCE_TESSELLATION)
    1580.                 tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
    1581.                 #elif defined(ASE_LENGTH_TESSELLATION)
    1582.                 tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
    1583.                 #elif defined(ASE_LENGTH_CULL_TESSELLATION)
    1584.                 tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
    1585.                 #endif
    1586.                 o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w;
    1587.                 return o;
    1588.             }
    1589.  
    1590.             [domain("tri")]
    1591.             [partitioning("fractional_odd")]
    1592.             [outputtopology("triangle_cw")]
    1593.             [patchconstantfunc("TessellationFunction")]
    1594.             [outputcontrolpoints(3)]
    1595.             VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
    1596.             {
    1597.                 return patch[id];
    1598.             }
    1599.  
    1600.             [domain("tri")]
    1601.             VertexOutput DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
    1602.             {
    1603.                 VertexInput o = (VertexInput) 0;
    1604.                 o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
    1605.                 o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z;
    1606.                 o.texcoord0 = patch[0].texcoord0 * bary.x + patch[1].texcoord0 * bary.y + patch[2].texcoord0 * bary.z;
    1607.                 o.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z;
    1608.                 o.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z;
    1609.                
    1610.                 #if defined(ASE_PHONG_TESSELLATION)
    1611.                 float3 pp[3];
    1612.                 for (int i = 0; i < 3; ++i)
    1613.                     pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal));
    1614.                 float phongStrength = _TessPhongStrength;
    1615.                 o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz;
    1616.                 #endif
    1617.                 UNITY_TRANSFER_INSTANCE_ID(patch[0], o);
    1618.                 return VertexFunction(o);
    1619.             }
    1620.             #else
    1621.             VertexOutput vert ( VertexInput v )
    1622.             {
    1623.                 return VertexFunction( v );
    1624.             }
    1625.             #endif
    1626.  
    1627.             half4 frag(VertexOutput IN  ) : SV_TARGET
    1628.             {
    1629.                 UNITY_SETUP_INSTANCE_ID(IN);
    1630.                 UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN );
    1631.  
    1632.                 #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
    1633.                     float3 WorldPosition = IN.worldPos;
    1634.                 #endif
    1635.  
    1636.                 float4 ShadowCoords = float4( 0, 0, 0, 0 );
    1637.  
    1638.                 #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
    1639.                     #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
    1640.                         ShadowCoords = IN.shadowCoord;
    1641.                     #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
    1642.                         ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
    1643.                     #endif
    1644.                 #endif
    1645.  
    1646.                 float2 uv_MainTex = IN.ase_texcoord4.xy * _MainTex_ST.xy + _MainTex_ST.zw;
    1647.                 float4 tex2DNode13 = tex2D( _MainTex, uv_MainTex );
    1648.                
    1649.  
    1650.                 float3 BaseColor = tex2DNode13.rgb;
    1651.                 float3 Emission = 0;
    1652.                 float Alpha = ( tex2DNode13.a * 1.0 );
    1653.                 float AlphaClipThreshold = _AlphaClip;
    1654.  
    1655.                 #ifdef _ALPHATEST_ON
    1656.                     clip(Alpha - AlphaClipThreshold);
    1657.                 #endif
    1658.  
    1659.                 MetaInput metaInput = (MetaInput)0;
    1660.                 metaInput.Albedo = BaseColor;
    1661.                 metaInput.Emission = Emission;
    1662.                 #ifdef EDITOR_VISUALIZATION
    1663.                     metaInput.VizUV = IN.VizUV.xy;
    1664.                     metaInput.LightCoord = IN.LightCoord;
    1665.                 #endif
    1666.  
    1667.                 return UnityMetaFragment(metaInput);
    1668.             }
    1669.             ENDHLSL
    1670.         }
    1671.  
    1672.        
    1673.         Pass
    1674.         {
    1675.            
    1676.             Name "DepthNormals"
    1677.             Tags { "LightMode"="DepthNormals" }
    1678.  
    1679.             ZWrite On
    1680.             Blend One Zero
    1681.             ZTest LEqual
    1682.             ZWrite On
    1683.  
    1684.             HLSLPROGRAM
    1685.  
    1686.             #define _NORMAL_DROPOFF_TS 1
    1687.             #pragma multi_compile_instancing
    1688.             #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE
    1689.             #define ASE_FOG 1
    1690.             #define _ALPHATEST_SHADOW_ON 1
    1691.             #define _ALPHATEST_ON 1
    1692.             #define ASE_SRP_VERSION 120107
    1693.  
    1694.  
    1695.             #pragma vertex vert
    1696.             #pragma fragment frag
    1697.  
    1698.             #define SHADERPASS SHADERPASS_DEPTHNORMALSONLY
    1699.  
    1700.             #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
    1701.             #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
    1702.             #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
    1703.             #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
    1704.             #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
    1705.             #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
    1706.             #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
    1707.             #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
    1708.  
    1709.            
    1710.  
    1711.             struct VertexInput
    1712.             {
    1713.                 float4 vertex : POSITION;
    1714.                 float3 ase_normal : NORMAL;
    1715.                 float4 ase_tangent : TANGENT;
    1716.                 float4 ase_texcoord : TEXCOORD0;
    1717.                 UNITY_VERTEX_INPUT_INSTANCE_ID
    1718.             };
    1719.  
    1720.             struct VertexOutput
    1721.             {
    1722.                 float4 clipPos : SV_POSITION;
    1723.                 #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
    1724.                     float3 worldPos : TEXCOORD0;
    1725.                 #endif
    1726.                 #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
    1727.                     float4 shadowCoord : TEXCOORD1;
    1728.                 #endif
    1729.                 float3 worldNormal : TEXCOORD2;
    1730.                 float4 worldTangent : TEXCOORD3;
    1731.                 float4 ase_texcoord4 : TEXCOORD4;
    1732.                 UNITY_VERTEX_INPUT_INSTANCE_ID
    1733.                 UNITY_VERTEX_OUTPUT_STEREO
    1734.             };
    1735.  
    1736.             CBUFFER_START(UnityPerMaterial)
    1737.             float4 _MainTex_ST;
    1738.             float _ZWriteMode;
    1739.             int _ZTestMode;
    1740.             float _StencilValue;
    1741.             float _AlphaClip;
    1742.             float _ShadowAlphaClip;
    1743.             #ifdef ASE_TRANSMISSION
    1744.                 float _TransmissionShadow;
    1745.             #endif
    1746.             #ifdef ASE_TRANSLUCENCY
    1747.                 float _TransStrength;
    1748.                 float _TransNormal;
    1749.                 float _TransScattering;
    1750.                 float _TransDirect;
    1751.                 float _TransAmbient;
    1752.                 float _TransShadow;
    1753.             #endif
    1754.             #ifdef ASE_TESSELLATION
    1755.                 float _TessPhongStrength;
    1756.                 float _TessValue;
    1757.                 float _TessMin;
    1758.                 float _TessMax;
    1759.                 float _TessEdgeLength;
    1760.                 float _TessMaxDisp;
    1761.             #endif
    1762.             CBUFFER_END
    1763.  
    1764.             // Property used by ScenePickingPass
    1765.             #ifdef SCENEPICKINGPASS
    1766.                 float4 _SelectionID;
    1767.             #endif
    1768.  
    1769.             // Properties used by SceneSelectionPass
    1770.             #ifdef SCENESELECTIONPASS
    1771.                 int _ObjectId;
    1772.                 int _PassValue;
    1773.             #endif
    1774.  
    1775.             sampler2D _MainTex;
    1776.  
    1777.  
    1778.             //#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/Varyings.hlsl"
    1779.             //#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/DepthNormalsOnlyPass.hlsl"
    1780.  
    1781.             //#ifdef HAVE_VFX_MODIFICATION
    1782.             //#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/VisualEffectVertex.hlsl"
    1783.             //#endif
    1784.  
    1785.            
    1786.             VertexOutput VertexFunction( VertexInput v  )
    1787.             {
    1788.                 VertexOutput o = (VertexOutput)0;
    1789.                 UNITY_SETUP_INSTANCE_ID(v);
    1790.                 UNITY_TRANSFER_INSTANCE_ID(v, o);
    1791.                 UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
    1792.  
    1793.                 o.ase_texcoord4.xy = v.ase_texcoord.xy;
    1794.                
    1795.                 //setting value to unused interpolator channels and avoid initialization warnings
    1796.                 o.ase_texcoord4.zw = 0;
    1797.                 #ifdef ASE_ABSOLUTE_VERTEX_POS
    1798.                     float3 defaultVertexValue = v.vertex.xyz;
    1799.                 #else
    1800.                     float3 defaultVertexValue = float3(0, 0, 0);
    1801.                 #endif
    1802.  
    1803.                 float3 vertexValue = defaultVertexValue;
    1804.  
    1805.                 #ifdef ASE_ABSOLUTE_VERTEX_POS
    1806.                     v.vertex.xyz = vertexValue;
    1807.                 #else
    1808.                     v.vertex.xyz += vertexValue;
    1809.                 #endif
    1810.  
    1811.                 v.ase_normal = v.ase_normal;
    1812.                 float3 positionWS = TransformObjectToWorld( v.vertex.xyz );
    1813.                 float3 normalWS = TransformObjectToWorldNormal( v.ase_normal );
    1814.                 float4 tangentWS = float4(TransformObjectToWorldDir( v.ase_tangent.xyz), v.ase_tangent.w);
    1815.                 float4 positionCS = TransformWorldToHClip( positionWS );
    1816.  
    1817.                 #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
    1818.                     o.worldPos = positionWS;
    1819.                 #endif
    1820.  
    1821.                 o.worldNormal = normalWS;
    1822.                 o.worldTangent = tangentWS;
    1823.  
    1824.                 #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
    1825.                     VertexPositionInputs vertexInput = (VertexPositionInputs)0;
    1826.                     vertexInput.positionWS = positionWS;
    1827.                     vertexInput.positionCS = positionCS;
    1828.                     o.shadowCoord = GetShadowCoord( vertexInput );
    1829.                 #endif
    1830.  
    1831.                 o.clipPos = positionCS;
    1832.  
    1833.                 return o;
    1834.             }
    1835.  
    1836.             #if defined(ASE_TESSELLATION)
    1837.             struct VertexControl
    1838.             {
    1839.                 float4 vertex : INTERNALTESSPOS;
    1840.                 float3 ase_normal : NORMAL;
    1841.                 float4 ase_tangent : TANGENT;
    1842.                 float4 ase_texcoord : TEXCOORD0;
    1843.  
    1844.                 UNITY_VERTEX_INPUT_INSTANCE_ID
    1845.             };
    1846.  
    1847.             struct TessellationFactors
    1848.             {
    1849.                 float edge[3] : SV_TessFactor;
    1850.                 float inside : SV_InsideTessFactor;
    1851.             };
    1852.  
    1853.             VertexControl vert ( VertexInput v )
    1854.             {
    1855.                 VertexControl o;
    1856.                 UNITY_SETUP_INSTANCE_ID(v);
    1857.                 UNITY_TRANSFER_INSTANCE_ID(v, o);
    1858.                 o.vertex = v.vertex;
    1859.                 o.ase_normal = v.ase_normal;
    1860.                 o.ase_tangent = v.ase_tangent;
    1861.                 o.ase_texcoord = v.ase_texcoord;
    1862.                 return o;
    1863.             }
    1864.  
    1865.             TessellationFactors TessellationFunction (InputPatch<VertexControl,3> v)
    1866.             {
    1867.                 TessellationFactors o;
    1868.                 float4 tf = 1;
    1869.                 float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
    1870.                 float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
    1871.                 #if defined(ASE_FIXED_TESSELLATION)
    1872.                 tf = FixedTess( tessValue );
    1873.                 #elif defined(ASE_DISTANCE_TESSELLATION)
    1874.                 tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
    1875.                 #elif defined(ASE_LENGTH_TESSELLATION)
    1876.                 tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
    1877.                 #elif defined(ASE_LENGTH_CULL_TESSELLATION)
    1878.                 tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
    1879.                 #endif
    1880.                 o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w;
    1881.                 return o;
    1882.             }
    1883.  
    1884.             [domain("tri")]
    1885.             [partitioning("fractional_odd")]
    1886.             [outputtopology("triangle_cw")]
    1887.             [patchconstantfunc("TessellationFunction")]
    1888.             [outputcontrolpoints(3)]
    1889.             VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
    1890.             {
    1891.                 return patch[id];
    1892.             }
    1893.  
    1894.             [domain("tri")]
    1895.             VertexOutput DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
    1896.             {
    1897.                 VertexInput o = (VertexInput) 0;
    1898.                 o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
    1899.                 o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z;
    1900.                 o.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * bary.z;
    1901.                 o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z;
    1902.                 #if defined(ASE_PHONG_TESSELLATION)
    1903.                 float3 pp[3];
    1904.                 for (int i = 0; i < 3; ++i)
    1905.                     pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal));
    1906.                 float phongStrength = _TessPhongStrength;
    1907.                 o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz;
    1908.                 #endif
    1909.                 UNITY_TRANSFER_INSTANCE_ID(patch[0], o);
    1910.                 return VertexFunction(o);
    1911.             }
    1912.             #else
    1913.             VertexOutput vert ( VertexInput v )
    1914.             {
    1915.                 return VertexFunction( v );
    1916.             }
    1917.             #endif
    1918.  
    1919.             #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE)
    1920.                 #define ASE_SV_DEPTH SV_DepthLessEqual
    1921.             #else
    1922.                 #define ASE_SV_DEPTH SV_Depth
    1923.             #endif
    1924.  
    1925.             half4 frag(    VertexOutput IN
    1926.                         #ifdef ASE_DEPTH_WRITE_ON
    1927.                         ,out float outputDepth : ASE_SV_DEPTH
    1928.                         #endif
    1929.                          ) : SV_TARGET
    1930.             {
    1931.                 UNITY_SETUP_INSTANCE_ID(IN);
    1932.                 UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN );
    1933.  
    1934.                 #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
    1935.                     float3 WorldPosition = IN.worldPos;
    1936.                 #endif
    1937.  
    1938.                 float4 ShadowCoords = float4( 0, 0, 0, 0 );
    1939.                 float3 WorldNormal = IN.worldNormal;
    1940.                 float4 WorldTangent = IN.worldTangent;
    1941.  
    1942.                 #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
    1943.                     #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
    1944.                         ShadowCoords = IN.shadowCoord;
    1945.                     #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
    1946.                         ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
    1947.                     #endif
    1948.                 #endif
    1949.  
    1950.                 float2 uv_MainTex = IN.ase_texcoord4.xy * _MainTex_ST.xy + _MainTex_ST.zw;
    1951.                 float4 tex2DNode13 = tex2D( _MainTex, uv_MainTex );
    1952.                
    1953.  
    1954.                 float3 Normal = float3(0, 0, 1);
    1955.                 float Alpha = ( tex2DNode13.a * 1.0 );
    1956.                 float AlphaClipThreshold = _AlphaClip;
    1957.                 #ifdef ASE_DEPTH_WRITE_ON
    1958.                     float DepthValue = 0;
    1959.                 #endif
    1960.  
    1961.                 #ifdef _ALPHATEST_ON
    1962.                     clip(Alpha - AlphaClipThreshold);
    1963.                 #endif
    1964.  
    1965.                 #ifdef LOD_FADE_CROSSFADE
    1966.                     LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x );
    1967.                 #endif
    1968.  
    1969.                 #ifdef ASE_DEPTH_WRITE_ON
    1970.                     outputDepth = DepthValue;
    1971.                 #endif
    1972.  
    1973.                 #if defined(_GBUFFER_NORMALS_OCT)
    1974.                     float2 octNormalWS = PackNormalOctQuadEncode(WorldNormal);
    1975.                     float2 remappedOctNormalWS = saturate(octNormalWS * 0.5 + 0.5);
    1976.                     half3 packedNormalWS = PackFloat2To888(remappedOctNormalWS);
    1977.                     return half4(packedNormalWS, 0.0);
    1978.                 #else
    1979.                     #if defined(_NORMALMAP)
    1980.                         #if _NORMAL_DROPOFF_TS
    1981.                             float crossSign = (WorldTangent.w > 0.0 ? 1.0 : -1.0) * GetOddNegativeScale();
    1982.                             float3 bitangent = crossSign * cross(WorldNormal.xyz, WorldTangent.xyz);
    1983.                             float3 normalWS = TransformTangentToWorld(Normal, half3x3(WorldTangent.xyz, bitangent, WorldNormal.xyz));
    1984.                         #elif _NORMAL_DROPOFF_OS
    1985.                             float3 normalWS = TransformObjectToWorldNormal(Normal);
    1986.                         #elif _NORMAL_DROPOFF_WS
    1987.                             float3 normalWS = Normal;
    1988.                         #endif
    1989.                     #else
    1990.                         float3 normalWS = WorldNormal;
    1991.                     #endif
    1992.                     return half4(NormalizeNormalPerPixel(normalWS), 0.0);
    1993.                 #endif
    1994.             }
    1995.             ENDHLSL
    1996.         }
    1997.  
    1998.        
    1999.         Pass
    2000.         {
    2001.            
    2002.             Name "GBuffer"
    2003.             Tags { "LightMode"="UniversalGBuffer" }
    2004.  
    2005.             Blend One Zero, One Zero
    2006.             ZWrite 1
    2007.             ZTest 0
    2008.             Offset 0 , 0
    2009.             ColorMask RGBA
    2010.             Stencil
    2011.             {
    2012.                 Ref 0
    2013.                 Comp Always
    2014.                 Pass Replace
    2015.             }
    2016.  
    2017.             HLSLPROGRAM
    2018.  
    2019.             #define _NORMAL_DROPOFF_TS 1
    2020.             #pragma multi_compile_instancing
    2021.             #pragma instancing_options renderinglayer
    2022.             #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE
    2023.             #pragma multi_compile_fog
    2024.             #define ASE_FOG 1
    2025.             #define _ALPHATEST_SHADOW_ON 1
    2026.             #define _ALPHATEST_ON 1
    2027.             #define ASE_SRP_VERSION 120107
    2028.  
    2029.  
    2030.             #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN
    2031.             #pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING
    2032.             #pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION
    2033.             #pragma multi_compile_fragment _ _SHADOWS_SOFT
    2034.             #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3
    2035.             #pragma multi_compile_fragment _ _LIGHT_LAYERS
    2036.             #pragma multi_compile_fragment _ _RENDER_PASS_ENABLED
    2037.             #pragma shader_feature_local _RECEIVE_SHADOWS_OFF
    2038.             #pragma shader_feature_local_fragment _SPECULARHIGHLIGHTS_OFF
    2039.             #pragma shader_feature_local_fragment _ENVIRONMENTREFLECTIONS_OFF
    2040.  
    2041.             #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING
    2042.             #pragma multi_compile _ SHADOWS_SHADOWMASK
    2043.             #pragma multi_compile _ DIRLIGHTMAP_COMBINED
    2044.             #pragma multi_compile _ LIGHTMAP_ON
    2045.             #pragma multi_compile _ DYNAMICLIGHTMAP_ON
    2046.             #pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT
    2047.  
    2048.             #pragma vertex vert
    2049.             #pragma fragment frag
    2050.  
    2051.             #define SHADERPASS SHADERPASS_GBUFFER
    2052.  
    2053.             #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
    2054.             #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
    2055.             #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
    2056.             #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
    2057.             #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
    2058.             #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
    2059.             #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl"
    2060.             #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
    2061.             #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl"
    2062.             #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
    2063.  
    2064.             #if defined(UNITY_INSTANCING_ENABLED) && defined(_TERRAIN_INSTANCED_PERPIXEL_NORMAL)
    2065.                 #define ENABLE_TERRAIN_PERPIXEL_NORMAL
    2066.             #endif
    2067.  
    2068.            
    2069.  
    2070.             struct VertexInput
    2071.             {
    2072.                 float4 vertex : POSITION;
    2073.                 float3 ase_normal : NORMAL;
    2074.                 float4 ase_tangent : TANGENT;
    2075.                 float4 texcoord : TEXCOORD0;
    2076.                 float4 texcoord1 : TEXCOORD1;
    2077.                 float4 texcoord2 : TEXCOORD2;
    2078.                
    2079.                 UNITY_VERTEX_INPUT_INSTANCE_ID
    2080.             };
    2081.  
    2082.             struct VertexOutput
    2083.             {
    2084.                 float4 clipPos : SV_POSITION;
    2085.                 float4 lightmapUVOrVertexSH : TEXCOORD0;
    2086.                 half4 fogFactorAndVertexLight : TEXCOORD1;
    2087.                 #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
    2088.                 float4 shadowCoord : TEXCOORD2;
    2089.                 #endif
    2090.                 float4 tSpace0 : TEXCOORD3;
    2091.                 float4 tSpace1 : TEXCOORD4;
    2092.                 float4 tSpace2 : TEXCOORD5;
    2093.                 #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION)
    2094.                 float4 screenPos : TEXCOORD6;
    2095.                 #endif
    2096.                 #if defined(DYNAMICLIGHTMAP_ON)
    2097.                 float2 dynamicLightmapUV : TEXCOORD7;
    2098.                 #endif
    2099.                 float4 ase_texcoord8 : TEXCOORD8;
    2100.                 UNITY_VERTEX_INPUT_INSTANCE_ID
    2101.                 UNITY_VERTEX_OUTPUT_STEREO
    2102.             };
    2103.  
    2104.             CBUFFER_START(UnityPerMaterial)
    2105.             float4 _MainTex_ST;
    2106.             float _ZWriteMode;
    2107.             int _ZTestMode;
    2108.             float _StencilValue;
    2109.             float _AlphaClip;
    2110.             float _ShadowAlphaClip;
    2111.             #ifdef ASE_TRANSMISSION
    2112.                 float _TransmissionShadow;
    2113.             #endif
    2114.             #ifdef ASE_TRANSLUCENCY
    2115.                 float _TransStrength;
    2116.                 float _TransNormal;
    2117.                 float _TransScattering;
    2118.                 float _TransDirect;
    2119.                 float _TransAmbient;
    2120.                 float _TransShadow;
    2121.             #endif
    2122.             #ifdef ASE_TESSELLATION
    2123.                 float _TessPhongStrength;
    2124.                 float _TessValue;
    2125.                 float _TessMin;
    2126.                 float _TessMax;
    2127.                 float _TessEdgeLength;
    2128.                 float _TessMaxDisp;
    2129.             #endif
    2130.             CBUFFER_END
    2131.  
    2132.             // Property used by ScenePickingPass
    2133.             #ifdef SCENEPICKINGPASS
    2134.                 float4 _SelectionID;
    2135.             #endif
    2136.  
    2137.             // Properties used by SceneSelectionPass
    2138.             #ifdef SCENESELECTIONPASS
    2139.                 int _ObjectId;
    2140.                 int _PassValue;
    2141.             #endif
    2142.  
    2143.             sampler2D _MainTex;
    2144.  
    2145.  
    2146.             //#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/Varyings.hlsl"
    2147.             #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityGBuffer.hlsl"
    2148.             //#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/PBRGBufferPass.hlsl"
    2149.  
    2150.            
    2151.             VertexOutput VertexFunction( VertexInput v  )
    2152.             {
    2153.                 VertexOutput o = (VertexOutput)0;
    2154.                 UNITY_SETUP_INSTANCE_ID(v);
    2155.                 UNITY_TRANSFER_INSTANCE_ID(v, o);
    2156.                 UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
    2157.  
    2158.                 o.ase_texcoord8.xy = v.texcoord.xy;
    2159.                
    2160.                 //setting value to unused interpolator channels and avoid initialization warnings
    2161.                 o.ase_texcoord8.zw = 0;
    2162.                 #ifdef ASE_ABSOLUTE_VERTEX_POS
    2163.                     float3 defaultVertexValue = v.vertex.xyz;
    2164.                 #else
    2165.                     float3 defaultVertexValue = float3(0, 0, 0);
    2166.                 #endif
    2167.  
    2168.                 float3 vertexValue = defaultVertexValue;
    2169.  
    2170.                 #ifdef ASE_ABSOLUTE_VERTEX_POS
    2171.                     v.vertex.xyz = vertexValue;
    2172.                 #else
    2173.                     v.vertex.xyz += vertexValue;
    2174.                 #endif
    2175.  
    2176.                 v.ase_normal = v.ase_normal;
    2177.  
    2178.                 float3 positionWS = TransformObjectToWorld( v.vertex.xyz );
    2179.                 float3 positionVS = TransformWorldToView( positionWS );
    2180.                 float4 positionCS = TransformWorldToHClip( positionWS );
    2181.  
    2182.                 VertexNormalInputs normalInput = GetVertexNormalInputs( v.ase_normal, v.ase_tangent );
    2183.  
    2184.                 o.tSpace0 = float4( normalInput.normalWS, positionWS.x);
    2185.                 o.tSpace1 = float4( normalInput.tangentWS, positionWS.y);
    2186.                 o.tSpace2 = float4( normalInput.bitangentWS, positionWS.z);
    2187.  
    2188.                 #if defined(LIGHTMAP_ON)
    2189.                     OUTPUT_LIGHTMAP_UV(v.texcoord1, unity_LightmapST, o.lightmapUVOrVertexSH.xy);
    2190.                 #endif
    2191.  
    2192.                 #if defined(DYNAMICLIGHTMAP_ON)
    2193.                     o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw;
    2194.                 #endif
    2195.  
    2196.                 #if !defined(LIGHTMAP_ON)
    2197.                     OUTPUT_SH(normalInput.normalWS.xyz, o.lightmapUVOrVertexSH.xyz);
    2198.                 #endif
    2199.  
    2200.                 #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL)
    2201.                     o.lightmapUVOrVertexSH.zw = v.texcoord;
    2202.                     o.lightmapUVOrVertexSH.xy = v.texcoord * unity_LightmapST.xy + unity_LightmapST.zw;
    2203.                 #endif
    2204.  
    2205.                 half3 vertexLight = VertexLighting( positionWS, normalInput.normalWS );
    2206.  
    2207.                 o.fogFactorAndVertexLight = half4(0, vertexLight);
    2208.  
    2209.                 #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
    2210.                     VertexPositionInputs vertexInput = (VertexPositionInputs)0;
    2211.                     vertexInput.positionWS = positionWS;
    2212.                     vertexInput.positionCS = positionCS;
    2213.                     o.shadowCoord = GetShadowCoord( vertexInput );
    2214.                 #endif
    2215.  
    2216.                     o.clipPos = positionCS;
    2217.  
    2218.                 #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION)
    2219.                     o.screenPos = ComputeScreenPos(positionCS);
    2220.                 #endif
    2221.  
    2222.                 return o;
    2223.             }
    2224.  
    2225.             #if defined(ASE_TESSELLATION)
    2226.             struct VertexControl
    2227.             {
    2228.                 float4 vertex : INTERNALTESSPOS;
    2229.                 float3 ase_normal : NORMAL;
    2230.                 float4 ase_tangent : TANGENT;
    2231.                 float4 texcoord : TEXCOORD0;
    2232.                 float4 texcoord1 : TEXCOORD1;
    2233.                 float4 texcoord2 : TEXCOORD2;
    2234.                
    2235.                 UNITY_VERTEX_INPUT_INSTANCE_ID
    2236.             };
    2237.  
    2238.             struct TessellationFactors
    2239.             {
    2240.                 float edge[3] : SV_TessFactor;
    2241.                 float inside : SV_InsideTessFactor;
    2242.             };
    2243.  
    2244.             VertexControl vert ( VertexInput v )
    2245.             {
    2246.                 VertexControl o;
    2247.                 UNITY_SETUP_INSTANCE_ID(v);
    2248.                 UNITY_TRANSFER_INSTANCE_ID(v, o);
    2249.                 o.vertex = v.vertex;
    2250.                 o.ase_normal = v.ase_normal;
    2251.                 o.ase_tangent = v.ase_tangent;
    2252.                 o.texcoord = v.texcoord;
    2253.                 o.texcoord1 = v.texcoord1;
    2254.                 o.texcoord2 = v.texcoord2;
    2255.                
    2256.                 return o;
    2257.             }
    2258.  
    2259.             TessellationFactors TessellationFunction (InputPatch<VertexControl,3> v)
    2260.             {
    2261.                 TessellationFactors o;
    2262.                 float4 tf = 1;
    2263.                 float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
    2264.                 float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
    2265.                 #if defined(ASE_FIXED_TESSELLATION)
    2266.                 tf = FixedTess( tessValue );
    2267.                 #elif defined(ASE_DISTANCE_TESSELLATION)
    2268.                 tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
    2269.                 #elif defined(ASE_LENGTH_TESSELLATION)
    2270.                 tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
    2271.                 #elif defined(ASE_LENGTH_CULL_TESSELLATION)
    2272.                 tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
    2273.                 #endif
    2274.                 o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w;
    2275.                 return o;
    2276.             }
    2277.  
    2278.             [domain("tri")]
    2279.             [partitioning("fractional_odd")]
    2280.             [outputtopology("triangle_cw")]
    2281.             [patchconstantfunc("TessellationFunction")]
    2282.             [outputcontrolpoints(3)]
    2283.             VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
    2284.             {
    2285.                 return patch[id];
    2286.             }
    2287.  
    2288.             [domain("tri")]
    2289.             VertexOutput DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
    2290.             {
    2291.                 VertexInput o = (VertexInput) 0;
    2292.                 o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
    2293.                 o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z;
    2294.                 o.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * bary.z;
    2295.                 o.texcoord = patch[0].texcoord * bary.x + patch[1].texcoord * bary.y + patch[2].texcoord * bary.z;
    2296.                 o.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z;
    2297.                 o.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z;
    2298.                
    2299.                 #if defined(ASE_PHONG_TESSELLATION)
    2300.                 float3 pp[3];
    2301.                 for (int i = 0; i < 3; ++i)
    2302.                     pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal));
    2303.                 float phongStrength = _TessPhongStrength;
    2304.                 o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz;
    2305.                 #endif
    2306.                 UNITY_TRANSFER_INSTANCE_ID(patch[0], o);
    2307.                 return VertexFunction(o);
    2308.             }
    2309.             #else
    2310.             VertexOutput vert ( VertexInput v )
    2311.             {
    2312.                 return VertexFunction( v );
    2313.             }
    2314.             #endif
    2315.  
    2316.             #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE)
    2317.                 #define ASE_SV_DEPTH SV_DepthLessEqual
    2318.             #else
    2319.                 #define ASE_SV_DEPTH SV_Depth
    2320.             #endif
    2321.  
    2322.             FragmentOutput frag ( VertexOutput IN
    2323.                                 #ifdef ASE_DEPTH_WRITE_ON
    2324.                                 ,out float outputDepth : ASE_SV_DEPTH
    2325.                                 #endif
    2326.                                  )
    2327.             {
    2328.                 UNITY_SETUP_INSTANCE_ID(IN);
    2329.                 UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN);
    2330.  
    2331.                 #ifdef LOD_FADE_CROSSFADE
    2332.                     LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x );
    2333.                 #endif
    2334.  
    2335.                 #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL)
    2336.                     float2 sampleCoords = (IN.lightmapUVOrVertexSH.zw / _TerrainHeightmapRecipSize.zw + 0.5f) * _TerrainHeightmapRecipSize.xy;
    2337.                     float3 WorldNormal = TransformObjectToWorldNormal(normalize(SAMPLE_TEXTURE2D(_TerrainNormalmapTexture, sampler_TerrainNormalmapTexture, sampleCoords).rgb * 2 - 1));
    2338.                     float3 WorldTangent = -cross(GetObjectToWorldMatrix()._13_23_33, WorldNormal);
    2339.                     float3 WorldBiTangent = cross(WorldNormal, -WorldTangent);
    2340.                 #else
    2341.                     float3 WorldNormal = normalize( IN.tSpace0.xyz );
    2342.                     float3 WorldTangent = IN.tSpace1.xyz;
    2343.                     float3 WorldBiTangent = IN.tSpace2.xyz;
    2344.                 #endif
    2345.  
    2346.                 float3 WorldPosition = float3(IN.tSpace0.w,IN.tSpace1.w,IN.tSpace2.w);
    2347.                 float3 WorldViewDirection = _WorldSpaceCameraPos.xyz  - WorldPosition;
    2348.                 float4 ShadowCoords = float4( 0, 0, 0, 0 );
    2349.  
    2350.                 #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION)
    2351.                     float4 ScreenPos = IN.screenPos;
    2352.                 #endif
    2353.  
    2354.                 float2 NormalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.clipPos);
    2355.  
    2356.                 #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
    2357.                     ShadowCoords = IN.shadowCoord;
    2358.                 #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
    2359.                     ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
    2360.                 #else
    2361.                     ShadowCoords = float4(0, 0, 0, 0);
    2362.                 #endif
    2363.  
    2364.                 WorldViewDirection = SafeNormalize( WorldViewDirection );
    2365.  
    2366.                 float2 uv_MainTex = IN.ase_texcoord8.xy * _MainTex_ST.xy + _MainTex_ST.zw;
    2367.                 float4 tex2DNode13 = tex2D( _MainTex, uv_MainTex );
    2368.                
    2369.  
    2370.                 float3 BaseColor = tex2DNode13.rgb;
    2371.                 float3 Normal = float3(0, 0, 1);
    2372.                 float3 Emission = 0;
    2373.                 float3 Specular = 0.5;
    2374.                 float Metallic = 0.0;
    2375.                 float Smoothness = 0.0;
    2376.                 float Occlusion = 1.0;
    2377.                 float Alpha = ( tex2DNode13.a * 1.0 );
    2378.                 float AlphaClipThreshold = _AlphaClip;
    2379.                 float AlphaClipThresholdShadow = _ShadowAlphaClip;
    2380.                 float3 BakedGI = 0;
    2381.                 float3 RefractionColor = 1;
    2382.                 float RefractionIndex = 1;
    2383.                 float3 Transmission = 1;
    2384.                 float3 Translucency = 1;
    2385.  
    2386.                 #ifdef ASE_DEPTH_WRITE_ON
    2387.                     float DepthValue = 0;
    2388.                 #endif
    2389.  
    2390.                 #ifdef _ALPHATEST_ON
    2391.                     clip(Alpha - AlphaClipThreshold);
    2392.                 #endif
    2393.  
    2394.                 InputData inputData = (InputData)0;
    2395.                 inputData.positionWS = WorldPosition;
    2396.                 inputData.positionCS = IN.clipPos;
    2397.                 inputData.shadowCoord = ShadowCoords;
    2398.  
    2399.                 #ifdef _NORMALMAP
    2400.                     #if _NORMAL_DROPOFF_TS
    2401.                         inputData.normalWS = TransformTangentToWorld(Normal, half3x3( WorldTangent, WorldBiTangent, WorldNormal ));
    2402.                     #elif _NORMAL_DROPOFF_OS
    2403.                         inputData.normalWS = TransformObjectToWorldNormal(Normal);
    2404.                     #elif _NORMAL_DROPOFF_WS
    2405.                         inputData.normalWS = Normal;
    2406.                     #endif
    2407.                 #else
    2408.                     inputData.normalWS = WorldNormal;
    2409.                 #endif
    2410.  
    2411.                 inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS);
    2412.                 inputData.viewDirectionWS = SafeNormalize( WorldViewDirection );
    2413.  
    2414.                 inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw;
    2415.  
    2416.                 #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL)
    2417.                     float3 SH = SampleSH(inputData.normalWS.xyz);
    2418.                 #else
    2419.                     float3 SH = IN.lightmapUVOrVertexSH.xyz;
    2420.                 #endif
    2421.  
    2422.                 #ifdef ASE_BAKEDGI
    2423.                     inputData.bakedGI = BakedGI;
    2424.                 #else
    2425.                     #if defined(DYNAMICLIGHTMAP_ON)
    2426.                         inputData.bakedGI = SAMPLE_GI( IN.lightmapUVOrVertexSH.xy, IN.dynamicLightmapUV.xy, SH, inputData.normalWS);
    2427.                     #else
    2428.                         inputData.bakedGI = SAMPLE_GI( IN.lightmapUVOrVertexSH.xy, SH, inputData.normalWS );
    2429.                     #endif
    2430.                 #endif
    2431.  
    2432.                 inputData.normalizedScreenSpaceUV = NormalizedScreenSpaceUV;
    2433.                 inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUVOrVertexSH.xy);
    2434.  
    2435.                 #if defined(DEBUG_DISPLAY)
    2436.                     #if defined(DYNAMICLIGHTMAP_ON)
    2437.                         inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy;
    2438.                         #endif
    2439.                     #if defined(LIGHTMAP_ON)
    2440.                         inputData.staticLightmapUV = IN.lightmapUVOrVertexSH.xy;
    2441.                     #else
    2442.                         inputData.vertexSH = SH;
    2443.                     #endif
    2444.                 #endif
    2445.  
    2446.                 #ifdef _DBUFFER
    2447.                     ApplyDecal(IN.clipPos,
    2448.                         BaseColor,
    2449.                         Specular,
    2450.                         inputData.normalWS,
    2451.                         Metallic,
    2452.                         Occlusion,
    2453.                         Smoothness);
    2454.                 #endif
    2455.  
    2456.                 BRDFData brdfData;
    2457.                 InitializeBRDFData
    2458.                 (BaseColor, Metallic, Specular, Smoothness, Alpha, brdfData);
    2459.  
    2460.                 Light mainLight = GetMainLight(inputData.shadowCoord, inputData.positionWS, inputData.shadowMask);
    2461.                 half4 color;
    2462.                 MixRealtimeAndBakedGI(mainLight, inputData.normalWS, inputData.bakedGI, inputData.shadowMask);
    2463.                 color.rgb = GlobalIllumination(brdfData, inputData.bakedGI, Occlusion, inputData.positionWS, inputData.normalWS, inputData.viewDirectionWS);
    2464.                 color.a = Alpha;
    2465.  
    2466.                 #ifdef ASE_FINAL_COLOR_ALPHA_MULTIPLY
    2467.                     color.rgb *= color.a;
    2468.                 #endif
    2469.  
    2470.                 #ifdef ASE_DEPTH_WRITE_ON
    2471.                     outputDepth = DepthValue;
    2472.                 #endif
    2473.  
    2474.                 return BRDFDataToGbuffer(brdfData, inputData, Smoothness, Emission + color.rgb, Occlusion);
    2475.             }
    2476.  
    2477.             ENDHLSL
    2478.         }
    2479.  
    2480.    
    2481.     }
    2482.    
    2483.     CustomEditor "UnityEditor.ShaderGraphLitGUI"
    2484.     FallBack "Hidden/Shader Graph/FallbackError"
    2485.    
    2486.     Fallback Off
    2487. }
    2488. /*ASEBEGIN
    2489. Version=19105
    2490. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;0;0,0;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;ExtraPrePass;0;0;ExtraPrePass;5;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;;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;3;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
    2491. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;2;0,0;Float;False;False;-1;2;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;3;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
    2492. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;3;0,0;Float;False;False;-1;2;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;3;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;;False;False;True;1;LightMode=DepthOnly;False;False;0;;0;0;Standard;0;False;0
    2493. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;4;0,0;Float;False;False;-1;2;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;3;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
    2494. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;5;0,0;Float;False;False;-1;2;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;3;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;True;;True;3;True;;True;True;0;False;;0;False;;True;1;LightMode=Universal2D;False;False;0;;0;0;Standard;0;False;0
    2495. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;6;0,0;Float;False;False;-1;2;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;3;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
    2496. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;7;0,0;Float;False;False;-1;2;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;3;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;True;0;False;;255;False;;255;False;;7;False;;3;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;True;1;False;;True;0;False;;True;True;0;False;;0;False;;True;1;LightMode=UniversalGBuffer;False;False;0;;0;0;Standard;0;False;0
    2497. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;8;0,0;Float;False;False;-1;2;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;3;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=SceneSelectionPass;False;False;0;;0;0;Standard;0;False;0
    2498. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;9;0,0;Float;False;False;-1;2;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;3;True;12;all;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Picking;False;False;0;;0;0;Standard;0;False;0
    2499. Node;AmplifyShaderEditor.RangedFloatNode;10;-511.6666,149.1667;Inherit;False;Property;_AlphaClip;AlphaClip;3;0;Create;True;0;0;0;False;0;False;0.5;0.5;0;1;0;1;FLOAT;0
    2500. Node;AmplifyShaderEditor.RangedFloatNode;11;-506.6666,241.1667;Inherit;False;Property;_ShadowAlphaClip;ShadowAlphaClip;4;0;Create;True;0;0;0;False;0;False;0.5;0.5;0;1;0;1;FLOAT;0
    2501. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;1;0,0;Float;False;True;-1;2;UnityEditor.ShaderGraphLitGUI;0;12;Sh_Main;94348b07e5e8bab40bd6c8a1e3df54cd;True;Forward;0;1;Forward;19;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;;True;True;1;False;_ZWriteMode;True;3;False;_ZTestMode;True;True;0;False;;0;False;;True;4;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;UniversalMaterialType=Lit;True;3;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;True;True;True;0;True;_StencilValue;255;False;;255;False;;7;False;;3;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;True;True;1;True;_ZWriteMode;True;0;True;_ZTestMode;True;True;0;False;;0;False;;True;1;LightMode=UniversalForward;False;False;0;;0;0;Standard;41;Workflow;1;0;Surface;0;0;  Refraction Model;0;0;  Blend;0;0;Two Sided;1;0;Fragment Normal Space,InvertActionOnDeselection;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;  Use Shadow Threshold;1;638153065053116221;Receive Shadows;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;DOTS Instancing;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,InvertActionOnDeselection;1;0;Debug Display;0;0;Clear Coat;0;0;0;10;False;True;True;True;True;False;True;True;False;False;False;;False;0
    2502. Node;AmplifyShaderEditor.RangedFloatNode;16;325.25,80.28326;Inherit;False;Constant;_Float0;Float 0;4;0;Create;True;0;0;0;False;0;False;0;0;0;0;0;1;FLOAT;0
    2503. Node;AmplifyShaderEditor.RangedFloatNode;15;329.75,154.3833;Inherit;False;Constant;_Float1;Float 0;4;0;Create;True;0;0;0;False;0;False;1;0;0;0;0;1;FLOAT;0
    2504. Node;AmplifyShaderEditor.SamplerNode;13;-659,-171.1667;Inherit;True;Property;_MainTex;MainTex;2;0;Create;True;0;0;0;False;0;False;-1;None;c399906367248ac458b5e759382bac9c;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
    2505. Node;AmplifyShaderEditor.FunctionNode;19;-655.6666,20.16658;Inherit;False;Shfunc_DissolveEffect;5;;19;2ccf71dc91aaf4347a0bef249fa12cd6;0;0;2;FLOAT;10;COLOR;0
    2506. Node;AmplifyShaderEditor.RangedFloatNode;22;-2.745223,472.6603;Inherit;False;Property;_ZWriteMode;ZWriteMode;1;1;[Toggle];Create;True;0;0;0;True;0;False;1;1;0;0;0;1;FLOAT;0
    2507. Node;AmplifyShaderEditor.IntNode;20;-7.328074,382.1871;Inherit;False;Property;_ZTestMode;ZTestMode;0;1;[Enum];Create;True;0;0;1;UnityEngine.Rendering.CompareFunction;True;0;False;4;4;True;0;1;INT;0
    2508. Node;AmplifyShaderEditor.RangedFloatNode;17;-1.775468,304.2852;Inherit;False;Property;_StencilValue;StencilValue;12;0;Create;True;0;0;0;True;0;False;0;0;0;0;0;1;FLOAT;0
    2509. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;14;-284,-3.166702;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;1;False;1;FLOAT;0
    2510. WireConnection;1;0;13;0
    2511. WireConnection;1;3;16;0
    2512. WireConnection;1;4;16;0
    2513. WireConnection;1;5;15;0
    2514. WireConnection;1;6;14;0
    2515. WireConnection;1;7;10;0
    2516. WireConnection;1;16;11;0
    2517. WireConnection;14;0;13;4
    2518. ASEEND*/
    2519. //CHKSM=64E817EFEDE5B23DF78BABAAA186E633AD4B4446
     
  36. ununion

    ununion

    Joined:
    Dec 2, 2018
    Posts:
    275
    also _StencilValue will lose in ase editor,but that does't break the shader.
     
  37. ununion

    ununion

    Joined:
    Dec 2, 2018
    Posts:
    275
    to fix it you should reset zwrite and ztest in gui,and re compile it then every thing will be correct,but once you close the editor and reopen it and if you compile again,pink comes back
     
  38. Amplify_David

    Amplify_David

    Joined:
    Mar 29, 2023
    Posts:
    194

    i see this before in some rare cases a shader that was originally made in a very old version.
    in the other cases this was due to some bad meta in shader getting left over

    please try open "Preferences" and enable the option "Force Template Inline Properties."
    this will force the system to look at the template first and clear any bad left over meta.

    be certain to turn this off after your finished with it so future changes do not keep reverting.

    if it's still a issue after this please send me copy thru email upload_2023-4-20_21-55-53.png
     
  39. ununion

    ununion

    Joined:
    Dec 2, 2018
    Posts:
    275
    that is not work. bug still there
    i have already post the shader file,just copy that to you unity.
     
  40. unity_3927E0DF58901074B44E

    unity_3927E0DF58901074B44E

    Joined:
    Apr 27, 2023
    Posts:
    1
    Hello!
    I'm using a URP Unlit Toonshader with SRP Additional Light Node. I want to turn off self shadow while keeping the cast shader and receive shadow on. Can you help me with this?
     
  41. Gullie667

    Gullie667

    Joined:
    Apr 21, 2021
    Posts:
    17
    I ended up just writing it in Shader Forge since I never got a reply.
    Did you get it working?

    upload_2023-4-27_18-59-23.png
     
  42. Amplify_David

    Amplify_David

    Joined:
    Mar 29, 2023
    Posts:
    194

    we have had a few reports about users with issue for baked shadows.
    however, in most cases i was not able to replicate.

    I suspect many users have issue with:
    --- sample should use property name _MainTex
    --- alpha should come from the sample with property named _MainTex
    --- Unity shadow atlas resolution is set too low within the render pipeline asset
     
  43. nakoustix

    nakoustix

    Joined:
    Apr 21, 2019
    Posts:
    15
    Hi Guys,

    I'm currently working on post processing shaders and while I managed to get good results in a normal (2D) environment, I'm struggling to achieve what I want in VR using OpenXR, instanced stereo.

    My task seems farily simple:
    I need to differentiate between the eyes in a PPSv2 compatible shader like with unity_StereoEyeIndex, but in the frag shader (PP template) and I'm stuck reeaally bad.
    I read unity docs how to get it working and tried to write my own basic shader in hlsl (without ASE), but I wasn't successfull either.
    In my mind, this has to be VERY easy and I still hope that I'm just too dumb to figure it out.

    Does anyone have a hint for me? It 'd be muuch appreciated!
    Btw. this is Unity 2021.3 BIRP.

    TIA!
     
  44. giraffe1

    giraffe1

    Joined:
    Nov 1, 2014
    Posts:
    302
    Could you please explain what the Texture Coordinates node is doing here? According to the docs it says:

    W Returns a float containing the W coordinate. Only available if Coord Size is set to Float3. Float
    T Returns a float containing the T coordinate. Only available if Coord Size is set to Float4.

    What is the 'W' and 'T' output represent? Is it a copy of the U and V respectively?

    Untitled.png
     
  45. nakoustix

    nakoustix

    Joined:
    Apr 21, 2019
    Posts:
    15
    So I tried to replicate the template for the PP stack and make it work in instanced stereo mode, following Unity docs closely and simultaneously having a look at the Unlit template (there it works).

    Appreciating the ability to create custom templates! But where does the magic happen with _MainTex in the PP template?

    When I :
    1)
    create a duplicate of the PP template

    2)
    give it a new name so the system recognizes it and

    3)
    nothing else,

    the _MainTex is shown in the PP-Stack-Tool as a property with a default value of black (sounds appropriate). But when using the included PP template this property doesn't show up and the screen tex is *somewhere* injected into the shader.
    But WHERE?

    I looked into the ASEPPSHelperTool and couldn't find any special treatment for this specific template.
    Also the output code looks identical, except that it creates this declared "Screen" property on my duplicate which is *magically* hidden in the provided template.

    I think I'm sooo close to solve this, but I would really appreciate some insight from one of you pros!

    The modified template (following unity docs and unlit template) is as follows:
    Code (CSharp):
    1. Shader /*ase_name*/ "MyriadVerts/PostProcessXR2" /*end*/
    2. {
    3.     Properties
    4.     {
    5.         _MainTex ( "Screen", 2D ) = "black" {}
    6.         /*ase_props*/
    7.     }
    8.  
    9.     SubShader
    10.     {
    11.         Tags{ }
    12.        
    13.         ZTest Always
    14.         Cull Off
    15.         ZWrite Off
    16.  
    17.         /*ase_pass*/
    18.         Pass
    19.         {
    20.             CGPROGRAM
    21.  
    22.             #pragma vertex vert_img_custom
    23.             #pragma fragment frag
    24.             #pragma target 3.0
    25.  
    26.             //+
    27.             #pragma multi_compile_instancing
    28.            
    29.             #include "UnityCG.cginc"
    30.             /*ase_pragma*/
    31.  
    32.             struct appdata_img_custom
    33.             {
    34.                 float4 vertex : POSITION;
    35.                 half2 texcoord : TEXCOORD0;
    36.                 /*ase_vdata:p=p;uv0=tc0*/
    37.  
    38.                 //+
    39.                 UNITY_VERTEX_INPUT_INSTANCE_ID
    40.             };
    41.  
    42.             struct v2f_img_custom
    43.             {
    44.                 float4 pos : SV_POSITION;
    45.                 half2 uv   : TEXCOORD0;
    46.                 half2 stereoUV : TEXCOORD2;
    47.         #if UNITY_UV_STARTS_AT_TOP
    48.                 half4 uv2 : TEXCOORD1;
    49.                 half4 stereoUV2 : TEXCOORD3;
    50.         #endif
    51.                 /*ase_interp(4,):sp=sp.xyzw;uv0=tc0.xy;uv1=tc1;uv2=tc2;uv3=tc3*/
    52.  
    53.                 //+
    54.                 UNITY_VERTEX_INPUT_INSTANCE_ID
    55.                 UNITY_VERTEX_OUTPUT_STEREO
    56.             };
    57.  
    58.             uniform sampler2D _MainTex;
    59.             uniform half4 _MainTex_TexelSize;
    60.             uniform half4 _MainTex_ST;
    61.            
    62.             /*ase_globals*/
    63.  
    64.             v2f_img_custom vert_img_custom ( appdata_img_custom v /*ase_vert_input*/ )
    65.             {
    66.                 v2f_img_custom o;
    67.  
    68.                 //+
    69.                 UNITY_SETUP_INSTANCE_ID(v);
    70.                 UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
    71.                 UNITY_TRANSFER_INSTANCE_ID(v, o);
    72.  
    73.  
    74.                 /*ase_vert_code:v=appdata_img_custom;o=v2f_img_custom*/
    75.                 o.pos = UnityObjectToClipPos( v.vertex );
    76.                 o.uv = float4( v.texcoord.xy, 1, 1 );
    77.  
    78.                 #if UNITY_UV_STARTS_AT_TOP
    79.                     o.uv2 = float4( v.texcoord.xy, 1, 1 );
    80.                     o.stereoUV2 = UnityStereoScreenSpaceUVAdjust ( o.uv2, _MainTex_ST );
    81.  
    82.                     if ( _MainTex_TexelSize.y < 0.0 )
    83.                         o.uv.y = 1.0 - o.uv.y;
    84.                 #endif
    85.                 o.stereoUV = UnityStereoScreenSpaceUVAdjust ( o.uv, _MainTex_ST );
    86.                 return o;
    87.             }
    88.  
    89.             half4 frag ( v2f_img_custom i /*ase_frag_input*/) : SV_Target
    90.             {
    91.                 //+
    92.                 UNITY_SETUP_INSTANCE_ID(i);
    93.                 UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
    94.  
    95.  
    96.                 #ifdef UNITY_UV_STARTS_AT_TOP
    97.                     half2 uv = i.uv2;
    98.                     half2 stereoUV = i.stereoUV2;
    99.                 #else
    100.                     half2 uv = i.uv;
    101.                     half2 stereoUV = i.stereoUV;
    102.                 #endif  
    103.                
    104.                 half4 finalColor;
    105.  
    106.                 // ase common template code
    107.                 /*ase_frag_code:i=v2f_img_custom*/
    108.  
    109.                 finalColor = /*ase_frag_out:Frag Color;Float4*/half4( 1, 1, 1, 1 )/*end*/;
    110.  
    111.                 return finalColor;
    112.             }
    113.             ENDCG
    114.         }
    115.     }
    116.     CustomEditor "ASEMaterialInspector"
    117. }
    118.  

    Thanks for an awesome tool BTW! I love it, as it really helps me learnig and understanding shaders!
    Michael
     
  46. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    I know there isn't a official support for 2023.1x but I do get this error:

    upload_2023-5-9_19-26-17.png

    Just reporting here to see if there is solution to this, or if not, then I just want to point it out.
     
  47. Amplify_David

    Amplify_David

    Joined:
    Mar 29, 2023
    Posts:
    194

    yes 2023.1 aka 15x will give this error without the updates for all the changes.
    intently we have already been tracking this so it should be ready soon as unity comes out of beta without delay
     
  48. Amplify_David

    Amplify_David

    Joined:
    Mar 29, 2023
    Posts:
    194
    Hello, everyone!
    A Brief Progress Update 05/10/2023

    Amplify Shader Editor
    v1.9.1.6 is about to release with several bug fixes, details will follow in release notes.

    Amplify Shader Pack
    v2.0.0 is about to release with multiple new samples and updated for 10x12x14x

    Amplify Impostors
    This will follow shortly after the above amplify Editor update, however we target before end of this month.

    I have received multiple emails and bug reports for Impostors. I will be following up over the next few days to verify with you message received.

    I am sorry we had a very large backlog for impostor issues and if you do not receive a reply by end of this week, please draw my attention by bumping me again.

    My goal is to verify all reports received get checked by QA into this coming update.

    Thank You,
    David
     
    MadStuntman likes this.
  49. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Hi Thanks for this. I was wondering if there could possibly be a deferred rendering pass for SimpleLit, I am guessing that is not going to be possible, but just fingers crossed.

    @Amplify_Support , also for URP deferred rendering path, what templates are currently supported?
     
  50. Amplify_David

    Amplify_David

    Joined:
    Mar 29, 2023
    Posts:
    194

    can you reach out to me in discord for a more involved chat
    i think what you're looking for is now called forward+ in Unity depending on what api you're working in