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. corjn

    corjn

    Joined:
    Feb 6, 2014
    Posts:
    104
    Hey, thanks for helping,
    I know, this is what I did. The shader works fine when I just remove texture array sampler (working well with the classic texture sampler)

    What I'm trying to do here is to use texture arrays with lwrp, which does not seem to work.
     
  2. agreeablegames

    agreeablegames

    Joined:
    Nov 20, 2016
    Posts:
    14
    Hi ASE devs,
    I'm trying to get Lightmap Emission to work with LWRP and the ASE Lightweight PBR shader.

    So far I've tested the unity Lightweight SimpleLit shader, and it works correctly after setting the EmissionColor and EmissionMap (with HDR).

    Does ASE support LWRP lightmap emission values or should I stick with the unity lightweight shaders for that?

    Thanks
     
  3. cAyouMontreal

    cAyouMontreal

    Joined:
    Jun 30, 2011
    Posts:
    303
    Oops sorry I read your post too fast, missed a couple of informations haha :D I've posted already quite a lot of errors or missing stuff for the HDRP, most of them are already fixed on the current version on their website, so I'm pretty sure it's a matter of time for the LWRP as well to be fixed.
     
  4. OP3NGL

    OP3NGL

    Joined:
    Dec 10, 2013
    Posts:
    247
    hi,
    saw BOXOPHOBIC did on the category drawers gotten me interested...

    in regards to the enum properties in the float (blend modes), is it possible to mash different shaders into one? just like the standard unity shader?

    & How to do it?
     
  5. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,161
    I want this crosssection-shader to run in Lightweight SRP.
    But after making the masternode SRP compatible (by using the LWSRPTemplates)
    it doesn´t have the Opacity Mask input anymore.

    Any ideas?


    PS:
    Besides this it´s easy to setup the shader in Unitys Shadergraph but there we also don´t have a Opacitymask input for the masternode...
     
    Last edited: Nov 29, 2018
  6. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    1,510
    Thanks for the heads up, I'll pass it on to the devs as I'm not entirely sure if there's any known limitation.

    That's an interesting questions. If the Unity shaders support it, we don't see why ours wouldn't.

    I'll get back to you with additional information asap.

    Can you elaborate on what you mean by mashing different shaders into one?

    Thanks!

    Hey, looking for anything more specific?

    You have the Alpha and Alpha Clip Threshold equivalent, should allow for similar results.

    Thanks!
     
  7. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,995
    Here is my first crack at a foliage shader using the HDSRP... it looks good... but it flickers like crazy and has sorting issues :(. This will also need the same treatment as my SSS shader so I can direct control of transmission and scattering.

    See the fighting... it is supposed to be a patch of grass that is repeatable for levels.

    upload_2018-11-29_8-7-17.png

    upload_2018-11-29_8-4-42.png
     
  8. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,995
    So I am looking at my hair shader code, and a few others, I was looking for ways to run passes of the hair (two with cull set to Back and two set to the front) and perhaps just copying and pasting a full block would help. But then I'm not getting the depth. Perhaps someone who is more versed in writing shader code can help me further, to strip down when I don't need. I see that it mentions iridesence. I won't be using that.


    EDIT: Looking at the shader code, I see a lot of it repeats so I could add passes that switch the faces and render them at the same time



    Code (CSharp):
    1. // Made with Amplify Shader Editor
    2. // Available at the Unity Asset Store - http://u3d.as/y3X
    3. Shader "KRGraphics/Human/HDSRP/Hair/Advanced Hair Kajiya-Kay"
    4. {
    5.     Properties
    6.     {
    7.         [Header (Basic Settings)]_Tint("Tint", Color) = (0.469,0.469,0.469,0)
    8.         _HairbaseRGBAlphaA("Hair base (RGB) Alpha (A)", 2D) = "gray" {}
    9.         [Normal]_NormalMap("Normal Map", 2D) = "bump" {}
    10.         _FiberStrength("Fiber Strength", Range( 0 , 3)) = 0
    11.         [Header (Detail Hair Colour)]_StrandID("Strand ID", 2D) = "gray" {}
    12.         _MainHairColour("Main Hair Colour", Color) = (1,1,1,1)
    13.         _SecondaryHairs("Secondary Hairs", Color) = (1,1,1,1)
    14.         _TertiaryHairs("Tertiary Hairs", Color) = (1,1,1,1)
    15.         _HighlightColour("Highlight Colour", Color) = (1,1,1,0)
    16.         [Header (Base Shading)]_BaseRoughness("Base Roughness", Float) = 0
    17.         _BaseSpecular("Base Specular", Float) = 0.04
    18.         [Header (Debug Options)]_FlatDiffuse("Flat Diffuse", Color) = (0.5019608,0.5019608,0.5019608,0)
    19.         [Toggle]_DiffuseOnly("Diffuse Only", Float) = 0
    20.         [HideInInspector] _texcoord( "", 2D ) = "white" {}
    21.     }
    22.  
    23.     SubShader
    24.     {
    25.         Tags { "RenderPipeline"="HDRenderPipeline" "RenderType"="Transparent" "Queue"="Transparent" }
    26.      
    27.         Cull Off
    28.         Blend SrcAlpha OneMinusSrcAlpha , One OneMinusSrcAlpha
    29.         ZTest LEqual
    30.         ZWrite Off
    31.  
    32.         HLSLINCLUDE
    33.         #pragma target 4.5
    34.         #pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
    35.      
    36.  
    37.         struct GlobalSurfaceDescription
    38.         {
    39.             //Standard
    40.             float3 Albedo;
    41.             float3 Normal;
    42.             float3 Specular;
    43.             float Metallic;
    44.             float3 Emission;
    45.             float Smoothness;
    46.             float Occlusion;
    47.             float Alpha;
    48.             float AlphaClipThreshold;
    49.             float CoatMask;
    50.             //SSS
    51.             uint DiffusionProfile;
    52.             float SubsurfaceMask;
    53.             //Transmission
    54.             float Thickness;
    55.             // Anisotropic
    56.             float3 TangentWS;
    57.             float Anisotropy;
    58.             //Iridescence
    59.             float IridescenceThickness;
    60.             float IridescenceMask;
    61.             // Transparency
    62.             float IndexOfRefraction;
    63.             float3 TransmittanceColor;
    64.             float TransmittanceAbsorptionDistance;
    65.             float TransmittanceMask;
    66.         };
    67.  
    68.         struct AlphaSurfaceDescription
    69.         {
    70.             float Alpha;
    71.             float AlphaClipThreshold;
    72.         };
    73.  
    74.         ENDHLSL
    75.      
    76.         Pass
    77.         {
    78.          
    79.             Name "Main Pass"
    80.             Tags { "LightMode"="GBuffer" }
    81.          
    82.  
    83.  
    84.             HLSLPROGRAM
    85.          
    86.             #pragma vertex Vert
    87.             #pragma fragment Frag
    88.  
    89.             #define _MATERIAL_FEATURE_SPECULAR_COLOR 1
    90.             #define _NORMALMAP 1
    91.             #define _SURFACE_TYPE_TRANSPARENT 1
    92.             #define _BLENDMODE_ALPHA 1
    93.  
    94.      
    95.             #define UNITY_MATERIAL_LIT
    96.      
    97.             #if defined(_MATID_SSS) && !defined(_SURFACE_TYPE_TRANSPARENT)
    98.             #define OUTPUT_SPLIT_LIGHTING
    99.             #endif
    100.      
    101.             #include "CoreRP/ShaderLibrary/Common.hlsl"
    102.             #include "CoreRP/ShaderLibrary/Wind.hlsl"
    103.      
    104.             #include "CoreRP/ShaderLibrary/NormalSurfaceGradient.hlsl"
    105.      
    106.             #include "ShaderGraphLibrary/Functions.hlsl"
    107.      
    108.             #include "HDRP/ShaderPass/FragInputs.hlsl"
    109.             #include "HDRP/ShaderPass/ShaderPass.cs.hlsl"
    110.      
    111.             #define SHADERPASS SHADERPASS_GBUFFER
    112.             #pragma multi_compile _ LIGHTMAP_ON
    113.             #pragma multi_compile _ DIRLIGHTMAP_COMBINED
    114.             #pragma multi_compile _ DYNAMICLIGHTMAP_ON
    115.             #pragma multi_compile _ SHADOWS_SHADOWMASK
    116.             #define ATTRIBUTES_NEED_NORMAL
    117.             #define ATTRIBUTES_NEED_TANGENT
    118.             #define ATTRIBUTES_NEED_TEXCOORD1
    119.             #define ATTRIBUTES_NEED_TEXCOORD2
    120.             #define VARYINGS_NEED_POSITION_WS
    121.             #define VARYINGS_NEED_TANGENT_TO_WORLD
    122.             #define VARYINGS_NEED_TEXCOORD1
    123.             #define VARYINGS_NEED_TEXCOORD2
    124.      
    125.             #include "ShaderGraphLibrary/Functions.hlsl"
    126.             #include "HDRP/ShaderVariables.hlsl"
    127.             #include "HDRP/Material/Material.hlsl"
    128.             #include "HDRP/Material/MaterialUtilities.hlsl"
    129.      
    130.             CBUFFER_START(UnityPerMaterial)
    131.             uniform float _DiffuseOnly;
    132.             uniform float4 _Tint;
    133.             uniform sampler2D _StrandID;
    134.             uniform float4 _StrandID_ST;
    135.             uniform float4 _TertiaryHairs;
    136.             uniform float4 _SecondaryHairs;
    137.             uniform float4 _MainHairColour;
    138.             uniform float4 _FlatDiffuse;
    139.             uniform sampler2D _HairbaseRGBAlphaA;
    140.             uniform float4 _HairbaseRGBAlphaA_ST;
    141.             uniform float _FiberStrength;
    142.             uniform sampler2D _NormalMap;
    143.             uniform float4 _NormalMap_ST;
    144.             uniform float4 _HighlightColour;
    145.             uniform float _BaseSpecular;
    146.             uniform float _BaseRoughness;
    147.             CBUFFER_END
    148.          
    149.             float3x3 BuildWorldToTangent(float4 tangentWS, float3 normalWS)
    150.             {
    151.                 float3 unnormalizedNormalWS = normalWS;
    152.                 float renormFactor = 1.0 / length(unnormalizedNormalWS);
    153.                 float3x3 worldToTangent = CreateWorldToTangent(unnormalizedNormalWS, tangentWS.xyz, tangentWS.w > 0.0 ? 1.0 : -1.0);
    154.                 worldToTangent[0] = worldToTangent[0] * renormFactor;
    155.                 worldToTangent[1] = worldToTangent[1] * renormFactor;
    156.                 worldToTangent[2] = worldToTangent[2] * renormFactor;
    157.                 return worldToTangent;
    158.             }
    159.  
    160.             struct AttributesMesh
    161.             {
    162.                 float4 positionOS : POSITION;
    163.                 float3 normalOS : NORMAL;
    164.                 float4 tangentOS : TANGENT;
    165.                 float2 uv1 : TEXCOORD1;
    166.                 float2 uv2 : TEXCOORD2;
    167.                 float4 ase_texcoord : TEXCOORD0;
    168.             };
    169.  
    170.             struct PackedVaryingsMeshToPS
    171.             {
    172.                 float4 positionCS : SV_Position;
    173.                 float3 interp00 : TEXCOORD0;
    174.                 float3 interp01 : TEXCOORD1;
    175.                 float4 interp02 : TEXCOORD2;
    176.                 float4 interp03 : TEXCOORD3;
    177.                 float4 ase_texcoord4 : TEXCOORD4;
    178.             };
    179.      
    180.             void BuildSurfaceData ( FragInputs fragInputs, GlobalSurfaceDescription surfaceDescription, float3 V, out SurfaceData surfaceData )
    181.             {
    182.                 ZERO_INITIALIZE ( SurfaceData, surfaceData );
    183.  
    184.                 float3 normalTS = float3( 0.0f, 0.0f, 1.0f );
    185.                 normalTS = surfaceDescription.Normal;
    186.                 GetNormalWS ( fragInputs, V, normalTS, surfaceData.normalWS );
    187.  
    188.                 surfaceData.ambientOcclusion = 1.0f;
    189.  
    190.                 surfaceData.baseColor = surfaceDescription.Albedo;
    191.                 surfaceData.perceptualSmoothness = surfaceDescription.Smoothness;
    192.                 surfaceData.ambientOcclusion = surfaceDescription.Occlusion;
    193.  
    194.                 surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD;
    195.  
    196. #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR
    197.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR;
    198.                 surfaceData.specularColor = surfaceDescription.Specular;
    199. #else
    200.                 surfaceData.metallic = surfaceDescription.Metallic;
    201. #endif
    202.  
    203. #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) || defined(_MATERIAL_FEATURE_TRANSMISSION)
    204.                 surfaceData.diffusionProfile = surfaceDescription.DiffusionProfile;
    205. #endif
    206.  
    207. #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING
    208.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING;
    209.                 surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask;
    210. #else
    211.                 surfaceData.subsurfaceMask = 1.0f;
    212. #endif
    213.  
    214. #ifdef _MATERIAL_FEATURE_TRANSMISSION
    215.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION;
    216.                 surfaceData.thickness = surfaceDescription.Thickness;
    217. #endif
    218.  
    219.                 surfaceData.tangentWS = normalize ( fragInputs.worldToTangent[ 0 ].xyz );
    220.                 surfaceData.tangentWS = Orthonormalize ( surfaceData.tangentWS, surfaceData.normalWS );
    221.  
    222. #ifdef _MATERIAL_FEATURE_ANISOTROPY
    223.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY;
    224.                 surfaceData.anisotropy = surfaceDescription.Anisotropy;
    225.  
    226. #else
    227.                 surfaceData.anisotropy = 0;
    228. #endif
    229.  
    230. #ifdef _MATERIAL_FEATURE_CLEAR_COAT
    231.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT;
    232.                 surfaceData.coatMask = surfaceDescription.CoatMask;
    233. #else
    234.                 surfaceData.coatMask = 0.0f;
    235. #endif
    236.  
    237. #ifdef _MATERIAL_FEATURE_IRIDESCENCE
    238.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE;
    239.                 surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness;
    240.                 surfaceData.iridescenceMask = surfaceDescription.IridescenceMask;
    241. #else
    242.                 surfaceData.iridescenceThickness = 0.0;
    243.                 surfaceData.iridescenceMask = 1.0;
    244. #endif
    245.  
    246.                 //ASE CUSTOM TAG
    247. #ifdef _MATERIAL_FEATURE_TRANSPARENCY
    248.                 surfaceData.ior = surfaceDescription.IndexOfRefraction;
    249.                 surfaceData.transmittanceColor = surfaceDescription.TransmittanceColor;
    250.                 surfaceData.atDistance = surfaceDescription.TransmittanceAbsorptionDistance;
    251.                 surfaceData.transmittanceMask = surfaceDescription.TransmittanceMask;
    252. #else
    253.                 surfaceData.ior = 1.0;
    254.                 surfaceData.transmittanceColor = float3( 1.0, 1.0, 1.0 );
    255.                 surfaceData.atDistance = 1000000.0;
    256.                 surfaceData.transmittanceMask = 0.0;
    257. #endif
    258.  
    259.                 surfaceData.specularOcclusion = 1.0;
    260.  
    261. #if defined(_BENTNORMALMAP) && defined(_ENABLESPECULAROCCLUSION)
    262.                 surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO ( V, bentNormalWS, surfaceData );
    263. #elif defined(_MASKMAP)
    264.                 surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion ( NdotV, surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness ( surfaceData.perceptualSmoothness ) );
    265. #endif
    266.             }
    267.  
    268.             void GetSurfaceAndBuiltinData( GlobalSurfaceDescription surfaceDescription , FragInputs fragInputs, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData)
    269.             {
    270.      
    271. #if _ALPHATEST_ON
    272.                 DoAlphaTest ( surfaceDescription.Alpha, surfaceDescription.AlphaClipThreshold );
    273. #endif
    274.                 BuildSurfaceData( fragInputs, surfaceDescription, V, surfaceData );
    275.      
    276.                 ZERO_INITIALIZE(BuiltinData, builtinData);
    277.                 float3 bentNormalWS =                   surfaceData.normalWS;
    278.      
    279.                 builtinData.opacity =                   surfaceDescription.Alpha;
    280.                 builtinData.bakeDiffuseLighting =       SampleBakedGI(fragInputs.positionRWS, bentNormalWS, fragInputs.texCoord1, fragInputs.texCoord2);    // see GetBuiltinData()
    281.      
    282.                 BSDFData bsdfData = ConvertSurfaceDataToBSDFData(posInput.positionSS.xy, surfaceData);
    283.                 if (HasFlag(bsdfData.materialFeatures, MATERIALFEATUREFLAGS_LIT_TRANSMISSION))
    284.                 {
    285.                     builtinData.bakeDiffuseLighting += SampleBakedGI(fragInputs.positionRWS, -fragInputs.worldToTangent[2], fragInputs.texCoord1, fragInputs.texCoord2) * bsdfData.transmittance;
    286.                 }
    287.      
    288.                 builtinData.emissiveColor = surfaceDescription.Emission;
    289.                 builtinData.velocity = float2(0.0, 0.0);
    290.         #ifdef SHADOWS_SHADOWMASK
    291.                 float4 shadowMask = SampleShadowMask(fragInputs.positionRWS, fragInputs.texCoord1);
    292.                 builtinData.shadowMask0 = shadowMask.x;
    293.                 builtinData.shadowMask1 = shadowMask.y;
    294.                 builtinData.shadowMask2 = shadowMask.z;
    295.                 builtinData.shadowMask3 = shadowMask.w;
    296.         #else
    297.                 builtinData.shadowMask0 = 0.0;
    298.                 builtinData.shadowMask1 = 0.0;
    299.                 builtinData.shadowMask2 = 0.0;
    300.                 builtinData.shadowMask3 = 0.0;
    301.         #endif
    302.                 builtinData.distortion =                float2(0.0, 0.0);
    303.                 builtinData.distortionBlur =            0.0;          
    304.                 builtinData.depthOffset =               0.0;          
    305.             }
    306.      
    307.             PackedVaryingsMeshToPS Vert ( AttributesMesh inputMesh  )
    308.             {
    309.                 PackedVaryingsMeshToPS outputPackedVaryingsMeshToPS;
    310.  
    311.                 UNITY_SETUP_INSTANCE_ID ( inputMesh );
    312.                 UNITY_TRANSFER_INSTANCE_ID ( inputMesh, outputPackedVaryingsMeshToPS );
    313.  
    314.                 outputPackedVaryingsMeshToPS.ase_texcoord4.xy = inputMesh.ase_texcoord.xy;
    315.              
    316.                 //setting value to unused interpolator channels and avoid initialization warnings
    317.                 outputPackedVaryingsMeshToPS.ase_texcoord4.zw = 0;
    318.                 inputMesh.positionOS.xyz +=  float3( 0, 0, 0 ) ;
    319.                 inputMesh.normalOS =  inputMesh.normalOS ;
    320.  
    321.                 float3 positionRWS = TransformObjectToWorld ( inputMesh.positionOS.xyz );
    322.                 float3 normalWS = TransformObjectToWorldNormal ( inputMesh.normalOS );
    323.                 float4 tangentWS = float4( TransformObjectToWorldDir ( inputMesh.tangentOS.xyz ), inputMesh.tangentOS.w );
    324.                 float4 positionCS = TransformWorldToHClip ( positionRWS );
    325.  
    326.                 outputPackedVaryingsMeshToPS.positionCS = positionCS;
    327.                 outputPackedVaryingsMeshToPS.interp00.xyz = positionRWS;
    328.                 outputPackedVaryingsMeshToPS.interp01.xyz = normalWS;
    329.                 outputPackedVaryingsMeshToPS.interp02.xyzw = tangentWS;
    330.                 outputPackedVaryingsMeshToPS.interp03.xy = inputMesh.uv1;
    331.                 outputPackedVaryingsMeshToPS.interp03.zw = inputMesh.uv2;
    332.          
    333.                 return outputPackedVaryingsMeshToPS;
    334.             }
    335.  
    336.             void Frag ( PackedVaryingsMeshToPS packedInput, OUTPUT_GBUFFER ( outGBuffer ) OUTPUT_GBUFFER_SHADOWMASK ( outShadowMaskBuffer ) , half ase_vface : VFACE )
    337.             {
    338.                 FragInputs input;
    339.                 ZERO_INITIALIZE ( FragInputs, input );
    340.                 input.worldToTangent = k_identity3x3;
    341.              
    342.                 float3 positionRWS = packedInput.interp00.xyz;
    343.                 float3 normalWS = packedInput.interp01.xyz;
    344.                 float4 tangentWS = packedInput.interp02.xyzw;
    345.                 float2 uv1 = packedInput.interp03.xy;
    346.                 float2 uv2 = packedInput.interp03.zw;
    347.  
    348.                 input.positionSS = packedInput.positionCS;
    349.                 input.positionRWS = positionRWS;
    350.                 input.worldToTangent = BuildWorldToTangent ( tangentWS, normalWS );
    351.                 input.texCoord1 = uv1;
    352.                 input.texCoord2 = uv2;
    353.  
    354.                 // input.positionSS is SV_Position
    355.                 PositionInputs posInput = GetPositionInput ( input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS );
    356.  
    357.                 float3 normalizedWorldViewDir = GetWorldSpaceNormalizeViewDir ( input.positionRWS );
    358.  
    359.                 SurfaceData surfaceData;
    360.                 BuiltinData builtinData;
    361.  
    362.                 GlobalSurfaceDescription surfaceDescription = ( GlobalSurfaceDescription ) 0;
    363.                 float2 uv_StrandID = packedInput.ase_texcoord4.xy * _StrandID_ST.xy + _StrandID_ST.zw;
    364.                 float4 tex2DNode35 = tex2D( _StrandID, uv_StrandID );
    365.                 float3 appendResult38 = (float3(tex2DNode35.r , tex2DNode35.g , tex2DNode35.b));
    366.                 float3 layeredBlendVar41 = appendResult38;
    367.                 float4 layeredBlend41 = ( lerp( lerp( lerp( float4( float3(0,0,0) , 0.0 ) , _TertiaryHairs , layeredBlendVar41.x ) , _SecondaryHairs , layeredBlendVar41.y ) , _MainHairColour , layeredBlendVar41.z ) );
    368.                 float2 uv_HairbaseRGBAlphaA = packedInput.ase_texcoord4.xy * _HairbaseRGBAlphaA_ST.xy + _HairbaseRGBAlphaA_ST.zw;
    369.                 float4 tex2DNode13 = tex2Dbias( _HairbaseRGBAlphaA, float4( uv_HairbaseRGBAlphaA, 0, 0.0) );
    370.              
    371.                 float2 uv_NormalMap = packedInput.ase_texcoord4.xy * _NormalMap_ST.xy + _NormalMap_ST.zw;
    372.                 float3 tex2DNode17 = UnpackNormalmapRGorAG( tex2D( _NormalMap, uv_NormalMap ), _FiberStrength );
    373.                 float4 appendResult18 = (float4(tex2DNode17.r , tex2DNode17.g , ( tex2DNode17.b * ase_vface ) , 0.0));
    374.              
    375.                 surfaceDescription.Albedo = lerp(( _Tint * layeredBlend41 ),( _FlatDiffuse * tex2DNode13.a ),_DiffuseOnly).rgb;
    376.                 surfaceDescription.Normal = appendResult18.xyz;
    377.                 surfaceDescription.Emission = 0;
    378.                 surfaceDescription.Specular = ( _HighlightColour * _BaseSpecular ).rgb;
    379.                 surfaceDescription.Metallic = 0;
    380.                 surfaceDescription.Smoothness = ( tex2DNode13.a * ( 1.0 - _BaseRoughness ) );
    381.                 surfaceDescription.Occlusion = 1;
    382.                 surfaceDescription.Alpha = tex2DNode13.a;
    383.                 surfaceDescription.AlphaClipThreshold = 0;
    384.  
    385. #ifdef _MATERIAL_FEATURE_CLEAR_COAT
    386.                 surfaceDescription.CoatMask = 0;
    387. #endif
    388.  
    389. #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) || defined(_MATERIAL_FEATURE_TRANSMISSION)
    390.                 surfaceDescription.DiffusionProfile = 0;
    391. #endif
    392.  
    393. #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING
    394.                 surfaceDescription.SubsurfaceMask = 1;
    395. #endif
    396.  
    397. #ifdef _MATERIAL_FEATURE_TRANSMISSION
    398.                 surfaceDescription.Thickness = 0;
    399. #endif
    400.  
    401. #ifdef _MATERIAL_FEATURE_ANISOTROPY
    402.                 surfaceDescription.Anisotropy = 0;
    403. #endif
    404.  
    405. #ifdef _MATERIAL_FEATURE_IRIDESCENCE
    406.                 surfaceDescription.IridescenceThickness = 0;
    407.                 surfaceDescription.IridescenceMask = 1;
    408. #endif
    409.  
    410. #ifdef _MATERIAL_FEATURE_TRANSPARENCY
    411.                 surfaceDescription.IndexOfRefraction = 1;
    412.                 surfaceDescription.TransmittanceColor = float3( 1, 1, 1 );
    413.                 surfaceDescription.TransmittanceAbsorptionDistance = 1000000;
    414.                 surfaceDescription.TransmittanceMask = 0;
    415. #endif
    416.                 GetSurfaceAndBuiltinData ( surfaceDescription, input, normalizedWorldViewDir, posInput, surfaceData, builtinData );
    417.  
    418.  
    419.                 BSDFData bsdfData = ConvertSurfaceDataToBSDFData ( input.positionSS.xy, surfaceData );
    420.  
    421.                 PreLightData preLightData = GetPreLightData ( normalizedWorldViewDir, posInput, bsdfData );
    422.  
    423.                 float3 bakeDiffuseLighting = GetBakedDiffuseLighting ( surfaceData, builtinData, bsdfData, preLightData );
    424.  
    425.                 ENCODE_INTO_GBUFFER ( surfaceData, bakeDiffuseLighting, posInput.positionSS, outGBuffer );
    426.                 ENCODE_SHADOWMASK_INTO_GBUFFER ( float4( builtinData.shadowMask0, builtinData.shadowMask1, builtinData.shadowMask2, builtinData.shadowMask3 ), outShadowMaskBuffer );
    427.  
    428.             }
    429.  
    430.             ENDHLSL
    431.         }
    432.      
    433.      
    434.         Pass
    435.         {
    436.          
    437.             Name "GBufferWithPrepass"
    438.             Tags { "LightMode"="GBufferWithPrepass" }
    439.          
    440.  
    441.  
    442.             HLSLPROGRAM
    443.  
    444.             #pragma vertex Vert
    445.             #pragma fragment Frag
    446.  
    447.             #define _MATERIAL_FEATURE_SPECULAR_COLOR 1
    448.             #define _NORMALMAP 1
    449.             #define _SURFACE_TYPE_TRANSPARENT 1
    450.             #define _BLENDMODE_ALPHA 1
    451.  
    452.      
    453.             #define UNITY_MATERIAL_LIT
    454.      
    455.             #if defined(_MATID_SSS) && !defined(_SURFACE_TYPE_TRANSPARENT)
    456.             #define OUTPUT_SPLIT_LIGHTING
    457.             #endif
    458.      
    459.             #include "CoreRP/ShaderLibrary/Common.hlsl"
    460.             #include "CoreRP/ShaderLibrary/Wind.hlsl"
    461.      
    462.             #include "CoreRP/ShaderLibrary/NormalSurfaceGradient.hlsl"
    463.      
    464.             #include "ShaderGraphLibrary/Functions.hlsl"
    465.      
    466.             #include "HDRP/ShaderPass/FragInputs.hlsl"
    467.             #include "HDRP/ShaderPass/ShaderPass.cs.hlsl"
    468.      
    469.             #define SHADERPASS SHADERPASS_GBUFFER
    470.             #pragma multi_compile _ LIGHTMAP_ON
    471.             #pragma multi_compile _ DIRLIGHTMAP_COMBINED
    472.             #pragma multi_compile _ DYNAMICLIGHTMAP_ON
    473.             #pragma multi_compile _ SHADOWS_SHADOWMASK
    474.             #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST
    475.      
    476.             #include "ShaderGraphLibrary/Functions.hlsl"
    477.             #include "HDRP/ShaderVariables.hlsl"
    478.             #include "HDRP/Material/Material.hlsl"
    479.             #include "HDRP/Material/MaterialUtilities.hlsl"
    480.      
    481.             CBUFFER_START(UnityPerMaterial)
    482.             uniform float _DiffuseOnly;
    483.             uniform float4 _Tint;
    484.             uniform sampler2D _StrandID;
    485.             uniform float4 _StrandID_ST;
    486.             uniform float4 _TertiaryHairs;
    487.             uniform float4 _SecondaryHairs;
    488.             uniform float4 _MainHairColour;
    489.             uniform float4 _FlatDiffuse;
    490.             uniform sampler2D _HairbaseRGBAlphaA;
    491.             uniform float4 _HairbaseRGBAlphaA_ST;
    492.             uniform float _FiberStrength;
    493.             uniform sampler2D _NormalMap;
    494.             uniform float4 _NormalMap_ST;
    495.             uniform float4 _HighlightColour;
    496.             uniform float _BaseSpecular;
    497.             uniform float _BaseRoughness;
    498.             CBUFFER_END
    499.          
    500.             struct AttributesMesh
    501.             {
    502.                 float4 positionOS : POSITION;
    503.                 float3 normalOS : NORMAL;
    504.                 float4 ase_texcoord : TEXCOORD0;
    505.             };
    506.  
    507.             struct PackedVaryingsMeshToPS
    508.             {
    509.                 float4 positionCS : SV_Position;
    510.                 float4 ase_texcoord : TEXCOORD0;
    511.             };
    512.  
    513.      
    514.             void BuildSurfaceData ( FragInputs fragInputs, GlobalSurfaceDescription surfaceDescription, float3 V, out SurfaceData surfaceData )
    515.             {
    516.                 ZERO_INITIALIZE ( SurfaceData, surfaceData );
    517.  
    518.                 float3 normalTS = float3( 0.0f, 0.0f, 1.0f );
    519.                 normalTS = surfaceDescription.Normal;
    520.                 GetNormalWS ( fragInputs, V, normalTS, surfaceData.normalWS );
    521.  
    522.                 surfaceData.ambientOcclusion = 1.0f;
    523.  
    524.                 surfaceData.baseColor = surfaceDescription.Albedo;
    525.                 surfaceData.perceptualSmoothness = surfaceDescription.Smoothness;
    526.                 surfaceData.ambientOcclusion = surfaceDescription.Occlusion;
    527.  
    528.                 surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD;
    529.  
    530. #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR
    531.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR;
    532.                 surfaceData.specularColor = surfaceDescription.Specular;
    533. #else
    534.                 surfaceData.metallic = surfaceDescription.Metallic;
    535. #endif
    536.  
    537. #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) || defined(_MATERIAL_FEATURE_TRANSMISSION)
    538.                 surfaceData.diffusionProfile = surfaceDescription.DiffusionProfile;
    539. #endif
    540.  
    541. #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING
    542.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING;
    543.                 surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask;
    544. #else
    545.                 surfaceData.subsurfaceMask = 1.0f;
    546. #endif
    547.  
    548. #ifdef _MATERIAL_FEATURE_TRANSMISSION
    549.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION;
    550.                 surfaceData.thickness = surfaceDescription.Thickness;
    551. #endif
    552.  
    553.                 surfaceData.tangentWS = normalize ( fragInputs.worldToTangent[ 0 ].xyz );
    554.                 surfaceData.tangentWS = Orthonormalize ( surfaceData.tangentWS, surfaceData.normalWS );
    555.  
    556. #ifdef _MATERIAL_FEATURE_ANISOTROPY
    557.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY;
    558.                 surfaceData.anisotropy = surfaceDescription.Anisotropy;
    559.  
    560. #else
    561.                 surfaceData.anisotropy = 0;
    562. #endif
    563.  
    564. #ifdef _MATERIAL_FEATURE_CLEAR_COAT
    565.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT;
    566.                 surfaceData.coatMask = surfaceDescription.CoatMask;
    567. #else
    568.                 surfaceData.coatMask = 0.0f;
    569. #endif
    570.  
    571. #ifdef _MATERIAL_FEATURE_IRIDESCENCE
    572.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE;
    573.                 surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness;
    574.                 surfaceData.iridescenceMask = surfaceDescription.IridescenceMask;
    575. #else
    576.                 surfaceData.iridescenceThickness = 0.0;
    577.                 surfaceData.iridescenceMask = 1.0;
    578. #endif
    579.  
    580.                 //ASE CUSTOM TAG
    581. #ifdef _MATERIAL_FEATURE_TRANSPARENCY
    582.                 surfaceData.ior = surfaceDescription.IndexOfRefraction;
    583.                 surfaceData.transmittanceColor = surfaceDescription.TransmittanceColor;
    584.                 surfaceData.atDistance = surfaceDescription.TransmittanceAbsorptionDistance;
    585.                 surfaceData.transmittanceMask = surfaceDescription.TransmittanceMask;
    586. #else
    587.                 surfaceData.ior = 1.0;
    588.                 surfaceData.transmittanceColor = float3( 1.0, 1.0, 1.0 );
    589.                 surfaceData.atDistance = 1000000.0;
    590.                 surfaceData.transmittanceMask = 0.0;
    591. #endif
    592.  
    593.                 surfaceData.specularOcclusion = 1.0;
    594.  
    595. #if defined(_BENTNORMALMAP) && defined(_ENABLESPECULAROCCLUSION)
    596.                 surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO ( V, bentNormalWS, surfaceData );
    597. #elif defined(_MASKMAP)
    598.                 surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion ( NdotV, surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness ( surfaceData.perceptualSmoothness ) );
    599. #endif
    600.             }
    601.  
    602.             void GetSurfaceAndBuiltinData( GlobalSurfaceDescription surfaceDescription , FragInputs fragInputs, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData)
    603.             {
    604.      
    605. #if _ALPHATEST_ON
    606.                 DoAlphaTest ( surfaceDescription.Alpha, surfaceDescription.AlphaClipThreshold );
    607. #endif
    608.                 BuildSurfaceData(fragInputs, surfaceDescription, V, surfaceData);
    609.      
    610.                 ZERO_INITIALIZE(BuiltinData, builtinData);
    611.                 float3 bentNormalWS =                   surfaceData.normalWS;
    612.      
    613.                 builtinData.opacity =                   surfaceDescription.Alpha;
    614.                 builtinData.bakeDiffuseLighting =       SampleBakedGI(fragInputs.positionRWS, bentNormalWS, fragInputs.texCoord1, fragInputs.texCoord2);
    615.                 BSDFData bsdfData = ConvertSurfaceDataToBSDFData(posInput.positionSS.xy, surfaceData);
    616.                 if (HasFlag(bsdfData.materialFeatures, MATERIALFEATUREFLAGS_LIT_TRANSMISSION))
    617.                 {
    618.                     builtinData.bakeDiffuseLighting += SampleBakedGI(fragInputs.positionRWS, -fragInputs.worldToTangent[2], fragInputs.texCoord1, fragInputs.texCoord2) * bsdfData.transmittance;
    619.                 }
    620.      
    621.                 builtinData.emissiveColor = surfaceDescription.Emission;
    622.                 builtinData.velocity = float2(0.0, 0.0);
    623.         #ifdef SHADOWS_SHADOWMASK
    624.                 float4 shadowMask = SampleShadowMask(fragInputs.positionRWS, fragInputs.texCoord1);
    625.                 builtinData.shadowMask0 = shadowMask.x;
    626.                 builtinData.shadowMask1 = shadowMask.y;
    627.                 builtinData.shadowMask2 = shadowMask.z;
    628.                 builtinData.shadowMask3 = shadowMask.w;
    629.         #else
    630.                 builtinData.shadowMask0 = 0.0;
    631.                 builtinData.shadowMask1 = 0.0;
    632.                 builtinData.shadowMask2 = 0.0;
    633.                 builtinData.shadowMask3 = 0.0;
    634.         #endif
    635.                 builtinData.distortion =                float2(0.0, 0.0);
    636.                 builtinData.distortionBlur =            0.0;          
    637.                 builtinData.depthOffset =               0.0;          
    638.             }
    639.      
    640.             PackedVaryingsMeshToPS Vert ( AttributesMesh inputMesh  )
    641.             {
    642.                 PackedVaryingsMeshToPS outputPackedVaryingsMeshToPS;
    643.  
    644.                 UNITY_SETUP_INSTANCE_ID ( inputMesh );
    645.                 UNITY_TRANSFER_INSTANCE_ID ( inputMesh, outputPackedVaryingsMeshToPS );
    646.  
    647.                 outputPackedVaryingsMeshToPS.ase_texcoord.xy = inputMesh.ase_texcoord.xy;
    648.              
    649.                 //setting value to unused interpolator channels and avoid initialization warnings
    650.                 outputPackedVaryingsMeshToPS.ase_texcoord.zw = 0;
    651.                 inputMesh.positionOS.xyz +=  float3( 0, 0, 0 ) ;
    652.                 inputMesh.normalOS =  inputMesh.normalOS ;
    653.  
    654.                 float3 positionRWS = TransformObjectToWorld ( inputMesh.positionOS.xyz );
    655.                 float4 positionCS = TransformWorldToHClip ( positionRWS );
    656.  
    657.                 outputPackedVaryingsMeshToPS.positionCS = positionCS;
    658.                 return outputPackedVaryingsMeshToPS;
    659.             }
    660.  
    661.             void Frag ( PackedVaryingsMeshToPS packedInput, OUTPUT_GBUFFER ( outGBuffer ) OUTPUT_GBUFFER_SHADOWMASK ( outShadowMaskBuffer ) , half ase_vface : VFACE )
    662.             {
    663.                 FragInputs input;
    664.                 ZERO_INITIALIZE ( FragInputs, input );
    665.                 input.worldToTangent = k_identity3x3;
    666.                 input.positionSS = packedInput.positionCS;
    667.  
    668.  
    669.                 // input.positionSS is SV_Position
    670.                 PositionInputs posInput = GetPositionInput ( input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS );
    671.  
    672.                 float3 normalizedWorldViewDir = 0;
    673.  
    674.                 SurfaceData surfaceData;
    675.                 BuiltinData builtinData;
    676.  
    677.                 GlobalSurfaceDescription surfaceDescription = ( GlobalSurfaceDescription ) 0;
    678.                 float2 uv_StrandID = packedInput.ase_texcoord.xy * _StrandID_ST.xy + _StrandID_ST.zw;
    679.                 float4 tex2DNode35 = tex2D( _StrandID, uv_StrandID );
    680.                 float3 appendResult38 = (float3(tex2DNode35.r , tex2DNode35.g , tex2DNode35.b));
    681.                 float3 layeredBlendVar41 = appendResult38;
    682.                 float4 layeredBlend41 = ( lerp( lerp( lerp( float4( float3(0,0,0) , 0.0 ) , _TertiaryHairs , layeredBlendVar41.x ) , _SecondaryHairs , layeredBlendVar41.y ) , _MainHairColour , layeredBlendVar41.z ) );
    683.                 float2 uv_HairbaseRGBAlphaA = packedInput.ase_texcoord.xy * _HairbaseRGBAlphaA_ST.xy + _HairbaseRGBAlphaA_ST.zw;
    684.                 float4 tex2DNode13 = tex2Dbias( _HairbaseRGBAlphaA, float4( uv_HairbaseRGBAlphaA, 0, 0.0) );
    685.              
    686.                 float2 uv_NormalMap = packedInput.ase_texcoord.xy * _NormalMap_ST.xy + _NormalMap_ST.zw;
    687.                 float3 tex2DNode17 = UnpackNormalmapRGorAG( tex2D( _NormalMap, uv_NormalMap ), _FiberStrength );
    688.                 float4 appendResult18 = (float4(tex2DNode17.r , tex2DNode17.g , ( tex2DNode17.b * ase_vface ) , 0.0));
    689.              
    690.                 surfaceDescription.Albedo = lerp(( _Tint * layeredBlend41 ),( _FlatDiffuse * tex2DNode13.a ),_DiffuseOnly).rgb;
    691.                 surfaceDescription.Normal = appendResult18.xyz;
    692.                 surfaceDescription.Emission = 0;
    693.                 surfaceDescription.Specular = ( _HighlightColour * _BaseSpecular ).rgb;
    694.                 surfaceDescription.Metallic = 0;
    695.                 surfaceDescription.Smoothness = ( tex2DNode13.a * ( 1.0 - _BaseRoughness ) );
    696.                 surfaceDescription.Occlusion = 1;
    697.                 surfaceDescription.Alpha = tex2DNode13.a;
    698.                 surfaceDescription.AlphaClipThreshold = 0;
    699.  
    700. #ifdef _MATERIAL_FEATURE_CLEAR_COAT
    701.                 surfaceDescription.CoatMask = 0;
    702. #endif
    703.  
    704. #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) || defined(_MATERIAL_FEATURE_TRANSMISSION)
    705.                 surfaceDescription.DiffusionProfile = 0;
    706. #endif
    707.  
    708. #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING
    709.                 surfaceDescription.SubsurfaceMask = 1;
    710. #endif
    711.  
    712. #ifdef _MATERIAL_FEATURE_TRANSMISSION
    713.                 surfaceDescription.Thickness = 0;
    714. #endif
    715.  
    716. #ifdef _MATERIAL_FEATURE_ANISOTROPY
    717.                 surfaceDescription.Anisotropy = 0;
    718. #endif
    719.  
    720. #ifdef _MATERIAL_FEATURE_IRIDESCENCE
    721.                 surfaceDescription.IridescenceThickness = 0;
    722.                 surfaceDescription.IridescenceMask = 1;
    723. #endif
    724.  
    725. #ifdef _MATERIAL_FEATURE_TRANSPARENCY
    726.                 surfaceDescription.IndexOfRefraction = 1;
    727.                 surfaceDescription.TransmittanceColor = float3( 1, 1, 1 );
    728.                 surfaceDescription.TransmittanceAbsorptionDistance = 1000000;
    729.                 surfaceDescription.TransmittanceMask = 0;
    730. #endif
    731.  
    732.                 GetSurfaceAndBuiltinData ( surfaceDescription, input, normalizedWorldViewDir, posInput, surfaceData, builtinData );
    733.  
    734.                 BSDFData bsdfData = ConvertSurfaceDataToBSDFData ( input.positionSS.xy, surfaceData );
    735.  
    736.                 PreLightData preLightData = GetPreLightData ( normalizedWorldViewDir, posInput, bsdfData );
    737.  
    738.                 float3 bakeDiffuseLighting = GetBakedDiffuseLighting ( surfaceData, builtinData, bsdfData, preLightData );
    739.  
    740.                 ENCODE_INTO_GBUFFER ( surfaceData, bakeDiffuseLighting, posInput.positionSS, outGBuffer );
    741.                 ENCODE_SHADOWMASK_INTO_GBUFFER ( float4( builtinData.shadowMask0, builtinData.shadowMask1, builtinData.shadowMask2, builtinData.shadowMask3 ), outShadowMaskBuffer );
    742.  
    743.             }
    744.  
    745.             ENDHLSL
    746.         }
    747.  
    748.      
    749.         Pass
    750.         {
    751.          
    752.             Name "META"
    753.             Tags { "LightMode"="Meta" }
    754.             Cull Off
    755.             HLSLPROGRAM
    756.  
    757.             #pragma vertex Vert
    758.             #pragma fragment Frag
    759.  
    760.             #define _MATERIAL_FEATURE_SPECULAR_COLOR 1
    761.             #define _NORMALMAP 1
    762.             #define _SURFACE_TYPE_TRANSPARENT 1
    763.             #define _BLENDMODE_ALPHA 1
    764.  
    765.  
    766.             #define UNITY_MATERIAL_LIT      // Need to be define before including Material.hlsl
    767.      
    768.             #if defined(_MATID_SSS) && !defined(_SURFACE_TYPE_TRANSPARENT)
    769.             #define OUTPUT_SPLIT_LIGHTING
    770.             #endif
    771.      
    772.             #include "CoreRP/ShaderLibrary/Common.hlsl"
    773.             #include "CoreRP/ShaderLibrary/Wind.hlsl"
    774.      
    775.             #include "CoreRP/ShaderLibrary/NormalSurfaceGradient.hlsl"
    776.      
    777.             #include "ShaderGraphLibrary/Functions.hlsl"
    778.      
    779.             #include "HDRP/ShaderPass/FragInputs.hlsl"
    780.             #include "HDRP/ShaderPass/ShaderPass.cs.hlsl"
    781.      
    782.             #define SHADERPASS SHADERPASS_LIGHT_TRANSPORT
    783.             #define ATTRIBUTES_NEED_NORMAL
    784.             #define ATTRIBUTES_NEED_TANGENT
    785.             #define ATTRIBUTES_NEED_TEXCOORD0
    786.             #define ATTRIBUTES_NEED_TEXCOORD1
    787.             #define ATTRIBUTES_NEED_TEXCOORD2
    788.             #define ATTRIBUTES_NEED_COLOR
    789.      
    790.             #include "ShaderGraphLibrary/Functions.hlsl"
    791.             #include "HDRP/ShaderVariables.hlsl"
    792.             #include "HDRP/Material/Material.hlsl"
    793.             #include "HDRP/Material/MaterialUtilities.hlsl"
    794.      
    795.             CBUFFER_START(UnityPerMaterial)
    796.             uniform float _DiffuseOnly;
    797.             uniform float4 _Tint;
    798.             uniform sampler2D _StrandID;
    799.             uniform float4 _StrandID_ST;
    800.             uniform float4 _TertiaryHairs;
    801.             uniform float4 _SecondaryHairs;
    802.             uniform float4 _MainHairColour;
    803.             uniform float4 _FlatDiffuse;
    804.             uniform sampler2D _HairbaseRGBAlphaA;
    805.             uniform float4 _HairbaseRGBAlphaA_ST;
    806.             uniform float _FiberStrength;
    807.             uniform sampler2D _NormalMap;
    808.             uniform float4 _NormalMap_ST;
    809.             uniform float4 _HighlightColour;
    810.             uniform float _BaseSpecular;
    811.             uniform float _BaseRoughness;
    812.             CBUFFER_END
    813.          
    814.             struct AttributesMesh
    815.             {
    816.                 float4 positionOS : POSITION;
    817.                 float3 normalOS : NORMAL;
    818.                 float4 tangentOS : TANGENT;
    819.                 float2 uv0 : TEXCOORD0;
    820.                 float2 uv1 : TEXCOORD1;
    821.                 float2 uv2 : TEXCOORD2;
    822.                 float4 color : COLOR;
    823.              
    824.             };
    825.  
    826.             struct PackedVaryingsMeshToPS
    827.             {
    828.                 float4 positionCS : SV_Position;
    829.                 float4 ase_texcoord : TEXCOORD0;
    830.             };
    831.          
    832.             void BuildSurfaceData ( FragInputs fragInputs, GlobalSurfaceDescription surfaceDescription, float3 V, out SurfaceData surfaceData )
    833.             {
    834.                 ZERO_INITIALIZE ( SurfaceData, surfaceData );
    835.  
    836.                 float3 normalTS = float3( 0.0f, 0.0f, 1.0f );
    837.                 normalTS = surfaceDescription.Normal;
    838.                 GetNormalWS ( fragInputs, V, normalTS, surfaceData.normalWS );
    839.  
    840.                 surfaceData.ambientOcclusion = 1.0f;
    841.  
    842.                 surfaceData.baseColor = surfaceDescription.Albedo;
    843.                 surfaceData.perceptualSmoothness = surfaceDescription.Smoothness;
    844.                 surfaceData.ambientOcclusion = surfaceDescription.Occlusion;
    845.  
    846.                 surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD;
    847.  
    848. #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR
    849.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR;
    850.                 surfaceData.specularColor = surfaceDescription.Specular;
    851. #else
    852.                 surfaceData.metallic = surfaceDescription.Metallic;
    853. #endif
    854.  
    855. #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) || defined(_MATERIAL_FEATURE_TRANSMISSION)
    856.                 surfaceData.diffusionProfile = surfaceDescription.DiffusionProfile;
    857. #endif
    858.  
    859. #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING
    860.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING;
    861.                 surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask;
    862.  
    863. #else
    864.                 surfaceData.subsurfaceMask = 1.0f;
    865. #endif
    866.  
    867. #ifdef _MATERIAL_FEATURE_TRANSMISSION
    868.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION;
    869.                 surfaceData.thickness = surfaceDescription.Thickness;
    870. #endif
    871.  
    872.                 surfaceData.tangentWS = normalize ( fragInputs.worldToTangent[ 0 ].xyz );
    873.                 surfaceData.tangentWS = Orthonormalize ( surfaceData.tangentWS, surfaceData.normalWS );
    874.  
    875. #ifdef _MATERIAL_FEATURE_ANISOTROPY
    876.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY;
    877.                 surfaceData.anisotropy = surfaceDescription.Anisotropy;
    878.  
    879. #else
    880.                 surfaceData.anisotropy = 0;
    881. #endif
    882.  
    883. #ifdef _MATERIAL_FEATURE_CLEAR_COAT
    884.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT;
    885.                 surfaceData.coatMask = surfaceDescription.CoatMask;
    886. #else
    887.                 surfaceData.coatMask = 0.0f;
    888. #endif
    889.  
    890. #ifdef _MATERIAL_FEATURE_IRIDESCENCE
    891.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE;
    892.                 surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness;
    893.                 surfaceData.iridescenceMask = surfaceDescription.IridescenceMask;
    894. #else
    895.                 surfaceData.iridescenceThickness = 0.0;
    896.                 surfaceData.iridescenceMask = 1.0;
    897. #endif
    898.  
    899.                 //ASE CUSTOM TAG
    900. #ifdef _MATERIAL_FEATURE_TRANSPARENCY
    901.                 surfaceData.ior = surfaceDescription.IndexOfRefraction;
    902.                 surfaceData.transmittanceColor = surfaceDescription.TransmittanceColor;
    903.                 surfaceData.atDistance = surfaceDescription.TransmittanceAbsorptionDistance;
    904.                 surfaceData.transmittanceMask = surfaceDescription.TransmittanceMask;
    905. #else
    906.                 surfaceData.ior = 1.0;
    907.                 surfaceData.transmittanceColor = float3( 1.0, 1.0, 1.0 );
    908.                 surfaceData.atDistance = 1000000.0;
    909.                 surfaceData.transmittanceMask = 0.0;
    910. #endif
    911.  
    912.                 surfaceData.specularOcclusion = 1.0;
    913.  
    914. #if defined(_BENTNORMALMAP) && defined(_ENABLESPECULAROCCLUSION)
    915.                 surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO ( V, bentNormalWS, surfaceData );
    916. #elif defined(_MASKMAP)
    917.                 surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion ( NdotV, surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness ( surfaceData.perceptualSmoothness ) );
    918. #endif
    919.             }
    920.  
    921.             void GetSurfaceAndBuiltinData( GlobalSurfaceDescription surfaceDescription, FragInputs fragInputs, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData)
    922.             {
    923. #if _ALPHATEST_ON
    924.                 DoAlphaTest ( surfaceDescription.Alpha, surfaceDescription.AlphaClipThreshold );
    925. #endif
    926.                 BuildSurfaceData (fragInputs, surfaceDescription, V, surfaceData);
    927.      
    928.                 ZERO_INITIALIZE(BuiltinData, builtinData);
    929.                 float3 bentNormalWS = surfaceData.normalWS;
    930.      
    931.                 builtinData.opacity = surfaceDescription.Alpha;
    932.                 builtinData.bakeDiffuseLighting = SampleBakedGI(fragInputs.positionRWS, bentNormalWS, fragInputs.texCoord1, fragInputs.texCoord2);
    933.      
    934.                 BSDFData bsdfData = ConvertSurfaceDataToBSDFData(posInput.positionSS.xy, surfaceData);
    935.                 if (HasFlag(bsdfData.materialFeatures, MATERIALFEATUREFLAGS_LIT_TRANSMISSION))
    936.                 {
    937.                     builtinData.bakeDiffuseLighting += SampleBakedGI(fragInputs.positionRWS, -fragInputs.worldToTangent[2], fragInputs.texCoord1, fragInputs.texCoord2) * bsdfData.transmittance;
    938.                 }
    939.      
    940.                 builtinData.emissiveColor = surfaceDescription.Emission;
    941.                 builtinData.velocity = float2(0.0, 0.0);
    942.         #ifdef SHADOWS_SHADOWMASK
    943.                 float4 shadowMask = SampleShadowMask(fragInputs.positionRWS, fragInputs.texCoord1);
    944.                 builtinData.shadowMask0 = shadowMask.x;
    945.                 builtinData.shadowMask1 = shadowMask.y;
    946.                 builtinData.shadowMask2 = shadowMask.z;
    947.                 builtinData.shadowMask3 = shadowMask.w;
    948.         #else
    949.                 builtinData.shadowMask0 = 0.0;
    950.                 builtinData.shadowMask1 = 0.0;
    951.                 builtinData.shadowMask2 = 0.0;
    952.                 builtinData.shadowMask3 = 0.0;
    953.         #endif
    954.                 builtinData.distortion =                float2(0.0, 0.0);
    955.                 builtinData.distortionBlur =            0.0;
    956.                 builtinData.depthOffset =               0.0;
    957.             }
    958.      
    959.        
    960.             CBUFFER_START ( UnityMetaPass )
    961.                 bool4 unity_MetaVertexControl;
    962.                 bool4 unity_MetaFragmentControl;
    963.             CBUFFER_END
    964.  
    965.  
    966.             float unity_OneOverOutputBoost;
    967.             float unity_MaxOutputValue;
    968.  
    969.             PackedVaryingsMeshToPS Vert ( AttributesMesh inputMesh  )
    970.             {
    971.                 PackedVaryingsMeshToPS outputPackedVaryingsMeshToPS;
    972.  
    973.                 UNITY_SETUP_INSTANCE_ID ( inputMesh );
    974.                 UNITY_TRANSFER_INSTANCE_ID ( inputMesh, outputPackedVaryingsMeshToPS );
    975.  
    976.                 outputPackedVaryingsMeshToPS.ase_texcoord.xy = inputMesh.uv0;
    977.              
    978.                 //setting value to unused interpolator channels and avoid initialization warnings
    979.                 outputPackedVaryingsMeshToPS.ase_texcoord.zw = 0;
    980.                 inputMesh.positionOS.xyz +=  float3( 0, 0, 0 ) ;
    981.                 inputMesh.normalOS =  inputMesh.normalOS ;
    982.  
    983.                 float2 uv;
    984.  
    985.                 if ( unity_MetaVertexControl.x )
    986.                 {
    987.                     uv = inputMesh.uv1 * unity_LightmapST.xy + unity_LightmapST.zw;
    988.                 }
    989.                 else if ( unity_MetaVertexControl.y )
    990.                 {
    991.                     uv = inputMesh.uv2 * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw;
    992.                 }
    993.  
    994.                 outputPackedVaryingsMeshToPS.positionCS = float4( uv * 2.0 - 1.0, inputMesh.positionOS.z > 0 ? 1.0e-4 : 0.0, 1.0 );
    995.  
    996.                 return outputPackedVaryingsMeshToPS;
    997.             }
    998.  
    999.             float4 Frag ( PackedVaryingsMeshToPS packedInput , half ase_vface : VFACE ) : SV_Target
    1000.             {
    1001.                 FragInputs input;
    1002.                 ZERO_INITIALIZE ( FragInputs, input );
    1003.                 input.worldToTangent = k_identity3x3;
    1004.                 input.positionSS = packedInput.positionCS;
    1005.  
    1006.                 PositionInputs posInput = GetPositionInput ( input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS );
    1007.  
    1008.                 float3 V = 0;
    1009.  
    1010.                 SurfaceData surfaceData;
    1011.                 BuiltinData builtinData;
    1012.  
    1013.                 GlobalSurfaceDescription surfaceDescription = ( GlobalSurfaceDescription ) 0;
    1014.                 float2 uv_StrandID = packedInput.ase_texcoord.xy * _StrandID_ST.xy + _StrandID_ST.zw;
    1015.                 float4 tex2DNode35 = tex2D( _StrandID, uv_StrandID );
    1016.                 float3 appendResult38 = (float3(tex2DNode35.r , tex2DNode35.g , tex2DNode35.b));
    1017.                 float3 layeredBlendVar41 = appendResult38;
    1018.                 float4 layeredBlend41 = ( lerp( lerp( lerp( float4( float3(0,0,0) , 0.0 ) , _TertiaryHairs , layeredBlendVar41.x ) , _SecondaryHairs , layeredBlendVar41.y ) , _MainHairColour , layeredBlendVar41.z ) );
    1019.                 float2 uv_HairbaseRGBAlphaA = packedInput.ase_texcoord.xy * _HairbaseRGBAlphaA_ST.xy + _HairbaseRGBAlphaA_ST.zw;
    1020.                 float4 tex2DNode13 = tex2Dbias( _HairbaseRGBAlphaA, float4( uv_HairbaseRGBAlphaA, 0, 0.0) );
    1021.              
    1022.                 float2 uv_NormalMap = packedInput.ase_texcoord.xy * _NormalMap_ST.xy + _NormalMap_ST.zw;
    1023.                 float3 tex2DNode17 = UnpackNormalmapRGorAG( tex2D( _NormalMap, uv_NormalMap ), _FiberStrength );
    1024.                 float4 appendResult18 = (float4(tex2DNode17.r , tex2DNode17.g , ( tex2DNode17.b * ase_vface ) , 0.0));
    1025.              
    1026.                 surfaceDescription.Albedo = lerp(( _Tint * layeredBlend41 ),( _FlatDiffuse * tex2DNode13.a ),_DiffuseOnly).rgb;
    1027.                 surfaceDescription.Normal = appendResult18.xyz;
    1028.                 surfaceDescription.Emission = 0;
    1029.                 surfaceDescription.Specular = ( _HighlightColour * _BaseSpecular ).rgb;
    1030.                 surfaceDescription.Metallic = 0;
    1031.                 surfaceDescription.Smoothness = ( tex2DNode13.a * ( 1.0 - _BaseRoughness ) );
    1032.                 surfaceDescription.Occlusion = 1;
    1033.                 surfaceDescription.Alpha = tex2DNode13.a;
    1034.                 surfaceDescription.AlphaClipThreshold = 0;
    1035.  
    1036. #ifdef _MATERIAL_FEATURE_CLEAR_COAT
    1037.                 surfaceDescription.CoatMask = 0;
    1038. #endif
    1039.  
    1040. #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) || defined(_MATERIAL_FEATURE_TRANSMISSION)
    1041.                 surfaceDescription.DiffusionProfile = 0;
    1042. #endif
    1043.  
    1044. #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING
    1045.                 surfaceDescription.SubsurfaceMask = 1;
    1046. #endif
    1047.  
    1048. #ifdef _MATERIAL_FEATURE_TRANSMISSION
    1049.                 surfaceDescription.Thickness = 0;
    1050. #endif
    1051.  
    1052. #ifdef _MATERIAL_FEATURE_ANISOTROPY
    1053.                 surfaceDescription.Anisotropy = 0;
    1054. #endif
    1055.  
    1056. #ifdef _MATERIAL_FEATURE_IRIDESCENCE
    1057.                 surfaceDescription.IridescenceThickness = 0;
    1058.                 surfaceDescription.IridescenceMask = 1;
    1059. #endif
    1060.  
    1061. #ifdef _MATERIAL_FEATURE_TRANSPARENCY
    1062.                 surfaceDescription.IndexOfRefraction = 1;
    1063.                 surfaceDescription.TransmittanceColor = float3( 1, 1, 1 );
    1064.                 surfaceDescription.TransmittanceAbsorptionDistance = 1000000;
    1065.                 surfaceDescription.TransmittanceMask = 0;
    1066. #endif
    1067.  
    1068.                 GetSurfaceAndBuiltinData ( surfaceDescription, input, V, posInput, surfaceData, builtinData );
    1069.  
    1070.                 BSDFData bsdfData = ConvertSurfaceDataToBSDFData ( input.positionSS.xy, surfaceData );
    1071.  
    1072.                 LightTransportData lightTransportData = GetLightTransportData ( surfaceData, builtinData, bsdfData );
    1073.  
    1074.                 float4 res = float4( 0.0, 0.0, 0.0, 1.0 );
    1075.                 if ( unity_MetaFragmentControl.x )
    1076.                 {
    1077.                     res.rgb = clamp ( pow ( abs ( lightTransportData.diffuseColor ), saturate ( unity_OneOverOutputBoost ) ), 0, unity_MaxOutputValue );
    1078.                 }
    1079.  
    1080.                 if ( unity_MetaFragmentControl.y )
    1081.                 {
    1082.                     res.rgb = lightTransportData.emissiveColor;
    1083.                 }
    1084.  
    1085.                 return res;
    1086.             }
    1087.    
    1088.             ENDHLSL
    1089.         }
    1090.  
    1091.      
    1092.         Pass
    1093.         {
    1094.          
    1095.             Name "ShadowCaster"
    1096.             Tags { "LightMode"="ShadowCaster" }
    1097.             ColorMask 0
    1098.             ZClip [_ZClip]
    1099.  
    1100.             HLSLPROGRAM
    1101.  
    1102.             #pragma vertex Vert
    1103.             #pragma fragment Frag
    1104.  
    1105.             #define _MATERIAL_FEATURE_SPECULAR_COLOR 1
    1106.             #define _SURFACE_TYPE_TRANSPARENT 1
    1107.             #define _BLENDMODE_ALPHA 1
    1108.  
    1109.  
    1110.             #define UNITY_MATERIAL_LIT
    1111.      
    1112.             #if defined(_MATID_SSS) && !defined(_SURFACE_TYPE_TRANSPARENT)
    1113.             #define OUTPUT_SPLIT_LIGHTING
    1114.             #endif
    1115.      
    1116.             #include "CoreRP/ShaderLibrary/Common.hlsl"
    1117.             #include "CoreRP/ShaderLibrary/Wind.hlsl"
    1118.      
    1119.             #include "CoreRP/ShaderLibrary/NormalSurfaceGradient.hlsl"
    1120.      
    1121.             #include "ShaderGraphLibrary/Functions.hlsl"
    1122.      
    1123.             #include "HDRP/ShaderPass/FragInputs.hlsl"
    1124.             #include "HDRP/ShaderPass/ShaderPass.cs.hlsl"
    1125.      
    1126.             #define SHADERPASS SHADERPASS_SHADOWS
    1127.             #define USE_LEGACY_UNITY_MATRIX_VARIABLES
    1128.      
    1129.             #include "ShaderGraphLibrary/Functions.hlsl"
    1130.             #include "HDRP/ShaderVariables.hlsl"
    1131.             #include "HDRP/Material/Material.hlsl"
    1132.             #include "HDRP/Material/MaterialUtilities.hlsl"
    1133.      
    1134.             CBUFFER_START(UnityPerMaterial)
    1135.             uniform sampler2D _HairbaseRGBAlphaA;
    1136.             uniform float4 _HairbaseRGBAlphaA_ST;
    1137.             CBUFFER_END
    1138.          
    1139.             struct AttributesMesh
    1140.             {
    1141.                 float4 positionOS : POSITION;
    1142.                 float3 normalOS : NORMAL;
    1143.                 float4 ase_texcoord : TEXCOORD0;
    1144.             };
    1145.  
    1146.             struct PackedVaryingsMeshToPS
    1147.             {
    1148.                 float4 positionCS : SV_Position;
    1149.                 float4 ase_texcoord : TEXCOORD0;
    1150.             };
    1151.      
    1152.             void BuildSurfaceData(FragInputs fragInputs, AlphaSurfaceDescription surfaceDescription, float3 V, out SurfaceData surfaceData)
    1153.             {
    1154.                 ZERO_INITIALIZE(SurfaceData, surfaceData);
    1155.                 surfaceData.ambientOcclusion =      1.0f;
    1156.                 surfaceData.subsurfaceMask =        1.0f;
    1157.      
    1158.                 surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD;
    1159.         #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING
    1160.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING;
    1161.         #endif
    1162.         #ifdef _MATERIAL_FEATURE_TRANSMISSION
    1163.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION;
    1164.         #endif
    1165.         #ifdef _MATERIAL_FEATURE_ANISOTROPY
    1166.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY;
    1167.         #endif
    1168.         #ifdef _MATERIAL_FEATURE_CLEAR_COAT
    1169.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT;
    1170.         #endif
    1171.         #ifdef _MATERIAL_FEATURE_IRIDESCENCE
    1172.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE;
    1173.         #endif
    1174.         #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR
    1175.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR;
    1176.         #endif
    1177.      
    1178.                 float3 normalTS = float3(0.0f, 0.0f, 1.0f);
    1179.                 GetNormalWS(fragInputs, V, normalTS, surfaceData.normalWS);
    1180.                 surfaceData.tangentWS = normalize(fragInputs.worldToTangent[0].xyz);
    1181.                 surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS);
    1182.                 surfaceData.anisotropy = 0;
    1183.                 surfaceData.coatMask = 0.0f;
    1184.                 surfaceData.iridescenceThickness = 0.0;
    1185.                 surfaceData.iridescenceMask = 1.0;
    1186.                 surfaceData.ior = 1.0;
    1187.                 surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0);
    1188.                 surfaceData.atDistance = 1000000.0;
    1189.                 surfaceData.transmittanceMask = 0.0;
    1190.                 surfaceData.specularOcclusion = 1.0;
    1191.         #if defined(_BENTNORMALMAP) && defined(_ENABLESPECULAROCCLUSION)
    1192.                 surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData);
    1193.         #elif defined(_MASKMAP)
    1194.                 surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(NdotV, surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness));
    1195.         #endif
    1196.             }
    1197.      
    1198.             void GetSurfaceAndBuiltinData( AlphaSurfaceDescription surfaceDescription, FragInputs fragInputs, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData)
    1199.             {
    1200. #if _ALPHATEST_ON
    1201.                 DoAlphaTest ( surfaceDescription.Alpha, surfaceDescription.AlphaClipThreshold );
    1202. #endif
    1203.                 BuildSurfaceData(fragInputs, surfaceDescription, V, surfaceData);
    1204.                 ZERO_INITIALIZE(BuiltinData, builtinData);
    1205.                 float3 bentNormalWS = surfaceData.normalWS;
    1206.      
    1207.                 builtinData.opacity = surfaceDescription.Alpha;
    1208.                 builtinData.bakeDiffuseLighting = SampleBakedGI(fragInputs.positionRWS, bentNormalWS, fragInputs.texCoord1, fragInputs.texCoord2);
    1209.      
    1210.                 BSDFData bsdfData = ConvertSurfaceDataToBSDFData(posInput.positionSS.xy, surfaceData);
    1211.                 if (HasFlag(bsdfData.materialFeatures, MATERIALFEATUREFLAGS_LIT_TRANSMISSION))
    1212.                 {
    1213.                     builtinData.bakeDiffuseLighting += SampleBakedGI(fragInputs.positionRWS, -fragInputs.worldToTangent[2], fragInputs.texCoord1, fragInputs.texCoord2) * bsdfData.transmittance;
    1214.                 }
    1215.      
    1216.                 builtinData.velocity = float2(0.0, 0.0);
    1217.         #ifdef SHADOWS_SHADOWMASK
    1218.                 float4 shadowMask = SampleShadowMask(fragInputs.positionRWS, fragInputs.texCoord1);
    1219.                 builtinData.shadowMask0 = shadowMask.x;
    1220.                 builtinData.shadowMask1 = shadowMask.y;
    1221.                 builtinData.shadowMask2 = shadowMask.z;
    1222.                 builtinData.shadowMask3 = shadowMask.w;
    1223.         #else
    1224.                 builtinData.shadowMask0 = 0.0;
    1225.                 builtinData.shadowMask1 = 0.0;
    1226.                 builtinData.shadowMask2 = 0.0;
    1227.                 builtinData.shadowMask3 = 0.0;
    1228.         #endif
    1229.                 builtinData.distortion = float2(0.0, 0.0);
    1230.                 builtinData.distortionBlur = 0.0;          
    1231.                 builtinData.depthOffset = 0.0;          
    1232.             }
    1233.  
    1234.             PackedVaryingsMeshToPS Vert( AttributesMesh inputMesh  )
    1235.             {
    1236.                 PackedVaryingsMeshToPS outputPackedVaryingsMeshToPS;
    1237.  
    1238.                 UNITY_SETUP_INSTANCE_ID ( inputMesh );
    1239.                 UNITY_TRANSFER_INSTANCE_ID ( inputMesh, outputPackedVaryingsMeshToPS );
    1240.  
    1241.                 outputPackedVaryingsMeshToPS.ase_texcoord.xy = inputMesh.ase_texcoord.xy;
    1242.              
    1243.                 //setting value to unused interpolator channels and avoid initialization warnings
    1244.                 outputPackedVaryingsMeshToPS.ase_texcoord.zw = 0;
    1245.                 inputMesh.positionOS.xyz +=  float3( 0, 0, 0 ) ;
    1246.                 inputMesh.normalOS =  inputMesh.normalOS ;
    1247.  
    1248.                 float3 positionRWS = TransformObjectToWorld ( inputMesh.positionOS.xyz );
    1249.                 float4 positionCS = TransformWorldToHClip ( positionRWS );
    1250.  
    1251.                 outputPackedVaryingsMeshToPS.positionCS = positionCS;
    1252.                 return outputPackedVaryingsMeshToPS;
    1253.             }
    1254.  
    1255.             void Frag( PackedVaryingsMeshToPS packedInput,
    1256. #ifdef WRITE_NORMAL_BUFFER
    1257.                 OUTPUT_NORMALBUFFER ( outNormalBuffer )
    1258. #else
    1259.                 out float4 outColor : SV_Target
    1260. #endif
    1261.              )
    1262.             {
    1263.                 FragInputs input;
    1264.                 ZERO_INITIALIZE ( FragInputs, input );
    1265.                 input.worldToTangent = k_identity3x3;
    1266.                 input.positionSS = packedInput.positionCS;
    1267.                 PositionInputs posInput = GetPositionInput ( input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS );
    1268.                 float3 V = 0; // Avoid the division by 0
    1269.              
    1270.                 SurfaceData surfaceData;
    1271.                 BuiltinData builtinData;
    1272.  
    1273.                 AlphaSurfaceDescription surfaceDescription = ( AlphaSurfaceDescription ) 0;
    1274.                 float2 uv_HairbaseRGBAlphaA = packedInput.ase_texcoord.xy * _HairbaseRGBAlphaA_ST.xy + _HairbaseRGBAlphaA_ST.zw;
    1275.                 float4 tex2DNode13 = tex2Dbias( _HairbaseRGBAlphaA, float4( uv_HairbaseRGBAlphaA, 0, 0.0) );
    1276.              
    1277.                 surfaceDescription.Alpha = tex2DNode13.a;
    1278.                 surfaceDescription.AlphaClipThreshold = 0;
    1279.  
    1280.                 GetSurfaceAndBuiltinData ( surfaceDescription, input, V, posInput, surfaceData, builtinData );
    1281.  
    1282. #ifdef WRITE_NORMAL_BUFFER
    1283.                 ENCODE_INTO_NORMALBUFFER ( surfaceData, posInput.positionSS, outNormalBuffer );
    1284. #elif defined(SCENESELECTIONPASS)
    1285.                 outColor = float4( _ObjectId, _PassValue, 1.0, 1.0 );
    1286. #else
    1287.                 outColor = float4( 0.0, 0.0, 0.0, 0.0 );
    1288. #endif
    1289.             }
    1290.             ENDHLSL
    1291.         }
    1292.      
    1293.      
    1294.         Pass
    1295.         {
    1296.          
    1297.             Name "DepthOnly"
    1298.             Tags { "LightMode"="DepthOnly" }
    1299.             ColorMask 0
    1300.      
    1301.             HLSLPROGRAM
    1302.             #pragma vertex Vert
    1303.             #pragma fragment Frag
    1304.  
    1305.             #define _MATERIAL_FEATURE_SPECULAR_COLOR 1
    1306.             #define _SURFACE_TYPE_TRANSPARENT 1
    1307.             #define _BLENDMODE_ALPHA 1
    1308.  
    1309.  
    1310.             #define UNITY_MATERIAL_LIT
    1311.             #if defined(_MATID_SSS) && !defined(_SURFACE_TYPE_TRANSPARENT)
    1312.             #define OUTPUT_SPLIT_LIGHTING
    1313.             #endif
    1314.      
    1315.             #include "CoreRP/ShaderLibrary/Common.hlsl"
    1316.             #include "CoreRP/ShaderLibrary/Wind.hlsl"
    1317.             #include "CoreRP/ShaderLibrary/NormalSurfaceGradient.hlsl"
    1318.             #include "ShaderGraphLibrary/Functions.hlsl"
    1319.             #include "HDRP/ShaderPass/FragInputs.hlsl"
    1320.             #include "HDRP/ShaderPass/ShaderPass.cs.hlsl"
    1321.      
    1322.             #define SHADERPASS SHADERPASS_DEPTH_ONLY
    1323.  
    1324.             #include "ShaderGraphLibrary/Functions.hlsl"
    1325.             #include "HDRP/ShaderVariables.hlsl"
    1326.             #include "HDRP/Material/Material.hlsl"
    1327.             #include "HDRP/Material/MaterialUtilities.hlsl"
    1328.  
    1329.             CBUFFER_START(UnityPerMaterial)
    1330.             uniform sampler2D _HairbaseRGBAlphaA;
    1331.             uniform float4 _HairbaseRGBAlphaA_ST;
    1332.             CBUFFER_END
    1333.          
    1334.             struct AttributesMesh
    1335.             {
    1336.                 float4 positionOS : POSITION;
    1337.                 float3 normalOS : NORMAL;
    1338.                 float4 ase_texcoord : TEXCOORD0;
    1339.             };
    1340.  
    1341.             struct PackedVaryingsMeshToPS
    1342.             {
    1343.                 float4 positionCS : SV_Position;
    1344.                 float4 ase_texcoord : TEXCOORD0;
    1345.             };
    1346.  
    1347.             void BuildSurfaceData(FragInputs fragInputs, AlphaSurfaceDescription surfaceDescription, float3 V, out SurfaceData surfaceData)
    1348.             {
    1349.                 ZERO_INITIALIZE(SurfaceData, surfaceData);
    1350.                 surfaceData.ambientOcclusion =      1.0f;
    1351.                 surfaceData.subsurfaceMask =        1.0f;
    1352.  
    1353.                 surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD;
    1354.         #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING
    1355.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING;
    1356.         #endif
    1357.         #ifdef _MATERIAL_FEATURE_TRANSMISSION
    1358.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION;
    1359.         #endif
    1360.         #ifdef _MATERIAL_FEATURE_ANISOTROPY
    1361.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY;
    1362.         #endif
    1363.         #ifdef _MATERIAL_FEATURE_CLEAR_COAT
    1364.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT;
    1365.         #endif
    1366.         #ifdef _MATERIAL_FEATURE_IRIDESCENCE
    1367.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE;
    1368.         #endif
    1369.         #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR
    1370.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR;
    1371.         #endif
    1372.      
    1373.                 float3 normalTS = float3(0.0f, 0.0f, 1.0f);
    1374.                 GetNormalWS(fragInputs, V, normalTS, surfaceData.normalWS);
    1375.      
    1376.                 surfaceData.tangentWS = normalize(fragInputs.worldToTangent[0].xyz);
    1377.                 surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS);
    1378.                 surfaceData.anisotropy = 0;
    1379.                 surfaceData.coatMask = 0.0f;
    1380.                 surfaceData.iridescenceThickness = 0.0;
    1381.                 surfaceData.iridescenceMask = 1.0;
    1382.                 surfaceData.ior = 1.0;
    1383.                 surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0);
    1384.                 surfaceData.atDistance = 1000000.0;
    1385.                 surfaceData.transmittanceMask = 0.0;
    1386.                 surfaceData.specularOcclusion = 1.0;
    1387.         #if defined(_BENTNORMALMAP) && defined(_ENABLESPECULAROCCLUSION)
    1388.                 surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData);
    1389.         #elif defined(_MASKMAP)
    1390.                 surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(NdotV, surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness));
    1391.         #endif
    1392.             }
    1393.      
    1394.             void GetSurfaceAndBuiltinData( AlphaSurfaceDescription surfaceDescription, FragInputs fragInputs, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData)
    1395.             {          
    1396. #if _ALPHATEST_ON
    1397.                 DoAlphaTest ( surfaceDescription.Alpha, surfaceDescription.AlphaClipThreshold );
    1398. #endif
    1399.                 BuildSurfaceData(fragInputs, surfaceDescription, V, surfaceData);
    1400.                 ZERO_INITIALIZE(BuiltinData, builtinData);
    1401.                 float3 bentNormalWS = surfaceData.normalWS;
    1402.      
    1403.                 builtinData.opacity = surfaceDescription.Alpha;
    1404.                 builtinData.bakeDiffuseLighting = SampleBakedGI(fragInputs.positionRWS, bentNormalWS, fragInputs.texCoord1, fragInputs.texCoord2);
    1405.                 BSDFData bsdfData = ConvertSurfaceDataToBSDFData(posInput.positionSS.xy, surfaceData);
    1406.                 if (HasFlag(bsdfData.materialFeatures, MATERIALFEATUREFLAGS_LIT_TRANSMISSION))
    1407.                 {
    1408.                     builtinData.bakeDiffuseLighting += SampleBakedGI(fragInputs.positionRWS, -fragInputs.worldToTangent[2], fragInputs.texCoord1, fragInputs.texCoord2) * bsdfData.transmittance;
    1409.                 }
    1410.      
    1411.                 builtinData.velocity =                  float2(0.0, 0.0);
    1412.         #ifdef SHADOWS_SHADOWMASK
    1413.                 float4 shadowMask = SampleShadowMask(fragInputs.positionRWS, fragInputs.texCoord1);
    1414.                 builtinData.shadowMask0 = shadowMask.x;
    1415.                 builtinData.shadowMask1 = shadowMask.y;
    1416.                 builtinData.shadowMask2 = shadowMask.z;
    1417.                 builtinData.shadowMask3 = shadowMask.w;
    1418.         #else
    1419.                 builtinData.shadowMask0 = 0.0;
    1420.                 builtinData.shadowMask1 = 0.0;
    1421.                 builtinData.shadowMask2 = 0.0;
    1422.                 builtinData.shadowMask3 = 0.0;
    1423.         #endif
    1424.                 builtinData.distortion = float2(0.0, 0.0);
    1425.                 builtinData.distortionBlur = 0.0;
    1426.                 builtinData.depthOffset = 0.0;
    1427.             }
    1428.  
    1429.             PackedVaryingsMeshToPS Vert ( AttributesMesh inputMesh  )
    1430.             {
    1431.                 PackedVaryingsMeshToPS outputPackedVaryingsMeshToPS;
    1432.  
    1433.                 UNITY_SETUP_INSTANCE_ID ( inputMesh );
    1434.                 UNITY_TRANSFER_INSTANCE_ID ( inputMesh, outputPackedVaryingsMeshToPS );
    1435.  
    1436.                 outputPackedVaryingsMeshToPS.ase_texcoord.xy = inputMesh.ase_texcoord.xy;
    1437.              
    1438.                 //setting value to unused interpolator channels and avoid initialization warnings
    1439.                 outputPackedVaryingsMeshToPS.ase_texcoord.zw = 0;
    1440.                 inputMesh.positionOS.xyz +=  float3( 0, 0, 0 ) ;
    1441.                 inputMesh.normalOS =  inputMesh.normalOS ;
    1442.  
    1443.                 float3 positionRWS = TransformObjectToWorld ( inputMesh.positionOS.xyz );
    1444.                 float4 positionCS = TransformWorldToHClip ( positionRWS );
    1445.  
    1446.                 outputPackedVaryingsMeshToPS.positionCS = positionCS;
    1447.                 return outputPackedVaryingsMeshToPS;
    1448.             }
    1449.  
    1450.             void Frag ( PackedVaryingsMeshToPS packedInput,
    1451. #ifdef WRITE_NORMAL_BUFFER
    1452.                 OUTPUT_NORMALBUFFER ( outNormalBuffer )
    1453. #else
    1454.                 out float4 outColor : SV_Target
    1455. #endif
    1456.              )
    1457.             {
    1458.                 FragInputs input;
    1459.                 ZERO_INITIALIZE ( FragInputs, input );
    1460.                 input.worldToTangent = k_identity3x3;
    1461.                 input.positionSS = packedInput.positionCS;
    1462.                 PositionInputs posInput = GetPositionInput ( input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS );
    1463.                 float3 V = 0;
    1464.  
    1465.                 SurfaceData surfaceData;
    1466.                 BuiltinData builtinData;
    1467.  
    1468.                 AlphaSurfaceDescription surfaceDescription = ( AlphaSurfaceDescription ) 0;
    1469.                 float2 uv_HairbaseRGBAlphaA = packedInput.ase_texcoord.xy * _HairbaseRGBAlphaA_ST.xy + _HairbaseRGBAlphaA_ST.zw;
    1470.                 float4 tex2DNode13 = tex2Dbias( _HairbaseRGBAlphaA, float4( uv_HairbaseRGBAlphaA, 0, 0.0) );
    1471.              
    1472.                 surfaceDescription.Alpha = tex2DNode13.a;
    1473.                 surfaceDescription.AlphaClipThreshold = 0;
    1474.  
    1475.                 GetSurfaceAndBuiltinData ( surfaceDescription, input, V, posInput, surfaceData, builtinData );
    1476.  
    1477. #ifdef WRITE_NORMAL_BUFFER
    1478.                 ENCODE_INTO_NORMALBUFFER ( surfaceData, posInput.positionSS, outNormalBuffer );
    1479. #elif defined(SCENESELECTIONPASS)
    1480.                 outColor = float4( _ObjectId, _PassValue, 1.0, 1.0 );
    1481. #else
    1482.                 outColor = float4( 0.0, 0.0, 0.0, 0.0 );
    1483. #endif
    1484.             }
    1485.    
    1486.             ENDHLSL
    1487.         }
    1488.  
    1489.      
    1490.         Pass
    1491.         {
    1492.          
    1493.             Name "Motion Vectors"
    1494.             Tags { "LightMode"="MotionVectors" }
    1495.  
    1496.             Stencil
    1497.             {
    1498.                 Ref 128
    1499.                 WriteMask 128
    1500.                 Comp Always
    1501.                 Pass Replace
    1502.                 Fail Keep
    1503.                 ZFail Keep
    1504.             }
    1505.  
    1506.  
    1507.             HLSLPROGRAM
    1508.  
    1509.             #pragma target 4.5
    1510.             #pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
    1511.  
    1512.             #pragma vertex Vert
    1513.             #pragma fragment Frag
    1514.  
    1515.             #define _MATERIAL_FEATURE_SPECULAR_COLOR 1
    1516.             #define _SURFACE_TYPE_TRANSPARENT 1
    1517.             #define _BLENDMODE_ALPHA 1
    1518.  
    1519.  
    1520.             #define UNITY_MATERIAL_LIT
    1521.  
    1522.             #if defined(_MATID_SSS) && !defined(_SURFACE_TYPE_TRANSPARENT)
    1523.             #define OUTPUT_SPLIT_LIGHTING
    1524.             #endif
    1525.  
    1526.             #include "CoreRP/ShaderLibrary/Common.hlsl"
    1527.             #include "CoreRP/ShaderLibrary/Wind.hlsl"
    1528.  
    1529.             #include "CoreRP/ShaderLibrary/NormalSurfaceGradient.hlsl"
    1530.  
    1531.             #include "ShaderGraphLibrary/Functions.hlsl"
    1532.  
    1533.  
    1534.             #include "HDRP/ShaderPass/FragInputs.hlsl"
    1535.             #include "HDRP/ShaderPass/ShaderPass.cs.hlsl"
    1536.  
    1537.             #define SHADERPASS SHADERPASS_VELOCITY
    1538.  
    1539.             #define VARYINGS_NEED_POSITION_WS
    1540.  
    1541.             #include "ShaderGraphLibrary/Functions.hlsl"
    1542.             #include "HDRP/ShaderVariables.hlsl"
    1543.  
    1544.             #include "HDRP/Material/Material.hlsl"
    1545.  
    1546.             #include "HDRP/Material/MaterialUtilities.hlsl"
    1547.  
    1548.             CBUFFER_START(UnityPerMaterial)
    1549.             uniform sampler2D _HairbaseRGBAlphaA;
    1550.             uniform float4 _HairbaseRGBAlphaA_ST;
    1551.             CBUFFER_END
    1552.          
    1553.             struct AttributesMesh
    1554.             {
    1555.                 float3 positionOS : POSITION;
    1556.                 float3 normalOS : NORMAL;
    1557.                 float4 ase_texcoord : TEXCOORD0;
    1558.             };
    1559.  
    1560.             struct VaryingsMeshToPS
    1561.             {
    1562.                 float4 positionCS : SV_Position;
    1563.                 float3 positionRWS; // optional
    1564.             };
    1565.  
    1566.             struct PackedVaryingsMeshToPS
    1567.             {
    1568.                 float3 interp00 : TEXCOORD0; // auto-packed
    1569.                 float4 positionCS : SV_Position; // unpacked
    1570.             };
    1571.  
    1572.             struct SurfaceDescriptionInputs
    1573.             {
    1574.                 float3 TangentSpaceNormal; // optional
    1575.             };
    1576.  
    1577.             struct SurfaceDescription
    1578.             {
    1579.                 float Alpha;
    1580.                 float AlphaClipThreshold;
    1581.             };
    1582.  
    1583.             void BuildSurfaceData ( FragInputs fragInputs, SurfaceDescription surfaceDescription, float3 V, out SurfaceData surfaceData )
    1584.             {
    1585.                 ZERO_INITIALIZE ( SurfaceData, surfaceData );
    1586.                 surfaceData.ambientOcclusion = 1.0f;
    1587.                 surfaceData.subsurfaceMask = 1.0f;
    1588.  
    1589.                 surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD;
    1590.     #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING
    1591.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING;
    1592.     #endif
    1593.     #ifdef _MATERIAL_FEATURE_TRANSMISSION
    1594.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION;
    1595.     #endif
    1596.     #ifdef _MATERIAL_FEATURE_ANISOTROPY
    1597.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY;
    1598.     #endif
    1599.     #ifdef _MATERIAL_FEATURE_CLEAR_COAT
    1600.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT;
    1601.     #endif
    1602.     #ifdef _MATERIAL_FEATURE_IRIDESCENCE
    1603.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE;
    1604.     #endif
    1605.     #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR
    1606.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR;
    1607.     #endif
    1608.  
    1609.                 float3 normalTS = float3( 0.0f, 0.0f, 1.0f );
    1610.  
    1611.                 GetNormalWS ( fragInputs, V, normalTS, surfaceData.normalWS );
    1612.  
    1613.                 surfaceData.tangentWS = normalize ( fragInputs.worldToTangent[ 0 ].xyz );
    1614.                 surfaceData.tangentWS = Orthonormalize ( surfaceData.tangentWS, surfaceData.normalWS );
    1615.  
    1616.                 surfaceData.anisotropy = 0;
    1617.                 surfaceData.coatMask = 0.0f;
    1618.                 surfaceData.iridescenceThickness = 0.0;
    1619.                 surfaceData.iridescenceMask = 1.0;
    1620.                 surfaceData.ior = 1.0;
    1621.                 surfaceData.transmittanceColor = float3( 1.0, 1.0, 1.0 );
    1622.                 surfaceData.atDistance = 1000000.0;
    1623.                 surfaceData.transmittanceMask = 0.0;
    1624.                 surfaceData.specularOcclusion = 1.0;
    1625.     #if defined(_BENTNORMALMAP) && defined(_ENABLESPECULAROCCLUSION)
    1626.                 surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO ( V, bentNormalWS, surfaceData );
    1627.     #elif defined(_MASKMAP)
    1628.                 surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion ( NdotV, surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness ( surfaceData.perceptualSmoothness ) );
    1629.     #endif
    1630.             }
    1631.  
    1632.             void GetSurfaceAndBuiltinData ( SurfaceDescription surfaceDescription, FragInputs fragInputs, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData )
    1633.             {
    1634.  
    1635.                 BuildSurfaceData ( fragInputs, surfaceDescription, V, surfaceData );
    1636.                 ZERO_INITIALIZE ( BuiltinData, builtinData );
    1637.                 float3 bentNormalWS = surfaceData.normalWS;
    1638.  
    1639.                 builtinData.opacity = surfaceDescription.Alpha;
    1640.                 builtinData.bakeDiffuseLighting = SampleBakedGI ( fragInputs.positionRWS, bentNormalWS, fragInputs.texCoord1, fragInputs.texCoord2 );
    1641.  
    1642.                 BSDFData bsdfData = ConvertSurfaceDataToBSDFData ( posInput.positionSS.xy, surfaceData );
    1643.                 if ( HasFlag ( bsdfData.materialFeatures, MATERIALFEATUREFLAGS_LIT_TRANSMISSION ) )
    1644.                 {
    1645.                     builtinData.bakeDiffuseLighting += SampleBakedGI ( fragInputs.positionRWS, -fragInputs.worldToTangent[ 2 ], fragInputs.texCoord1, fragInputs.texCoord2 ) * bsdfData.transmittance;
    1646.                 }
    1647.  
    1648.                 builtinData.velocity = float2( 0.0, 0.0 );
    1649.     #ifdef SHADOWS_SHADOWMASK
    1650.                 float4 shadowMask = SampleShadowMask ( fragInputs.positionRWS, fragInputs.texCoord1 );
    1651.                 builtinData.shadowMask0 = shadowMask.x;
    1652.                 builtinData.shadowMask1 = shadowMask.y;
    1653.                 builtinData.shadowMask2 = shadowMask.z;
    1654.                 builtinData.shadowMask3 = shadowMask.w;
    1655.     #else
    1656.                 builtinData.shadowMask0 = 0.0;
    1657.                 builtinData.shadowMask1 = 0.0;
    1658.                 builtinData.shadowMask2 = 0.0;
    1659.                 builtinData.shadowMask3 = 0.0;
    1660.     #endif
    1661.                 builtinData.distortion = float2( 0.0, 0.0 );
    1662.                 builtinData.distortionBlur = 0.0;
    1663.                 builtinData.depthOffset = 0.0;
    1664.             }
    1665.  
    1666.             struct AttributesPass
    1667.             {
    1668.                 float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example)
    1669.             };
    1670.  
    1671.             struct VaryingsPassToPS
    1672.             {
    1673.                 float4 positionCS;
    1674.                 float4 previousPositionCS;
    1675.             };
    1676.  
    1677.             struct VaryingsToPS
    1678.             {
    1679.                 VaryingsMeshToPS vmesh;
    1680.                 VaryingsPassToPS vpass;
    1681.             };
    1682.  
    1683.             struct PackedVaryingsToPS
    1684.             {
    1685.                 float4 vmeshPositionCS : SV_Position; // unpacked
    1686.                 float3 vmeshInterp00 : TEXCOORD0; // auto-packed
    1687.                 float3 vpassInterpolators0 : TEXCOORD1;
    1688.                 float3 vpassInterpolators1 : TEXCOORD2;
    1689.                 float4 ase_texcoord3 : TEXCOORD3;
    1690.             };
    1691.  
    1692.             // Transforms local position to camera relative world space
    1693.             float3 TransformPreviousObjectToWorld ( float3 positionOS )
    1694.             {
    1695.                 float4x4 previousModelMatrix = ApplyCameraTranslationToMatrix ( unity_MatrixPreviousM );
    1696.                 return mul ( previousModelMatrix, float4( positionOS, 1.0 ) ).xyz;
    1697.             }
    1698.  
    1699.             void VelocityPositionZBias ( VaryingsToPS input )
    1700.             {
    1701.     #if defined(UNITY_REVERSED_Z)
    1702.                 input.vmesh.positionCS.z -= unity_MotionVectorsParams.z * input.vmesh.positionCS.w;
    1703.     #else
    1704.                 input.vmesh.positionCS.z += unity_MotionVectorsParams.z * input.vmesh.positionCS.w;
    1705.     #endif
    1706.             }
    1707.  
    1708.             PackedVaryingsToPS Vert ( AttributesMesh inputMesh, AttributesPass inputPass  )
    1709.             {
    1710.                 VaryingsToPS varyingsType;
    1711.  
    1712.                 UNITY_SETUP_INSTANCE_ID ( inputMesh );
    1713.                 UNITY_TRANSFER_INSTANCE_ID ( inputMesh, varyingsType.vmesh );
    1714.  
    1715.                 PackedVaryingsToPS outputPackedVaryingsToPS;
    1716.                 outputPackedVaryingsToPS.ase_texcoord3.xy = inputMesh.ase_texcoord.xy;
    1717.              
    1718.                 //setting value to unused interpolator channels and avoid initialization warnings
    1719.                 outputPackedVaryingsToPS.ase_texcoord3.zw = 0;
    1720.                 inputMesh.positionOS.xyz +=  float3( 0, 0, 0 ) ;
    1721.                 inputMesh.normalOS =  inputMesh.normalOS ;
    1722.                 float3 positionRWS = TransformObjectToWorld ( inputMesh.positionOS );
    1723.  
    1724.                 varyingsType.vmesh.positionRWS = positionRWS;
    1725.                 varyingsType.vmesh.positionCS = TransformWorldToHClip ( positionRWS );
    1726.  
    1727.                 VelocityPositionZBias ( varyingsType );
    1728.  
    1729.                 varyingsType.vpass.positionCS = mul ( _NonJitteredViewProjMatrix, float4( varyingsType.vmesh.positionRWS, 1.0 ) );
    1730.  
    1731.                 bool forceNoMotion = unity_MotionVectorsParams.y == 0.0;
    1732.                 if ( forceNoMotion )
    1733.                 {
    1734.                     varyingsType.vpass.previousPositionCS = float4( 0.0, 0.0, 0.0, 1.0 );
    1735.                 }
    1736.                 else
    1737.                 {
    1738.                     bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target
    1739.                     float3 previousPositionRWS = TransformPreviousObjectToWorld ( hasDeformation ? inputPass.previousPositionOS : inputMesh.positionOS );
    1740.                     varyingsType.vpass.previousPositionCS = mul ( _PrevViewProjMatrix, float4( previousPositionRWS, 1.0 ) );
    1741.                 }
    1742.  
    1743.  
    1744.                 outputPackedVaryingsToPS.vmeshPositionCS = varyingsType.vmesh.positionCS;
    1745.                 outputPackedVaryingsToPS.vmeshInterp00.xyz = varyingsType.vmesh.positionRWS;
    1746.  
    1747.                 outputPackedVaryingsToPS.vpassInterpolators0 = float3( varyingsType.vpass.positionCS.xyw );
    1748.                 outputPackedVaryingsToPS.vpassInterpolators1 = float3( varyingsType.vpass.previousPositionCS.xyw );
    1749.  
    1750.                 return outputPackedVaryingsToPS;
    1751.             }
    1752.  
    1753.             void Frag ( PackedVaryingsToPS packedInput, out float4 outVelocity : SV_Target0  )
    1754.             {
    1755.  
    1756.                 VaryingsMeshToPS unpacked;
    1757.                 unpacked.positionCS = packedInput.vmeshPositionCS;
    1758.                 unpacked.positionRWS = packedInput.vmeshInterp00.xyz;
    1759.  
    1760.                 FragInputs input;
    1761.                 ZERO_INITIALIZE ( FragInputs, input );
    1762.  
    1763.                 input.worldToTangent = k_identity3x3;
    1764.                 input.positionSS = unpacked.positionCS;
    1765.                 input.positionRWS = unpacked.positionRWS;
    1766.  
    1767.                 PositionInputs posInput = GetPositionInput ( input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS );
    1768.  
    1769.                 float3 V = GetWorldSpaceNormalizeViewDir ( input.positionRWS );
    1770.  
    1771.                 SurfaceDescription surfaceDescription = ( SurfaceDescription ) 0;
    1772.                 float2 uv_HairbaseRGBAlphaA = packedInput.ase_texcoord3.xy * _HairbaseRGBAlphaA_ST.xy + _HairbaseRGBAlphaA_ST.zw;
    1773.                 float4 tex2DNode13 = tex2Dbias( _HairbaseRGBAlphaA, float4( uv_HairbaseRGBAlphaA, 0, 0.0) );
    1774.              
    1775.                 surfaceDescription.Alpha = tex2DNode13.a;
    1776.                 surfaceDescription.AlphaClipThreshold = 0;
    1777.  
    1778.                 SurfaceData surfaceData;
    1779.                 BuiltinData builtinData;
    1780.                 GetSurfaceAndBuiltinData ( surfaceDescription,input, V, posInput, surfaceData, builtinData );
    1781.  
    1782.                 VaryingsPassToPS inputPass;
    1783.                 inputPass.positionCS = float4( packedInput.vpassInterpolators0.xy, 0.0, packedInput.vpassInterpolators0.z );
    1784.                 inputPass.previousPositionCS = float4( packedInput.vpassInterpolators1.xy, 0.0, packedInput.vpassInterpolators1.z );
    1785.  
    1786.                 float2 velocity = CalculateVelocity ( inputPass.positionCS, inputPass.previousPositionCS );
    1787.                 EncodeVelocity ( velocity * 0.5, outVelocity );
    1788.                 bool forceNoMotion = unity_MotionVectorsParams.y == 0.0;
    1789.                 if ( forceNoMotion )
    1790.                     outVelocity = float4( 0.0, 0.0, 0.0, 0.0 );
    1791.  
    1792.             }
    1793.             ENDHLSL
    1794.         }
    1795.  
    1796.      
    1797.         Pass
    1798.         {
    1799.          
    1800.             Name "Forward"
    1801.             Tags { "LightMode"="Forward" }
    1802.          
    1803.  
    1804.      
    1805.             HLSLPROGRAM
    1806.  
    1807.             #pragma vertex Vert
    1808.             #pragma fragment Frag
    1809.  
    1810.             #define _MATERIAL_FEATURE_SPECULAR_COLOR 1
    1811.             #define _NORMALMAP 1
    1812.             #define _SURFACE_TYPE_TRANSPARENT 1
    1813.             #define _BLENDMODE_ALPHA 1
    1814.  
    1815.  
    1816.             #define UNITY_MATERIAL_LIT
    1817.  
    1818.             #if defined(_MATID_SSS) && !defined(_SURFACE_TYPE_TRANSPARENT)
    1819.             #define OUTPUT_SPLIT_LIGHTING
    1820.             #endif
    1821.      
    1822.             #include "CoreRP/ShaderLibrary/Common.hlsl"
    1823.             #include "CoreRP/ShaderLibrary/Wind.hlsl"
    1824.      
    1825.             #include "CoreRP/ShaderLibrary/NormalSurfaceGradient.hlsl"
    1826.      
    1827.             #include "ShaderGraphLibrary/Functions.hlsl"
    1828.      
    1829.             #include "HDRP/ShaderPass/FragInputs.hlsl"
    1830.             #include "HDRP/ShaderPass/ShaderPass.cs.hlsl"
    1831.                
    1832.             #define SHADERPASS SHADERPASS_FORWARD
    1833.             #pragma multi_compile _ DEBUG_DISPLAY
    1834.             #pragma multi_compile _ LIGHTMAP_ON
    1835.             #pragma multi_compile _ DIRLIGHTMAP_COMBINED
    1836.             #pragma multi_compile _ DYNAMICLIGHTMAP_ON
    1837.             #pragma multi_compile _ SHADOWS_SHADOWMASK
    1838.             #pragma multi_compile LIGHTLOOP_SINGLE_PASS LIGHTLOOP_TILE_PASS
    1839.             #pragma multi_compile USE_FPTL_LIGHTLIST USE_CLUSTERED_LIGHTLIST
    1840.             #define ATTRIBUTES_NEED_NORMAL
    1841.             #define ATTRIBUTES_NEED_TANGENT
    1842.             #define VARYINGS_NEED_TANGENT_TO_WORLD
    1843.              
    1844.      
    1845.             #include "ShaderGraphLibrary/Functions.hlsl"
    1846.             #include "HDRP/ShaderVariables.hlsl"
    1847.          
    1848.             #include "HDRP/Lighting/Lighting.hlsl"
    1849.  
    1850.             #include "HDRP/Material/MaterialUtilities.hlsl"
    1851.      
    1852.             CBUFFER_START(UnityPerMaterial)
    1853.             uniform float _DiffuseOnly;
    1854.             uniform float4 _Tint;
    1855.             uniform sampler2D _StrandID;
    1856.             uniform float4 _StrandID_ST;
    1857.             uniform float4 _TertiaryHairs;
    1858.             uniform float4 _SecondaryHairs;
    1859.             uniform float4 _MainHairColour;
    1860.             uniform float4 _FlatDiffuse;
    1861.             uniform sampler2D _HairbaseRGBAlphaA;
    1862.             uniform float4 _HairbaseRGBAlphaA_ST;
    1863.             uniform float _FiberStrength;
    1864.             uniform sampler2D _NormalMap;
    1865.             uniform float4 _NormalMap_ST;
    1866.             uniform float4 _HighlightColour;
    1867.             uniform float _BaseSpecular;
    1868.             uniform float _BaseRoughness;
    1869.             CBUFFER_END
    1870.          
    1871.             float3x3 BuildWorldToTangent(float4 tangentWS, float3 normalWS)
    1872.             {
    1873.                 float3 unnormalizedNormalWS = normalWS;
    1874.                 float renormFactor = 1.0 / length(unnormalizedNormalWS);
    1875.                 float3x3 worldToTangent = CreateWorldToTangent(unnormalizedNormalWS, tangentWS.xyz, tangentWS.w > 0.0 ? 1.0 : -1.0);
    1876.                 worldToTangent[0] = worldToTangent[0] * renormFactor;
    1877.                 worldToTangent[1] = worldToTangent[1] * renormFactor;
    1878.                 worldToTangent[2] = worldToTangent[2] * renormFactor;
    1879.                 return worldToTangent;
    1880.             }
    1881.      
    1882.             struct AttributesMesh
    1883.             {
    1884.                 float4 positionOS : POSITION;
    1885.                 float3 normalOS : NORMAL;
    1886.                 float4 tangentOS : TANGENT;
    1887.                 float4 ase_texcoord : TEXCOORD0;
    1888.             };
    1889.          
    1890.             struct PackedVaryingsMeshToPS
    1891.             {
    1892.                 float4 positionCS : SV_Position;
    1893.                 float3 interp00 : TEXCOORD0;
    1894.                 float4 interp01 : TEXCOORD1;
    1895.                 float4 ase_texcoord2 : TEXCOORD2;
    1896.             };
    1897.      
    1898.             void BuildSurfaceData ( FragInputs fragInputs, GlobalSurfaceDescription surfaceDescription, float3 V, out SurfaceData surfaceData )
    1899.             {
    1900.                 ZERO_INITIALIZE ( SurfaceData, surfaceData );
    1901.  
    1902.                 float3 normalTS = float3( 0.0f, 0.0f, 1.0f );
    1903.                 normalTS = surfaceDescription.Normal;
    1904.                 GetNormalWS ( fragInputs, V, normalTS, surfaceData.normalWS );
    1905.  
    1906.                 surfaceData.ambientOcclusion = 1.0f;
    1907.  
    1908.                 surfaceData.baseColor = surfaceDescription.Albedo;
    1909.                 surfaceData.perceptualSmoothness = surfaceDescription.Smoothness;
    1910.                 surfaceData.ambientOcclusion = surfaceDescription.Occlusion;
    1911.  
    1912.                 surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD;
    1913.  
    1914. #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR
    1915.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR;
    1916.                 surfaceData.specularColor = surfaceDescription.Specular;
    1917. #else
    1918.                 surfaceData.metallic = surfaceDescription.Metallic;
    1919. #endif
    1920.  
    1921. #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) || defined(_MATERIAL_FEATURE_TRANSMISSION)
    1922.                 surfaceData.diffusionProfile = surfaceDescription.DiffusionProfile;
    1923. #endif
    1924.  
    1925. #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING
    1926.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING;
    1927.                 surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask;
    1928. #else
    1929.                 surfaceData.subsurfaceMask = 1.0f;
    1930. #endif
    1931.  
    1932. #ifdef _MATERIAL_FEATURE_TRANSMISSION
    1933.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION;
    1934.                 surfaceData.thickness = surfaceDescription.Thickness;
    1935. #endif
    1936.  
    1937.                 surfaceData.tangentWS = normalize ( fragInputs.worldToTangent[ 0 ].xyz );
    1938.                 surfaceData.tangentWS = Orthonormalize ( surfaceData.tangentWS, surfaceData.normalWS );
    1939.  
    1940. #ifdef _MATERIAL_FEATURE_ANISOTROPY
    1941.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY;
    1942.                 surfaceData.anisotropy = surfaceDescription.Anisotropy;
    1943.  
    1944. #else
    1945.                 surfaceData.anisotropy = 0;
    1946. #endif
    1947.  
    1948. #ifdef _MATERIAL_FEATURE_CLEAR_COAT
    1949.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT;
    1950.                 surfaceData.coatMask = surfaceDescription.CoatMask;
    1951. #else
    1952.                 surfaceData.coatMask = 0.0f;
    1953. #endif
    1954.  
    1955. #ifdef _MATERIAL_FEATURE_IRIDESCENCE
    1956.                 surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE;
    1957.                 surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness;
    1958.                 surfaceData.iridescenceMask = surfaceDescription.IridescenceMask;
    1959. #else
    1960.                 surfaceData.iridescenceThickness = 0.0;
    1961.                 surfaceData.iridescenceMask = 1.0;
    1962. #endif
    1963.  
    1964.                 //ASE CUSTOM TAG
    1965. #ifdef _MATERIAL_FEATURE_TRANSPARENCY
    1966.                 surfaceData.ior = surfaceDescription.IndexOfRefraction;
    1967.                 surfaceData.transmittanceColor = surfaceDescription.TransmittanceColor;
    1968.                 surfaceData.atDistance = surfaceDescription.TransmittanceAbsorptionDistance;
    1969.                 surfaceData.transmittanceMask = surfaceDescription.TransmittanceMask;
    1970. #else
    1971.                 surfaceData.ior = 1.0;
    1972.                 surfaceData.transmittanceColor = float3( 1.0, 1.0, 1.0 );
    1973.                 surfaceData.atDistance = 1000000.0;
    1974.                 surfaceData.transmittanceMask = 0.0;
    1975. #endif
    1976.  
    1977.                 surfaceData.specularOcclusion = 1.0;
    1978.  
    1979. #if defined(_BENTNORMALMAP) && defined(_ENABLESPECULAROCCLUSION)
    1980.                 surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO ( V, bentNormalWS, surfaceData );
    1981. #elif defined(_MASKMAP)
    1982.                 surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion ( NdotV, surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness ( surfaceData.perceptualSmoothness ) );
    1983. #endif
    1984.             }
    1985.  
    1986.             void GetSurfaceAndBuiltinData( GlobalSurfaceDescription surfaceDescription, FragInputs fragInputs, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData)
    1987.             {
    1988.              
    1989. #if _ALPHATEST_ON
    1990.                 DoAlphaTest ( surfaceDescription.Alpha, surfaceDescription.AlphaClipThreshold );
    1991. #endif
    1992.                 BuildSurfaceData(fragInputs, surfaceDescription, V, surfaceData);
    1993.                 ZERO_INITIALIZE(BuiltinData, builtinData);
    1994.                 float3 bentNormalWS = surfaceData.normalWS;
    1995.      
    1996.                 builtinData.opacity =                   surfaceDescription.Alpha;
    1997.                 builtinData.bakeDiffuseLighting =       SampleBakedGI(fragInputs.positionRWS, bentNormalWS, fragInputs.texCoord1, fragInputs.texCoord2);    // see GetBuiltinData()
    1998.      
    1999.                 BSDFData bsdfData = ConvertSurfaceDataToBSDFData(posInput.positionSS.xy, surfaceData);
    2000.                 if (HasFlag(bsdfData.materialFeatures, MATERIALFEATUREFLAGS_LIT_TRANSMISSION))
    2001.                 {
    2002.                     builtinData.bakeDiffuseLighting += SampleBakedGI(fragInputs.positionRWS, -fragInputs.worldToTangent[2], fragInputs.texCoord1, fragInputs.texCoord2) * bsdfData.transmittance;
    2003.                 }
    2004.      
    2005.                 builtinData.emissiveColor = surfaceDescription.Emission;
    2006.                 builtinData.velocity = float2(0.0, 0.0);
    2007.         #ifdef SHADOWS_SHADOWMASK
    2008.                 float4 shadowMask = SampleShadowMask(fragInputs.positionRWS, fragInputs.texCoord1);
    2009.                 builtinData.shadowMask0 = shadowMask.x;
    2010.                 builtinData.shadowMask1 = shadowMask.y;
    2011.                 builtinData.shadowMask2 = shadowMask.z;
    2012.                 builtinData.shadowMask3 = shadowMask.w;
    2013.         #else
    2014.                 builtinData.shadowMask0 = 0.0;
    2015.                 builtinData.shadowMask1 = 0.0;
    2016.                 builtinData.shadowMask2 = 0.0;
    2017.                 builtinData.shadowMask3 = 0.0;
    2018.         #endif
    2019.                 builtinData.distortion = float2(0.0, 0.0);
    2020.                 builtinData.distortionBlur = 0.0;
    2021.                 builtinData.depthOffset = 0.0;
    2022.             }
    2023.  
    2024.             PackedVaryingsMeshToPS Vert ( AttributesMesh inputMesh  )
    2025.             {
    2026.                 PackedVaryingsMeshToPS outputPackedVaryingsMeshToPS;
    2027.  
    2028.                 UNITY_SETUP_INSTANCE_ID ( inputMesh );
    2029.                 UNITY_TRANSFER_INSTANCE_ID ( inputMesh, outputPackedVaryingsMeshToPS );
    2030.  
    2031.                 outputPackedVaryingsMeshToPS.ase_texcoord2.xy = inputMesh.ase_texcoord.xy;
    2032.              
    2033.                 //setting value to unused interpolator channels and avoid initialization warnings
    2034.                 outputPackedVaryingsMeshToPS.ase_texcoord2.zw = 0;
    2035.                 inputMesh.positionOS.xyz +=  float3( 0, 0, 0 ) ;
    2036.                 inputMesh.normalOS =  inputMesh.normalOS ;
    2037.  
    2038.                 float3 positionRWS = TransformObjectToWorld ( inputMesh.positionOS.xyz );
    2039.                 float3 normalWS = TransformObjectToWorldNormal ( inputMesh.normalOS );
    2040.                 float4 tangentWS = float4( TransformObjectToWorldDir ( inputMesh.tangentOS.xyz ), inputMesh.tangentOS.w );
    2041.                 float4 positionCS = TransformWorldToHClip ( positionRWS );
    2042.  
    2043.                 outputPackedVaryingsMeshToPS.positionCS = positionCS;
    2044.                 outputPackedVaryingsMeshToPS.interp00.xyz = normalWS;
    2045.                 outputPackedVaryingsMeshToPS.interp01.xyzw = tangentWS;
    2046.              
    2047.                 return outputPackedVaryingsMeshToPS;
    2048.             }
    2049.  
    2050.             void Frag ( PackedVaryingsMeshToPS packedInput,
    2051. #ifdef OUTPUT_SPLIT_LIGHTING
    2052.                 out float4 outColor : SV_Target0,
    2053.                 out float4 outDiffuseLighting : SV_Target1,
    2054.                 OUTPUT_SSSBUFFER ( outSSSBuffer )
    2055. #else
    2056.                 out float4 outColor : SV_Target0
    2057. #endif
    2058.                 , half ase_vface : VFACE
    2059.             )
    2060.             {
    2061.                 FragInputs input;
    2062.                 ZERO_INITIALIZE ( FragInputs, input );
    2063.                 input.worldToTangent = k_identity3x3;
    2064.                 float3 normalWS = packedInput.interp00.xyz;
    2065.                 float4 tangentWS = packedInput.interp01.xyzw;
    2066.                 input.positionSS = packedInput.positionCS;
    2067.                 input.worldToTangent = BuildWorldToTangent ( tangentWS, normalWS );
    2068.              
    2069.  
    2070.                 // input.positionSS is SV_Position
    2071.                 PositionInputs posInput = GetPositionInput ( input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz, uint2( input.positionSS.xy ) / GetTileSize () );
    2072.  
    2073.                 float3 V = 0;
    2074.  
    2075.                 SurfaceData surfaceData;
    2076.                 BuiltinData builtinData;
    2077.                 GlobalSurfaceDescription surfaceDescription = ( GlobalSurfaceDescription ) 0;
    2078.              
    2079.                 float2 uv_StrandID = packedInput.ase_texcoord2.xy * _StrandID_ST.xy + _StrandID_ST.zw;
    2080.                 float4 tex2DNode35 = tex2D( _StrandID, uv_StrandID );
    2081.                 float3 appendResult38 = (float3(tex2DNode35.r , tex2DNode35.g , tex2DNode35.b));
    2082.                 float3 layeredBlendVar41 = appendResult38;
    2083.                 float4 layeredBlend41 = ( lerp( lerp( lerp( float4( float3(0,0,0) , 0.0 ) , _TertiaryHairs , layeredBlendVar41.x ) , _SecondaryHairs , layeredBlendVar41.y ) , _MainHairColour , layeredBlendVar41.z ) );
    2084.                 float2 uv_HairbaseRGBAlphaA = packedInput.ase_texcoord2.xy * _HairbaseRGBAlphaA_ST.xy + _HairbaseRGBAlphaA_ST.zw;
    2085.                 float4 tex2DNode13 = tex2Dbias( _HairbaseRGBAlphaA, float4( uv_HairbaseRGBAlphaA, 0, 0.0) );
    2086.              
    2087.                 float2 uv_NormalMap = packedInput.ase_texcoord2.xy * _NormalMap_ST.xy + _NormalMap_ST.zw;
    2088.                 float3 tex2DNode17 = UnpackNormalmapRGorAG( tex2D( _NormalMap, uv_NormalMap ), _FiberStrength );
    2089.                 float4 appendResult18 = (float4(tex2DNode17.r , tex2DNode17.g , ( tex2DNode17.b * ase_vface ) , 0.0));
    2090.              
    2091.                 surfaceDescription.Albedo = lerp(( _Tint * layeredBlend41 ),( _FlatDiffuse * tex2DNode13.a ),_DiffuseOnly).rgb;
    2092.                 surfaceDescription.Normal = appendResult18.xyz;
    2093.                 surfaceDescription.Emission = 0;
    2094.                 surfaceDescription.Specular = ( _HighlightColour * _BaseSpecular ).rgb;
    2095.                 surfaceDescription.Metallic = 0;
    2096.                 surfaceDescription.Smoothness = ( tex2DNode13.a * ( 1.0 - _BaseRoughness ) );
    2097.                 surfaceDescription.Occlusion = 1;
    2098.                 surfaceDescription.Alpha = tex2DNode13.a;
    2099.                 surfaceDescription.AlphaClipThreshold = 0;
    2100.              
    2101. #ifdef _MATERIAL_FEATURE_CLEAR_COAT
    2102.                 surfaceDescription.CoatMask = 0;
    2103. #endif
    2104.  
    2105. #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) || defined(_MATERIAL_FEATURE_TRANSMISSION)
    2106.                 surfaceDescription.DiffusionProfile = 0;
    2107. #endif
    2108.  
    2109. #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING
    2110.                 surfaceDescription.SubsurfaceMask = 1;
    2111. #endif
    2112.  
    2113. #ifdef _MATERIAL_FEATURE_TRANSMISSION
    2114.                 surfaceDescription.Thickness = 0;
    2115. #endif
    2116.  
    2117. #ifdef _MATERIAL_FEATURE_ANISOTROPY
    2118.                 surfaceDescription.Anisotropy = 0;
    2119. #endif
    2120.  
    2121. #ifdef _MATERIAL_FEATURE_IRIDESCENCE
    2122.                 surfaceDescription.IridescenceThickness = 0;
    2123.                 surfaceDescription.IridescenceMask = 1;
    2124. #endif
    2125.  
    2126. #ifdef _MATERIAL_FEATURE_TRANSPARENCY
    2127.                 surfaceDescription.IndexOfRefraction = 1;
    2128.                 surfaceDescription.TransmittanceColor = float3( 1, 1, 1 );
    2129.                 surfaceDescription.TransmittanceAbsorptionDistance = 1000000;
    2130.                 surfaceDescription.TransmittanceMask = 0;
    2131. #endif
    2132.  
    2133.                 GetSurfaceAndBuiltinData ( surfaceDescription, input, V, posInput, surfaceData, builtinData );
    2134.  
    2135.                 BSDFData bsdfData = ConvertSurfaceDataToBSDFData ( input.positionSS.xy, surfaceData );
    2136.  
    2137.                 PreLightData preLightData = GetPreLightData ( V, posInput, bsdfData );
    2138.  
    2139.                 outColor = float4( 0.0, 0.0, 0.0, 0.0 );
    2140.  
    2141. #ifdef _SURFACE_TYPE_TRANSPARENT
    2142.                 uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_TRANSPARENT;
    2143. #else
    2144.                 uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_OPAQUE;
    2145. #endif
    2146.                 float3 diffuseLighting;
    2147.                 float3 specularLighting;
    2148.                 BakeLightingData bakeLightingData;
    2149.                 bakeLightingData.bakeDiffuseLighting = GetBakedDiffuseLighting ( surfaceData, builtinData, bsdfData, preLightData );
    2150. #ifdef SHADOWS_SHADOWMASK
    2151.                 bakeLightingData.bakeShadowMask = float4( builtinData.shadowMask0, builtinData.shadowMask1, builtinData.shadowMask2, builtinData.shadowMask3 );
    2152. #endif
    2153.                 LightLoop ( V, posInput, preLightData, bsdfData, bakeLightingData, featureFlags, diffuseLighting, specularLighting );
    2154.  
    2155. #ifdef OUTPUT_SPLIT_LIGHTING
    2156.                 if ( _EnableSubsurfaceScattering != 0 && ShouldOutputSplitLighting ( bsdfData ) )
    2157.                 {
    2158.                     outColor = float4( specularLighting, 1.0 );
    2159.                     outDiffuseLighting = float4( TagLightingForSSS ( diffuseLighting ), 1.0 );
    2160.                 }
    2161.                 else
    2162.                 {
    2163.                     outColor = float4( diffuseLighting + specularLighting, 1.0 );
    2164.                     outDiffuseLighting = 0;
    2165.                 }
    2166.                 ENCODE_INTO_SSSBUFFER ( surfaceData, posInput.positionSS, outSSSBuffer );
    2167. #else
    2168.                 outColor = ApplyBlendMode ( diffuseLighting, specularLighting, builtinData.opacity );
    2169.                 outColor = EvaluateAtmosphericScattering ( posInput, outColor );
    2170. #endif
    2171.  
    2172.             }
    2173.             ENDHLSL
    2174.         }
    2175.     }
    2176.     FallBack "Hidden/InternalErrorShader"
    2177.     CustomEditor "ASEMaterialInspector"
    2178.  
    2179.  
    2180. }
    2181. /*ASEBEGIN
    2182. Version=16000
    2183. -1917;25;1914;1052;551.7401;1021.628;1;True;True
    2184. Node;AmplifyShaderEditor.CommentaryNode;42;-171.5941,-2144.89;Float;False;1282.785;752.313;This block enables me to have different colour hairs.;7;41;40;39;38;37;36;35;Strand Mapping;0.9485294,0.04882136,0.04882136,1;0;0
    2185. Node;AmplifyShaderEditor.SamplerNode;35;-119.7933,-2099.586;Float;True;Property;_StrandID;Strand ID;4;0;Create;True;0;0;False;1;Header (Detail Hair Colour);None;ca201a2e492edda4894a43cc663a1881;True;0;False;gray;Auto;False;Object;-1;Auto;Texture2D;6;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;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
    2186. Node;AmplifyShaderEditor.CommentaryNode;14;-1540.736,-628.7388;Float;False;1044.756;883.1163;Base Hair Layer (Alpha Only). Hair colour driver by strand map;13;4;5;6;3;1;2;9;7;8;12;11;13;15;Hair Albedo;0.1839623,0.2681169,0.735849,1;0;0
    2187. Node;AmplifyShaderEditor.CommentaryNode;21;-1795.536,-1483.361;Float;False;1302.155;625.5582;Base Normal Mapping with two sided lighting;5;16;17;18;19;20;Normal Mapping;0.4980392,0.4980392,1,1;0;0
    2188. Node;AmplifyShaderEditor.ColorNode;36;114.2115,-1813.062;Float;False;Property;_TertiaryHairs;Tertiary Hairs;7;0;Create;True;0;0;False;0;1,1,1,1;0.573,0.573,0.573,1;False;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
    2189. Node;AmplifyShaderEditor.RangedFloatNode;15;-1494.823,-99.99113;Float;False;Constant;_ClipBias;Clip Bias;5;0;Create;True;0;0;False;0;0;0;0;0;0;1;FLOAT;0
    2190. Node;AmplifyShaderEditor.Vector3Node;39;456.8323,-1884.269;Float;False;Constant;_Vector1;Vector 1;5;0;Create;True;0;0;False;0;0,0,0;0,0,0;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3
    2191. Node;AmplifyShaderEditor.RangedFloatNode;16;-1745.536,-1433.361;Float;False;Property;_FiberStrength;Fiber Strength;3;0;Create;True;0;0;False;0;0;1;0;3;0;1;FLOAT;0
    2192. Node;AmplifyShaderEditor.ColorNode;40;365.2427,-1565.774;Float;False;Property;_MainHairColour;Main Hair Colour;5;0;Create;True;0;0;False;0;1,1,1,1;1,1,1,1;False;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
    2193. Node;AmplifyShaderEditor.ColorNode;37;109.1173,-1606.489;Float;False;Property;_SecondaryHairs;Secondary Hairs;6;0;Create;True;0;0;False;0;1,1,1,1;1,1,1,1;False;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
    2194. Node;AmplifyShaderEditor.DynamicAppendNode;38;423.0692,-2099.917;Float;False;FLOAT3;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT3;0
    2195. Node;AmplifyShaderEditor.LayeredBlendNode;41;811.2111,-1738.955;Float;False;6;0;FLOAT3;0,0,0;False;1;COLOR;0,0,0,0;False;2;COLOR;0,0,0,0;False;3;COLOR;0,0,0,0;False;4;COLOR;0,0,0,0;False;5;COLOR;0,0,0,0;False;1;COLOR;0
    2196. Node;AmplifyShaderEditor.SamplerNode;13;-1262.936,-104.0389;Float;True;Property;_HairbaseRGBAlphaA;Hair base (RGB) Alpha (A);1;0;Create;True;0;0;False;0;None;06b5a144847a1cd4b8fd28dab4a0a454;True;0;False;gray;LockedToTexture2D;False;Object;-1;MipBias;Texture2D;6;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;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
    2197. Node;AmplifyShaderEditor.ColorNode;7;-1490.736,-362.339;Float;False;Property;_Tint;Tint;0;0;Create;True;0;0;False;1;Header (Basic Settings);0.469,0.469,0.469,0;1,1,1,1;False;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
    2198. Node;AmplifyShaderEditor.SamplerNode;17;-1451.221,-1319.353;Float;True;Property;_NormalMap;Normal Map;2;1;[Normal];Create;True;0;0;False;0;None;061e4b259d6a6fe439407cd505801b44;True;0;True;bump;Auto;True;Object;-1;Auto;Texture2D;6;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;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
    2199. Node;AmplifyShaderEditor.FaceVariableNode;20;-1582.585,-967.8028;Float;False;0;1;FLOAT;0
    2200. Node;AmplifyShaderEditor.FunctionNode;11;-1010.436,-578.7388;Float;False;Material Debug;11;;22;989c31c7ce7d87d488fa089db3b86ce6;0;0;3;FLOAT;5;COLOR;7;FLOAT;0
    2201. Node;AmplifyShaderEditor.RangedFloatNode;24;-526.8214,-74.52026;Float;False;Property;_BaseRoughness;Base Roughness;9;0;Create;True;0;0;False;1;Header (Base Shading);0;0.2;0;0;0;1;FLOAT;0
    2202. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;12;-945.7356,-329.4389;Float;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0
    2203. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;8;-1185.735,-447.3389;Float;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0
    2204. Node;AmplifyShaderEditor.RangedFloatNode;25;433.7878,-400.8104;Float;False;Property;_BaseSpecular;Base Specular;10;0;Create;True;0;0;False;0;0.04;0.13;0;0;0;1;FLOAT;0
    2205. Node;AmplifyShaderEditor.OneMinusNode;23;-289.428,-251.961;Float;False;1;0;FLOAT;0;False;1;FLOAT;0
    2206. Node;AmplifyShaderEditor.ColorNode;28;424.0485,-254.6435;Float;False;Property;_HighlightColour;Highlight Colour;8;0;Create;True;0;0;True;0;1,1,1,0;1,1,1,0;False;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
    2207. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;19;-1053.227,-1045.805;Float;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
    2208. Node;AmplifyShaderEditor.DynamicAppendNode;18;-660.381,-1284.046;Float;False;FLOAT4;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT4;0
    2209. Node;AmplifyShaderEditor.ToggleSwitchNode;9;-803.7356,-212.3389;Float;False;Property;_DiffuseOnly;Diffuse Only;15;0;Create;True;0;0;False;0;0;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0
    2210. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;30;697.9637,-280.4414;Float;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0
    2211. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;22;-141.3702,114.137;Float;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
    2212. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;5;0,0;Float;False;False;2;Float;ASEMaterialInspector;0;1;Hidden/Templates/HDSRPPBR;bb308bce79762c34e823049efce65141;0;5;Motion Vectors;0;True;1;1;False;-1;0;False;-1;0;1;False;-1;0;False;-1;False;True;0;False;-1;False;False;True;1;False;-1;True;3;False;-1;False;True;3;RenderPipeline=HDRenderPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;5;0;False;False;False;False;True;True;128;False;-1;255;False;-1;128;False;-1;7;False;-1;3;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;True;1;LightMode=MotionVectors;True;5;0;;0;0;Specular;0;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT3;0,0,0;False;3;FLOAT3;0,0,0;False;0
    2213. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;3;0,0;Float;False;False;2;Float;ASEMaterialInspector;0;1;Hidden/Templates/HDSRPPBR;bb308bce79762c34e823049efce65141;0;3;ShadowCaster;0;True;1;1;False;-1;0;False;-1;0;1;False;-1;0;False;-1;False;True;0;False;-1;False;False;True;1;False;-1;True;3;False;-1;False;True;3;RenderPipeline=HDRenderPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;5;0;False;False;False;True;False;False;False;False;0;False;-1;False;False;False;False;True;1;LightMode=ShadowCaster;False;0;;0;0;Specular;0;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT3;0,0,0;False;3;FLOAT3;0,0,0;False;0
    2214. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;2;0,0;Float;False;False;2;Float;ASEMaterialInspector;0;1;Hidden/Templates/HDSRPPBR;bb308bce79762c34e823049efce65141;0;2;META;0;True;1;1;False;-1;0;False;-1;0;1;False;-1;0;False;-1;False;True;0;False;-1;False;False;True;1;False;-1;True;3;False;-1;False;True;3;RenderPipeline=HDRenderPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;5;0;False;False;True;2;False;-1;False;False;False;False;False;True;1;LightMode=Meta;False;0;;0;0;Specular;0;22;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;3;FLOAT3;0,0,0;False;4;FLOAT;0;False;5;FLOAT;0;False;6;FLOAT;0;False;7;FLOAT;0;False;8;FLOAT;0;False;11;FLOAT;0;False;12;INT;0;False;13;FLOAT;0;False;14;FLOAT;0;False;15;FLOAT;0;False;16;FLOAT;0;False;17;FLOAT;0;False;18;FLOAT;0;False;19;FLOAT3;0,0,0;False;20;FLOAT;0;False;21;FLOAT;0;False;9;FLOAT3;0,0,0;False;10;FLOAT3;0,0,0;False;0
    2215. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;1;0,0;Float;False;False;2;Float;ASEMaterialInspector;0;1;Hidden/Templates/HDSRPPBR;bb308bce79762c34e823049efce65141;0;1;GBufferWithPrepass;0;True;1;1;False;-1;0;False;-1;0;1;False;-1;0;False;-1;False;True;0;False;-1;False;False;True;1;False;-1;True;3;False;-1;False;True;3;RenderPipeline=HDRenderPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;5;0;False;False;False;False;True;False;1;False;-1;255;False;-1;7;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;True;1;LightMode=GBufferWithPrepass;False;0;;0;0;Specular;0;22;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;3;FLOAT3;0,0,0;False;4;FLOAT;0;False;5;FLOAT;0;False;6;FLOAT;0;False;7;FLOAT;0;False;8;FLOAT;0;False;11;FLOAT;0;False;12;INT;0;False;13;FLOAT;0;False;14;FLOAT;0;False;15;FLOAT;0;False;16;FLOAT;0;False;17;FLOAT;0;False;18;FLOAT;0;False;19;FLOAT3;0,0,0;False;20;FLOAT;0;False;21;FLOAT;0;False;9;FLOAT3;0,0,0;False;10;FLOAT3;0,0,0;False;0
    2216. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;4;0,0;Float;False;False;2;Float;ASEMaterialInspector;0;1;Hidden/Templates/HDSRPPBR;bb308bce79762c34e823049efce65141;0;4;DepthOnly;0;True;1;1;False;-1;0;False;-1;0;1;False;-1;0;False;-1;False;True;0;False;-1;False;False;True;1;False;-1;True;3;False;-1;False;True;3;RenderPipeline=HDRenderPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;5;0;False;False;False;True;False;False;False;False;0;False;-1;False;False;False;False;True;1;LightMode=DepthOnly;False;0;;0;0;Specular;0;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT3;0,0,0;False;3;FLOAT3;0,0,0;False;0
    2217. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;0;1211.969,-637.2988;Half;False;True;2;Half;ASEMaterialInspector;0;2;KRGraphics/Human/HDSRP/Hair/Advanced Hair Kajiya-Kay;bb308bce79762c34e823049efce65141;0;0;Main Pass;22;True;2;5;False;-1;10;False;-1;3;1;False;-1;10;False;-1;False;True;2;False;-1;False;False;True;2;False;-1;True;3;False;-1;False;True;3;RenderPipeline=HDRenderPipeline;RenderType=Transparent=RenderType;Queue=Transparent=Queue=0;True;5;0;False;False;False;False;True;False;1;False;-1;255;False;-1;7;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;True;1;LightMode=GBuffer;False;0;;0;0;Specular;0;22;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;3;FLOAT3;0,0,0;False;4;FLOAT;0;False;5;FLOAT;0;False;6;FLOAT;0;False;7;FLOAT;0;False;8;FLOAT;0;False;11;FLOAT;0;False;12;INT;0;False;13;FLOAT;0;False;14;FLOAT;0;False;15;FLOAT;0;False;16;FLOAT;0;False;17;FLOAT;0;False;18;FLOAT;0;False;19;FLOAT3;0,0,0;False;20;FLOAT;0;False;21;FLOAT;0;False;9;FLOAT3;0,0,0;False;10;FLOAT3;0,0,0;False;0
    2218. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;6;0,0;Float;False;False;2;Float;ASEMaterialInspector;0;1;Hidden/Templates/HDSRPPBR;bb308bce79762c34e823049efce65141;0;6;Forward;0;True;1;1;False;-1;0;False;-1;0;1;False;-1;0;False;-1;False;True;0;False;-1;False;False;True;1;False;-1;True;3;False;-1;False;True;3;RenderPipeline=HDRenderPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;5;0;False;False;False;False;True;False;1;False;-1;255;False;-1;7;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;True;1;LightMode=Forward;False;0;;0;0;Specular;0;22;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;3;FLOAT3;0,0,0;False;4;FLOAT;0;False;5;FLOAT;0;False;6;FLOAT;0;False;7;FLOAT;0;False;8;FLOAT;0;False;11;FLOAT;0;False;12;INT;0;False;13;FLOAT;0;False;14;FLOAT;0;False;15;FLOAT;0;False;16;FLOAT;0;False;17;FLOAT;0;False;18;FLOAT;0;False;19;FLOAT3;0,0,0;False;20;FLOAT;0;False;21;FLOAT;0;False;9;FLOAT3;0,0,0;False;10;FLOAT3;0,0,0;False;0
    2219. WireConnection;38;0;35;1
    2220. WireConnection;38;1;35;2
    2221. WireConnection;38;2;35;3
    2222. WireConnection;41;0;38;0
    2223. WireConnection;41;1;39;0
    2224. WireConnection;41;2;36;0
    2225. WireConnection;41;3;37;0
    2226. WireConnection;41;4;40;0
    2227. WireConnection;13;2;15;0
    2228. WireConnection;17;5;16;0
    2229. WireConnection;12;0;11;7
    2230. WireConnection;12;1;13;4
    2231. WireConnection;8;0;7;0
    2232. WireConnection;8;1;41;0
    2233. WireConnection;23;0;24;0
    2234. WireConnection;19;0;17;3
    2235. WireConnection;19;1;20;0
    2236. WireConnection;18;0;17;1
    2237. WireConnection;18;1;17;2
    2238. WireConnection;18;2;19;0
    2239. WireConnection;9;0;8;0
    2240. WireConnection;9;1;12;0
    2241. WireConnection;30;0;28;0
    2242. WireConnection;30;1;25;0
    2243. WireConnection;22;0;13;4
    2244. WireConnection;22;1;23;0
    2245. WireConnection;0;0;9;0
    2246. WireConnection;0;1;18;0
    2247. WireConnection;0;3;30;0
    2248. WireConnection;0;5;22;0
    2249. WireConnection;0;7;13;4
    2250. ASEEND*/
    2251. //CHKSM=A1537226C15CEB8F0C9084F7FB5F39F01EF104AD
     
    Last edited: Nov 29, 2018
  9. corjn

    corjn

    Joined:
    Feb 6, 2014
    Posts:
    104
    No worries, that's really nice you're helping people on the forum : ) Amplify team answered It may be (or may be not) a limitation from LWRP :

    Thanks for your quick feedback Ricardo : )
     
    Ricardo_Amplify likes this.
  10. Cleverlie

    Cleverlie

    Joined:
    Dec 23, 2013
    Posts:
    208
    hi people, I have a question, is it possible to make some kind of SSS effect in our shaders with amplify? I know that we can get something similar to SSS with translucency and transmission, but I'm looking at being able to do this in deferred, I'm not a shader expert, so I don't know the limitations and the reasons why translucency is forward only in amplify, but I think there are SSS solutions out there that use a deferred path, is this an ASE limitation, a unity limitation in its built-in pipeline? is this a conceptual limitation of some kind as it is a limitation to render transparent stuff to forward because that's the way it is? can someone point me in the right direction? thanks!
     
  11. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,995
    I have created a SSS shader for human skin rendering, which closely emulates the shaders in Marmoset Toolbag and offline renders... AFAIK, Subsurface Scattering is a Forward Only shader... Even Unreal 4 has this limit as well... look a few posts up and you can see some examples of Skin Shaders I have made with ASE. I am still trying to add vellis hairs in the shader...
     
  12. OP3NGL

    OP3NGL

    Joined:
    Dec 10, 2013
    Posts:
    247
    like in blend mode in standard shader u can switch from opaque to fade to transparent cutoff.. i wanna do exactly that.
    i wanna be able to switch the render types in ASE....
     
  13. cAyouMontreal

    cAyouMontreal

    Joined:
    Jun 30, 2011
    Posts:
    303
    I'm struggling with making a classic transparent alpha blending shader with the HDRP template. Any advice?
    So far, connecting the alpha output anything does nothing, and changing the alpha blend to anyelse than None will break the shader.
    I thought it was something very basic to perform :(
     
  14. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,339
    Yes, I do need the toggle-able node parameter to get access to an unmodified mesh tangent w-parameter.

    I think in general it is better not to assume anything what a developer is supposed to do with shader variables. I know there are things called Color, Normal, Tangent, etc, but you can use it for something else (what I do), not just for the intended purpose.
     
  15. MirzaBeig

    MirzaBeig

    Joined:
    Dec 27, 2014
    Posts:
    483
    Is there a template for Custom Render Texture? I want to be able to write shader outputs directly to a texture in my assets folder. If not, I'm making my own for ASE and it looks like I can't put the tags in another file (cginc), meaning I have to copy over the contents into the main template shader and place the tags there.

    So instead of this:

    upload_2018-12-2_5-40-43.png

    I have to do this?

    upload_2018-12-2_5-41-27.png

    ^The actual shader is much bigger and that's just the top part.

    The latter works, but I'd like to be able to abstract the files. I was hoping ASE would search the cginc for tags since otherwise I get this error.

    upload_2018-12-2_5-43-3.png

    Is there any way to have the cginc searched for template tags?

    To summarize: My template is working if I dump the modified cginc with the tags, and I'm able to create Custom Render Texture shaders through ASE which work/look great, but I'd rather not have massive "main templates.shader" files.

    Another question, if you don't mind!

    What's the equivalent for tex2Dproj using ASE nodes? For now I just made a custom function:

    upload_2018-12-2_5-48-44.png
     
    Last edited: Dec 2, 2018
  16. Caliber-Mengsk

    Caliber-Mengsk

    Joined:
    Mar 24, 2010
    Posts:
    687
    Hello. I just bought this package and am trying to get it set up and working. I'm trying to get it working with the HD render pipeline. I've imported the ASE package, and gone into the subfolder and imported the template srp and imported HDSRPTemplates. I then made a new shader (create>amplify shader>hd pbr) and I am getting a compile error on it.

    Code (CSharp):
    1. failed to open source file: 'Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl'
    2. Compiling Vertex program
    3. Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR
    I have the HD Render pipeline package as well as the pipeline core package installed through the package manager, and am using unity 2018.2.10f. I've also downloaded the latest version of the package from the website to be sure I had the newest version. Normal hdrp pbr shaders are working in the project. I'm sure it's something I'm doing wrong, but.... T_T What am I doing wrong?
     
  17. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,161
    As far as I see using alpha input I have to set the queue to transparent.
    This results in depth sorting issues, also with rendertype set to cutout :(
     
  18. hdxpmc

    hdxpmc

    Joined:
    May 1, 2016
    Posts:
    26
    Hello,
    Why TexCoord 5 can not be accessed in Standard Surface ?
    We want to use more uv channel in standard surface shader. How to use it ?
     
  19. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    1,510
    The sorting issues are to be expected(alpha blend), we'll have to examine the flicker.



    You'll be able to access it in the next update, we've just made a few changes to the Vertex Tangent node.

    We recently included a Custom Render Texture template, be sure to check it out.
    EditorResources/Templates/CustomRTTemplates.unitypackage, Examples> Official CustomRTRain

    We currently don't have tex2Dproj equivelent but it's definitely something we can add to the Texture Sample node.

    What have you adjusted so far? (screenshot)



    Thank you for your purchase, we really appreciate the support.

    Which HD Template package did you import, and what's your currently installed HD SRP version?



    That might be a bit more tricky as it would likely require some additional scripts, it's not something we can change inline.

    You can make a few in-line adjustments, perhaps that will be sufficient for your current requirements.



    We added support for additional UV channels a couple of updates ago but Unity only allows you to use it on 2018.2 or higher. What's your current version?

    Thanks!
     
    Last edited: Dec 3, 2018
    KRGraphics and cAyouMontreal like this.
  20. cAyouMontreal

    cAyouMontreal

    Joined:
    Jun 30, 2011
    Posts:
    303
    Yes it works thanks :) (replied also on your forum)
     
  21. AssembledVS

    AssembledVS

    Joined:
    Feb 23, 2014
    Posts:
    239
    Is it possible to create an occlusion effect for 2D sprites with this tool? I'm coming from Shader Forge and bought Amplify Shader Editor as an alternative to it, and Shader Forge did not allow for multi-pass shaders so I relied on some hand-coded shaders that I found online (I know very little about shader programming).

    Basically, a sprite that has an "occluded sprite" material will turn a solid color if covered by another sprite with a higher sorting layer or order in layer. The sprite that covers/occludes should also be able to be occluded if a different sprite, with a still higher sorting layer or order in layer, covers/occludes it.
     
  22. hdxpmc

    hdxpmc

    Joined:
    May 1, 2016
    Posts:
    26
    Hello,
    We are using Unity 2018.2.16f.
    Shader type: Surface
    Light Model: Standard Specular
    Shader Model: 3.5
    When set Vertex TexCoord to 5, it inform can't access this channel in Standard Surface
     
    Last edited: Dec 4, 2018
  23. cAyouMontreal

    cAyouMontreal

    Joined:
    Jun 30, 2011
    Posts:
    303
    Is this something like this:
    https://twitter.com/Sirhaian/status/1069064793418432512
    you want to achieve?
     
  24. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,995
    Thankfully I haven't seen this with my hair shader... (Still trying to figure out how to add passes :/)
     
  25. Amplify_Borba

    Amplify_Borba

    Joined:
    Jul 24, 2017
    Posts:
    538
    Hello, we do support the authoring of custom and multi-pass shaders through our Shader Templates, and already provide some simple templates that can be used as a starting point, so it should be possible to achieve that sort of effect. This does require some shader knowledge in order to set up and handle, however, as you're required to have a certain grasp of the shader code.

    Do let us know if you have any further questions or come across any issues, we'll be happy to assist!


    Hello, you'll need to be using a Shader Type other than the Standard Surface since at this time since the Surface Shaders do not allow the use of these channels in their syntax.

    For now, we're only able to directly support this in our templates, hopefully if Unity adds the means to access those channels through the Surface shader, we'll also be able to do so as well. Nevertheless, we're still on the lookout for any possible solution or workaround for this.

    Apologies if we weren't clear enough on this.


    Good find, that's a neat effect!


    Hey there, the simplest way to set up a multi-pass shader is illustrated in our wiki manual, I would highly recommend following through on the guide that we've shared there a few times in order to better understand its fundamentals.

    Our multi-pass sample, located in the \Examples\Official\MultiPassDistortion folder, can also be a good study case.

    Also, if you suspect that you've stumbled upon an issue feel free to share more information and we'll be happy to assist!
     
    Last edited: Dec 4, 2018
    KRGraphics likes this.
  26. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,995
    I'm familiar with setting up the SubShader tags, and the other stuff, it's the math stuff that throws me off
     
  27. Caliber-Mengsk

    Caliber-Mengsk

    Joined:
    Mar 24, 2010
    Posts:
    687
    @Amplify_Ricardo I have the current version of HD Render pipeline and core (3.0.0) and the package I used was in the main ASE at Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP/HDSRPTemplates.unitypackage

    The package used was from the download link on the ASE website after entering my order number to get the newest version of it the same day I asked about the problem. (Should note that I installed the render pipeline core and HDRP packages through package manager, not by modifying the manifest, so the package files are located in the cache directory for unity, not directly in the project. I don't know if that's a factor or not.)
     
  28. AssembledVS

    AssembledVS

    Joined:
    Feb 23, 2014
    Posts:
    239
    No, I don't think so, something more like this: https://imgur.com/w1oXcDp



    Thanks, I'd have to delve in a little more.
     
  29. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,995
    upload_2018-12-4_23-7-52.png

    So I set my hair shader to Alpha Test and this is the result :-( (is Alpha Test broken here?)

    I was also messing with the shader code, basically trying to emulate what I used in Alloy and I was able to get this with a few passes...

    upload_2018-12-4_23-59-17.png However, I am not getting ANY hair depth... and I modelled the hair in such a way that I can get the hair depth... I'll reset my shader back to the default and see what I can do to get it looking right
     
  30. MirzaBeig

    MirzaBeig

    Joined:
    Dec 27, 2014
    Posts:
    483
    Thanks! I'll go back later and try out the template. But here's what I got from a prelim test with ASE. Will be posting to twitter soon.

    upload_2018-12-5_6-22-38.png
     
  31. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,995
    UPDATE:

    So I was able to get passes working as they should, however, I'm getting these black borders where the hair should be alpha blended. (All I did was just copy a block of code and change some of the tags to represent the passes.) I've decided on 4 passes to get the look I want, and it looks like I am very close. Could there be something I may have missed? I edited the resulting shader, not the template (which I am kinda tempted to add a Hair module...) upload_2018-12-5_10-21-3.png
     
  32. Elfinnik159

    Elfinnik159

    Joined:
    Feb 24, 2013
    Posts:
    107
    Hello
    I can't use tessellation with HDRP. Is it possible (if yes, please tell me where to activate it)?
     
  33. namdo

    namdo

    Joined:
    Feb 23, 2015
    Posts:
    177
    I have a shader that works in gamma color space but when I change it to linear color space it stops working. How do I fix it?
     
  34. Endi24

    Endi24

    Joined:
    May 6, 2015
    Posts:
    41
    Does anyone know how I would go about making reflective puddles?
     
  35. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,135
    Hello,

    can I use Amplify Shaders to improve shaders which I bought or found on the net (which are not created with Amplify shaders)?
    And automatically test them for Errors or Performance improvemtents?

    Can I create a shader that works like the Standard shader but only Needs the Albedo and normal map (using light and fog and shadows the Standard way) or Looks better than the Standard shader (stronger 3D effect) but with same Performance?

    Thanks a lot :)
     
  36. MirzaBeig

    MirzaBeig

    Joined:
    Dec 27, 2014
    Posts:
    483
    Does ASE have any other noise types available somehow (other than Simplex 2D/3D)? I noticed Unity's Shader Graph has Perlin, Value, and Voronoi noise.

    > https://github.com/Unity-Technologies/ShaderGraph/wiki/Voronoi-Node

    Made a custom function node for Voronoi based off Unity's:

    vn.jpg

    I'm glad they have the source so I can use it in ASE, but I was hoping there might be some built-in nodes or functions?
     
    Last edited: Dec 7, 2018
    NeoTr0nic, hopeful and AthrunVLokiz like this.
  37. Caliber-Mengsk

    Caliber-Mengsk

    Joined:
    Mar 24, 2010
    Posts:
    687
    Don't suppose there's any more help for my problem? I can't use it at all as is. T_T
     
  38. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    1,559
    I have given up on how I can modify my vertex tangent. There is input for local vertex offset and normal, but no tangent.

    I want to do something like this : v.tangent = float4(0,1,0,-1); in my vertex shader.

    Any idea?
     
  39. cAyouMontreal

    cAyouMontreal

    Joined:
    Jun 30, 2011
    Posts:
    303
    For testing it's cool to have noise nodes, but it's always better to bake them into textures, because it's wayyyy faster.
    Personally I don't mind, as I always use textures for noise stuff.
     
  40. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    1,559
    It will be super cool to have the noise node to be able to bake its state so we can use it like a texture. :D
     
  41. Amplify_Borba

    Amplify_Borba

    Joined:
    Jul 24, 2017
    Posts:
    538
    Hello! You can find two template packages are located within the Assets > AmplifyShaderEditor > Plugins > EditorResources > Templates > SRP folder:

    - HDSRPTemplates (Legacy).unitypackage for HD RP 3.0.0 and below
    - HDSRPTemplates.unitypackage for HD RP 4.0.0 and above

    You must only extract the one that corresponds to the SRP version you have installed, which in this case would be the (Legacy) one.


    Hello! Unfortunately, it's not yet possible to use Tessellation with HDRP, and we are currently unable to give you a proper ETA.

    The HD pipeline has been in constant changes over these last weeks and, as such, we've decided to let it first stabilize and then expand our own templates with the new functionalities. Apologies for any inconvenience.


    Hello, could you please share some additional information?
    What do you mean by "stops working"? Are there any errors in the console?


    Hello, it would depend on how you'd approach it, but we do have two samples that might help - CubemapReflections and ReflectRefractSoapBubble.


    Hello, ASE allows you to create shaders through visual node editing, and it will allow you to edit those shaders only.
    Any other shader that has not been authored through ASE will not be recognized or opened.

    It's possible to author Standard shaders as well, but their performance will depend on the shader's complexity and features being used. Just to be clear, a specific Standard Surface shader written by hand that is recreated in ASE should have the same performance.

    You can also create custom shaders with ASE through Shader Templates, defining which ports and features are available in order to maximize performance. This is an advanced feature that requires some shader knowledge, though, and you will have to manually edit the template's code in some extent as well.


    Hey there! I've opened a request for this so that the developer can consider the possibility of adding those noise types in the future, thank you for the suggestion!


    Hello! From the screenshots it appears that there's no transparency or alpha cut being applied, are you by any chance indicating an incorrect value in the Alpha Clip Threshold that might be causing the Alpha Test to not cut where it should?
     
    MirzaBeig and KRGraphics like this.
  42. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    513
    Hey guys,

    We've uploaded a new build into our website.

    Here are the release notes.

    Release Notes v1.6.1 rev 01/02:
    • Fixes:
      • Fixed issue with reordering material properties for Translucency and Refraction port's properties
      • Fixed issue with 'Texture Sample' node when referencing an unconnected node
      • Fixed issue with late directives being injected on globals tag when functions area is available
        • Affected usage of 'World Space Light' nodes on HDRP templates
      • Fixed division by 0 issue on 'Triplanar Sample' node
      • Fixed incorrect directional light vector usage on HDRP templates
    • Improvements:
      • Updated HDRP templates to v4.3.0
      • 'Vertex Tangent' node now has Size option
      • Added access to all 8 UV sets on Surface shaders
      • Re-added 'Clip' node
        • First Input Port acts as a relay
        • Clip uses difference between Alpha and Threshold ( Alpha - Threshold )

    Hope you all have a great weekend and happy shader creations!
     
    hopeful and MirzaBeig like this.
  43. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    1,559
    What about? :

    I have given up on how I can modify my vertex tangent. There is input for local vertex offset and normal, but no tangent.

    I want to do something like this : v.tangent = float4(0,1,0,-1); in my vertex shader.

    Any idea?
     
  44. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,995
    I have no idea. In the initial setup, I didn't define an Alpha Clip threshold, since I want the hair to look full...

    I'll have to play with it again tonight, this time adding the threshold. The alpha texture has very smooth hair and increasing the threshold makes the hair look weird. Also turning on Zwrite helps a bit.

    I'm basically doing 4 passes... two with cull off, and one front and one back... would love to try and emulate the hair shader from Ryse and Uncharted 4
     
  45. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    1,510

    LAST CALL!

    Quick heads up for anyone interested in adding Amplify Shader Editor, Amplify Impostors, or any of our other products to their collection, the Unity Asset Store CYBER WEEK MADNESS SALE ends today!

    Now is the best time to get our packages at half price!

    MADNESS SALE - Amplify Products at 50% OFF
     
  46. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,995
    upload_2018-12-7_21-22-45.png upload_2018-12-7_21-22-53.png

    @Amplify_Borba So here is my hair setup with AlphaTest... and with the Alpha Threshold... it looks horrible.


    upload_2018-12-7_21-25-32.png upload_2018-12-7_21-25-43.png
    ...
    And here is my setup like it was originally... everything looks softer and natural... it's basically setting the Alpha Threshold to 0 to give the hair a very soft look... I am going to try doing the passes and try to get the depth of the hair...
     
  47. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,995
    upload_2018-12-7_23-25-55.png

    Yay... my somewhat successful creation of hair passes... although it doesn't have the same softness that I desire :(
     
  48. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    207
    Look at their simple terrain sample. They are setting the tangents via custom expresion which is then plugged in the vertex normal port.
     
  49. bitinn

    bitinn

    Joined:
    Aug 20, 2016
    Posts:
    611
    Hi, I am just wondering if it is possible to port a Surface shader using Custom Lighting to LWRP, and if it's not already possible out of the box, what could I have done to make this easier for myself?
     
  50. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,995
    To bump my recent post, I still can't get the hair to the proper softness even with the passes I created. What other steps could I have missed ?

    And I have a shader function for Kajiya-kay that keeps breaking my shader.

     
unityunity