// Made with Amplify Shader Editor // Available at the Unity Asset Store - http://u3d.as/y3X Shader "DawnShaderHDRP/ClothingShaderHDRP" { Properties { [HideInInspector] _EmissionColor("Emission Color", Color) = (1,1,1,1) [HideInInspector] _AlphaCutoff("Alpha Cutoff ", Range(0, 1)) = 0.5 [ASEBegin][Toggle(_USEALPHACUTOUT_ON)] _UseAlphaCutOut("Use Alpha Cut Out", Float) = 0 _OpacityBoosts("Opacity Boosts", Range( 0 , 20)) = 9.5 _DitherBoosts("Dither Boosts", Range( 0 , 10)) = 1 _Dirt("Dirt", 2D) = "white" {} _DirtBoots("Dirt Boots", Range( 0 , 2)) = 0 _DirtRoughness_Power("DirtRoughness_Power", Float) = 0 _AO("AO", 2D) = "white" {} _Normal("Normal", 2D) = "bump" {} _Mask("Mask", 2D) = "white" {} _Metallic("Metallic", 2D) = "white" {} _MetallicBoots01("Metallic Boots 01", Range( 0 , 4)) = 1 _MetallicBoots02("Metallic Boots 02", Range( 0 , 4)) = 1 _MetallicBoots03("Metallic Boots 03", Range( 0 , 4)) = 1 _MetallicBoots04("Metallic Boots 04", Range( 0 , 4)) = 1 _Roughness("Roughness", 2D) = "white" {} _RoughnessBoost01("Roughness Boost 01", Range( 0 , 4)) = 1 _RoughnessBoost02("Roughness Boost 02", Range( 0 , 4)) = 1 _RoughnessBoost03("Roughness Boost 03", Range( 0 , 4)) = 1 _RoughnessBoost04("Roughness Boost 04", Range( 0 , 4)) = 1 _BC("Base Color", 2D) = "white" {} _BlendColor01("Blend Color 01", Color) = (1,1,1,0) _BlendColorPower01("Blend Color Power 01", Range( 0 , 1)) = 0 _BlendColor02("Blend Color 02", Color) = (1,1,1,0) _BlendColorPower02("Blend Color Power 02", Range( 0 , 1)) = 0 _BlendColor03("Blend Color 03", Color) = (1,1,1,0) _BlendColorPower03("Blend Color Power 03", Range( 0 , 1)) = 0 _BlendColor04("Blend Color 04", Color) = (1,1,1,0) _BlendColorPower04("Blend Color Power 04", Range( 0 , 1)) = 0 [Toggle(_BLENDTEXTUREMODE_ON)] _BlendTextureMode("Blend Texture Mode", Float) = 0 [Toggle(_BLENDTEXTURE01_ON)] _BlendTexture01("Blend Texture 01", Float) = 0 [Toggle(_BLENDTEXTURE02_ON)] _BlendTexture02("Blend Texture 02", Float) = 0 [Toggle(_BLENDTEXTURE03_ON)] _BlendTexture03("Blend Texture 03", Float) = 0 [Toggle(_BLENDTEXTURE04_ON)] _BlendTexture04("Blend Texture 04", Float) = 0 _Texture01("Texture 01", 2D) = "white" {} _Texture02("Texture 02", 2D) = "white" {} _Texture03("Texture 03", 2D) = "white" {} _Texture04("Texture 04", 2D) = "white" {} _EmissiveMask1("Emissive Mask", 2D) = "white" {} _Emissivepowerboost1("Emissive power boost", Float) = 100 _EmissiveColor2("Emissive Color 01", Color) = (0,0,0,0) _EmissiveBoots2("Emissive Boots 1", Float) = 0 _EmissiveColor3("Emissive Color 02", Color) = (0,0,0,0) _EmissiveBoots3("Emissive Boots 2", Float) = 0 _EmissiveColor4("Emissive Color 03", Color) = (0,0,0,0) _EmissiveBoots4("Emissive Boots 3", Float) = 0 _EmissiveColor5("Emissive Color 04", Color) = (0,0,0,0) _EmissiveBoots5("Emissive Boots 4", Float) = 0 _EmissivePannerMap1("Emissive Panner Map", 2D) = "white" {} _EmissivePannerTilling1("Emissive Panner Tilling", Float) = 1 [ASEEnd]_PannerProperty1("Panner Property", Vector) = (0,0,0,0) [HideInInspector] _texcoord( "", 2D ) = "white" {} [HideInInspector] _RenderQueueType("Render Queue Type", Float) = 1 [HideInInspector] [ToggleUI] _AddPrecomputedVelocity("Add Precomputed Velocity", Float) = 1 [HideInInspector] _StencilRef("Stencil Ref", Int) = 0 [HideInInspector] _StencilWriteMask("Stencil Write Mask", Int) = 6 [HideInInspector] _StencilRefDepth("Stencil Ref Depth", Int) = 8 [HideInInspector] _StencilWriteMaskDepth("Stencil Write Mask Depth", Int) = 8 [HideInInspector] _StencilRefMV("Stencil Ref MV", Int) = 40 [HideInInspector] _StencilWriteMaskMV("Stencil Write Mask MV", Int) = 40 [HideInInspector] _StencilRefDistortionVec("Stencil Ref Distortion Vec", Int) = 4 [HideInInspector] _StencilWriteMaskDistortionVec("Stencil Write Mask Distortion Vec", Int) = 4 [HideInInspector] _StencilWriteMaskGBuffer("Stencil Write Mask GBuffer", Int) = 14 [HideInInspector] _StencilRefGBuffer("Stencil Ref GBuffer", Int) = 10 [HideInInspector] _ZTestGBuffer("ZTest GBuffer", Int) = 4 [HideInInspector] [ToggleUI] _RequireSplitLighting("Require Split Lighting", Float) = 0 [HideInInspector] [ToggleUI] _ReceivesSSR("Receives SSR", Float) = 1 [HideInInspector] _SurfaceType("Surface Type", Float) = 0 [HideInInspector] _BlendMode("Blend Mode", Float) = 0 [HideInInspector] _SrcBlend("Src Blend", Float) = 1 [HideInInspector] _DstBlend("Dst Blend", Float) = 0 [HideInInspector] _AlphaSrcBlend("Alpha Src Blend", Float) = 1 [HideInInspector] _AlphaDstBlend("Alpha Dst Blend", Float) = 0 [HideInInspector] [ToggleUI] _ZWrite("ZWrite", Float) = 1 [HideInInspector] [ToggleUI] _TransparentZWrite("Transparent ZWrite", Float) = 1 [HideInInspector] _CullMode("Cull Mode", Float) = 2 [HideInInspector] _TransparentSortPriority("Transparent Sort Priority", Int) = 0 [HideInInspector] [ToggleUI] _EnableFogOnTransparent("Enable Fog On Transparent", Float) = 1 [HideInInspector] _CullModeForward("Cull Mode Forward", Float) = 2 [HideInInspector] [Enum(Front, 1, Back, 2)] _TransparentCullMode("Transparent Cull Mode", Float) = 2 [HideInInspector] _ZTestDepthEqualForOpaque("ZTest Depth Equal For Opaque", Int) = 4 [HideInInspector] [Enum(UnityEngine.Rendering.CompareFunction)] _ZTestTransparent("ZTest Transparent", Float) = 4 [HideInInspector] [ToggleUI] _TransparentBackfaceEnable("Transparent Backface Enable", Float) = 0 [HideInInspector] [ToggleUI] _AlphaCutoffEnable("Alpha Cutoff Enable", Float) = 1 [HideInInspector] [ToggleUI] _UseShadowThreshold("Use Shadow Threshold", Float) = 0 [HideInInspector] [ToggleUI] _DoubleSidedEnable("Double Sided Enable", Float) = 0 [HideInInspector] [Enum(Flip, 0, Mirror, 1, None, 2)] _DoubleSidedNormalMode("Double Sided Normal Mode", Float) = 2 [HideInInspector] _DoubleSidedConstants("DoubleSidedConstants", Vector) = (1,1,-1,0) //_TessPhongStrength( "Tess Phong Strength", Range( 0, 1 ) ) = 0.5 //_TessValue( "Tess Max Tessellation", Range( 1, 32 ) ) = 16 //_TessMin( "Tess Min Distance", Float ) = 10 //_TessMax( "Tess Max Distance", Float ) = 25 //_TessEdgeLength ( "Tess Edge length", Range( 2, 50 ) ) = 16 //_TessMaxDisp( "Tess Max Displacement", Float ) = 25 } SubShader { LOD 0 Tags { "RenderPipeline"="HDRenderPipeline" "RenderType"="Opaque" "Queue"="Geometry" } HLSLINCLUDE #pragma target 4.5 #pragma only_renderers d3d11 ps4 xboxone vulkan metal switch #pragma multi_compile_instancing #pragma instancing_options renderinglayer struct GlobalSurfaceDescription // GBuffer Forward META TransparentBackface { float3 Albedo; float3 Normal; float3 BentNormal; float3 Specular; float CoatMask; float Metallic; float3 Emission; float Smoothness; float Occlusion; float Alpha; float AlphaClipThreshold; float AlphaClipThresholdShadow; float AlphaClipThresholdDepthPrepass; float AlphaClipThresholdDepthPostpass; float SpecularAAScreenSpaceVariance; float SpecularAAThreshold; float SpecularOcclusion; float DepthOffset; //Refraction float RefractionIndex; float3 RefractionColor; float RefractionDistance; //SSS/Translucent float Thickness; float SubsurfaceMask; float DiffusionProfile; //Anisotropy float Anisotropy; float3 Tangent; //Iridescent float IridescenceMask; float IridescenceThickness; //BakedGI float3 BakedGI; float3 BakedBackGI; }; struct AlphaSurfaceDescription // ShadowCaster { float Alpha; float AlphaClipThreshold; float AlphaClipThresholdShadow; float DepthOffset; }; struct SceneSurfaceDescription // SceneSelection { float Alpha; float AlphaClipThreshold; float DepthOffset; }; struct PrePassSurfaceDescription // DepthPrePass { float Alpha; float AlphaClipThresholdDepthPrepass; float DepthOffset; }; struct PostPassSurfaceDescription //DepthPostPass { float Alpha; float AlphaClipThresholdDepthPostpass; float DepthOffset; }; struct SmoothSurfaceDescription // MotionVectors DepthOnly { float3 Normal; float Smoothness; float Alpha; float AlphaClipThreshold; float DepthOffset; }; struct DistortionSurfaceDescription //Distortion { float Alpha; float2 Distortion; float DistortionBlur; float AlphaClipThreshold; }; float4 FixedTess( float tessValue ) { return tessValue; } float CalcDistanceTessFactor (float4 vertex, float minDist, float maxDist, float tess, float4x4 o2w, float3 cameraPos ) { float3 wpos = mul(o2w,vertex).xyz; float dist = distance (wpos, cameraPos); float f = clamp(1.0 - (dist - minDist) / (maxDist - minDist), 0.01, 1.0) * tess; return f; } float4 CalcTriEdgeTessFactors (float3 triVertexFactors) { float4 tess; tess.x = 0.5 * (triVertexFactors.y + triVertexFactors.z); tess.y = 0.5 * (triVertexFactors.x + triVertexFactors.z); tess.z = 0.5 * (triVertexFactors.x + triVertexFactors.y); tess.w = (triVertexFactors.x + triVertexFactors.y + triVertexFactors.z) / 3.0f; return tess; } float CalcEdgeTessFactor (float3 wpos0, float3 wpos1, float edgeLen, float3 cameraPos, float4 scParams ) { float dist = distance (0.5 * (wpos0+wpos1), cameraPos); float len = distance(wpos0, wpos1); float f = max(len * scParams.y / (edgeLen * dist), 1.0); return f; } float DistanceFromPlaneASE (float3 pos, float4 plane) { return dot (float4(pos,1.0f), plane); } bool WorldViewFrustumCull (float3 wpos0, float3 wpos1, float3 wpos2, float cullEps, float4 planes[6] ) { float4 planeTest; planeTest.x = (( DistanceFromPlaneASE(wpos0, planes[0]) > -cullEps) ? 1.0f : 0.0f ) + (( DistanceFromPlaneASE(wpos1, planes[0]) > -cullEps) ? 1.0f : 0.0f ) + (( DistanceFromPlaneASE(wpos2, planes[0]) > -cullEps) ? 1.0f : 0.0f ); planeTest.y = (( DistanceFromPlaneASE(wpos0, planes[1]) > -cullEps) ? 1.0f : 0.0f ) + (( DistanceFromPlaneASE(wpos1, planes[1]) > -cullEps) ? 1.0f : 0.0f ) + (( DistanceFromPlaneASE(wpos2, planes[1]) > -cullEps) ? 1.0f : 0.0f ); planeTest.z = (( DistanceFromPlaneASE(wpos0, planes[2]) > -cullEps) ? 1.0f : 0.0f ) + (( DistanceFromPlaneASE(wpos1, planes[2]) > -cullEps) ? 1.0f : 0.0f ) + (( DistanceFromPlaneASE(wpos2, planes[2]) > -cullEps) ? 1.0f : 0.0f ); planeTest.w = (( DistanceFromPlaneASE(wpos0, planes[3]) > -cullEps) ? 1.0f : 0.0f ) + (( DistanceFromPlaneASE(wpos1, planes[3]) > -cullEps) ? 1.0f : 0.0f ) + (( DistanceFromPlaneASE(wpos2, planes[3]) > -cullEps) ? 1.0f : 0.0f ); return !all (planeTest); } float4 DistanceBasedTess( float4 v0, float4 v1, float4 v2, float tess, float minDist, float maxDist, float4x4 o2w, float3 cameraPos ) { float3 f; f.x = CalcDistanceTessFactor (v0,minDist,maxDist,tess,o2w,cameraPos); f.y = CalcDistanceTessFactor (v1,minDist,maxDist,tess,o2w,cameraPos); f.z = CalcDistanceTessFactor (v2,minDist,maxDist,tess,o2w,cameraPos); return CalcTriEdgeTessFactors (f); } float4 EdgeLengthBasedTess( float4 v0, float4 v1, float4 v2, float edgeLength, float4x4 o2w, float3 cameraPos, float4 scParams ) { float3 pos0 = mul(o2w,v0).xyz; float3 pos1 = mul(o2w,v1).xyz; float3 pos2 = mul(o2w,v2).xyz; float4 tess; tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams); tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams); tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams); tess.w = (tess.x + tess.y + tess.z) / 3.0f; return tess; } float4 EdgeLengthBasedTessCull( float4 v0, float4 v1, float4 v2, float edgeLength, float maxDisplacement, float4x4 o2w, float3 cameraPos, float4 scParams, float4 planes[6] ) { float3 pos0 = mul(o2w,v0).xyz; float3 pos1 = mul(o2w,v1).xyz; float3 pos2 = mul(o2w,v2).xyz; float4 tess; if (WorldViewFrustumCull(pos0, pos1, pos2, maxDisplacement, planes)) { tess = 0.0f; } else { tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams); tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams); tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams); tess.w = (tess.x + tess.y + tess.z) / 3.0f; } return tess; } ENDHLSL Pass { Name "GBuffer" Tags { "LightMode"="GBuffer" } Cull [_CullMode] ZTest [_ZTestGBuffer] Stencil { Ref [_StencilRefGBuffer] WriteMask [_StencilWriteMaskGBuffer] Comp Always Pass Replace Fail Keep ZFail Keep } HLSLPROGRAM #define _SPECULAR_OCCLUSION_FROM_AO 1 #define _AMBIENT_OCCLUSION 1 #define ASE_SRP_VERSION 70403 #pragma shader_feature _SURFACE_TYPE_TRANSPARENT #pragma shader_feature_local _DOUBLESIDED_ON #pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY #pragma shader_feature_local _ENABLE_FOG_ON_TRANSPARENT #pragma shader_feature_local _ALPHATEST_ON #if !defined(DEBUG_DISPLAY) && defined(_ALPHATEST_ON) #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST #endif #define SHADERPASS SHADERPASS_GBUFFER #pragma multi_compile _ DEBUG_DISPLAY #pragma multi_compile _ LIGHTMAP_ON #pragma multi_compile _ DIRLIGHTMAP_COMBINED #pragma multi_compile _ DYNAMICLIGHTMAP_ON #pragma multi_compile _ SHADOWS_SHADOWMASK #pragma multi_compile DECALS_OFF DECALS_3RT DECALS_4RT #pragma multi_compile _ LIGHT_LAYERS #pragma vertex Vert #pragma fragment Frag //#define UNITY_MATERIAL_LIT #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) #define OUTPUT_SPLIT_LIGHTING #endif #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" #ifdef DEBUG_DISPLAY #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" #endif #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" #pragma shader_feature _BLENDTEXTUREMODE_ON #pragma shader_feature _BLENDTEXTURE01_ON #pragma shader_feature _BLENDTEXTURE02_ON #pragma shader_feature _BLENDTEXTURE03_ON #pragma shader_feature _BLENDTEXTURE04_ON #pragma shader_feature_local _USEALPHACUTOUT_ON #if defined(_DOUBLESIDED_ON) && !defined(ASE_NEED_CULLFACE) #define ASE_NEED_CULLFACE 1 #endif struct AttributesMesh { float3 positionOS : POSITION; float3 normalOS : NORMAL; float4 tangentOS : TANGENT; float4 uv1 : TEXCOORD1; float4 uv2 : TEXCOORD2; float4 ase_texcoord : TEXCOORD0; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct PackedVaryingsMeshToPS { float4 positionCS : SV_Position; float3 interp00 : TEXCOORD0; float3 interp01 : TEXCOORD1; float4 interp02 : TEXCOORD2; float4 interp03 : TEXCOORD3; float4 interp04 : TEXCOORD4; float4 ase_texcoord5 : TEXCOORD5; float4 ase_texcoord6 : TEXCOORD6; UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO #if defined(SHADER_STAGE_FRAGMENT) && defined(ASE_NEED_CULLFACE) FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; #endif }; CBUFFER_START( UnityPerMaterial ) float4 _BC_ST; float4 _EmissiveColor2; float4 _EmissiveColor4; float4 _EmissiveMask1_ST; float4 _EmissiveColor5; float4 _Roughness_ST; float4 _Metallic_ST; float4 _Normal_ST; float4 _Texture04_ST; float4 _Texture03_ST; float4 _Texture02_ST; float4 _Dirt_ST; float4 _EmissiveColor3; float4 _BlendColor01; float4 _Mask_ST; float4 _BlendColor02; float4 _AO_ST; float4 _BlendColor04; float4 _Texture01_ST; float4 _BlendColor03; float2 _PannerProperty1; float _EmissiveBoots4; float _EmissiveBoots5; float _DirtRoughness_Power; float _RoughnessBoost02; float _EmissiveBoots3; float _RoughnessBoost04; float _RoughnessBoost01; float _RoughnessBoost03; float _MetallicBoots04; float _EmissivePannerTilling1; float _Emissivepowerboost1; float _OpacityBoosts; float _MetallicBoots03; float _MetallicBoots02; float _MetallicBoots01; float _DirtBoots; float _BlendColorPower04; float _BlendColorPower03; float _BlendColorPower02; float _BlendColorPower01; float _EmissiveBoots2; float _DitherBoosts; float4 _EmissionColor; float _AlphaCutoff; float _RenderQueueType; #ifdef _ADD_PRECOMPUTED_VELOCITY float _AddPrecomputedVelocity; #endif float _StencilRef; float _StencilWriteMask; float _StencilRefDepth; float _StencilWriteMaskDepth; float _StencilRefMV; float _StencilWriteMaskMV; float _StencilRefDistortionVec; float _StencilWriteMaskDistortionVec; float _StencilWriteMaskGBuffer; float _StencilRefGBuffer; float _ZTestGBuffer; float _RequireSplitLighting; float _ReceivesSSR; float _SurfaceType; float _BlendMode; float _SrcBlend; float _DstBlend; float _AlphaSrcBlend; float _AlphaDstBlend; float _ZWrite; float _TransparentZWrite; float _CullMode; float _TransparentSortPriority; float _EnableFogOnTransparent; float _CullModeForward; float _TransparentCullMode; float _ZTestDepthEqualForOpaque; float _ZTestTransparent; float _TransparentBackfaceEnable; float _AlphaCutoffEnable; float _UseShadowThreshold; float _DoubleSidedEnable; float _DoubleSidedNormalMode; float4 _DoubleSidedConstants; #ifdef TESSELLATION_ON float _TessPhongStrength; float _TessValue; float _TessMin; float _TessMax; float _TessEdgeLength; float _TessMaxDisp; #endif CBUFFER_END sampler2D _BC; sampler2D _Mask; SAMPLER(sampler_Mask); sampler2D _Texture01; sampler2D _Texture02; sampler2D _Texture03; sampler2D _Texture04; sampler2D _Dirt; SAMPLER(sampler_Dirt); sampler2D _Normal; sampler2D _Metallic; sampler2D _EmissiveMask1; SAMPLER(sampler_EmissiveMask1); sampler2D _EmissivePannerMap1; sampler2D _Roughness; sampler2D _AO; SAMPLER(sampler_BC); inline float Dither4x4Bayer( int x, int y ) { const float dither[ 16 ] = { 1, 9, 3, 11, 13, 5, 15, 7, 4, 12, 2, 10, 16, 8, 14, 6 }; int r = y * 4 + x; return dither[r] / 16; // same # of instructions as pre-dividing due to compiler magic } void BuildSurfaceData(FragInputs fragInputs, inout GlobalSurfaceDescription surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) { ZERO_INITIALIZE(SurfaceData, surfaceData); surfaceData.specularOcclusion = 1.0; // surface data surfaceData.baseColor = surfaceDescription.Albedo; surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; surfaceData.ambientOcclusion = surfaceDescription.Occlusion; surfaceData.metallic = surfaceDescription.Metallic; surfaceData.coatMask = surfaceDescription.CoatMask; #ifdef _SPECULAR_OCCLUSION_CUSTOM surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; #endif #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; #endif #if defined(_HAS_REFRACTION) || defined(_MATERIAL_FEATURE_TRANSMISSION) surfaceData.thickness = surfaceDescription.Thickness; #endif #if defined( _MATERIAL_FEATURE_SUBSURFACE_SCATTERING ) || defined( _MATERIAL_FEATURE_TRANSMISSION ) surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfile); #endif #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR surfaceData.specularColor = surfaceDescription.Specular; #endif #ifdef _MATERIAL_FEATURE_ANISOTROPY surfaceData.anisotropy = surfaceDescription.Anisotropy; #endif #ifdef _MATERIAL_FEATURE_IRIDESCENCE surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; #endif // refraction #ifdef _HAS_REFRACTION if( _EnableSSRefraction ) { surfaceData.ior = surfaceDescription.RefractionIndex; surfaceData.transmittanceColor = surfaceDescription.RefractionColor; surfaceData.atDistance = surfaceDescription.RefractionDistance; surfaceData.transmittanceMask = ( 1.0 - surfaceDescription.Alpha ); surfaceDescription.Alpha = 1.0; } else { surfaceData.ior = 1.0; surfaceData.transmittanceColor = float3( 1.0, 1.0, 1.0 ); surfaceData.atDistance = 1.0; surfaceData.transmittanceMask = 0.0; surfaceDescription.Alpha = 1.0; } #else surfaceData.ior = 1.0; surfaceData.transmittanceColor = float3( 1.0, 1.0, 1.0 ); surfaceData.atDistance = 1.0; surfaceData.transmittanceMask = 0.0; #endif // material features surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; #endif #ifdef _MATERIAL_FEATURE_TRANSMISSION surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; #endif #ifdef _MATERIAL_FEATURE_ANISOTROPY surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; #endif #ifdef ASE_LIT_CLEAR_COAT surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; #endif #ifdef _MATERIAL_FEATURE_IRIDESCENCE surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; #endif #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; #endif // others #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) surfaceData.baseColor *= ( 1.0 - Max3( surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b ) ); #endif #ifdef _DOUBLESIDED_ON float3 doubleSidedConstants = _DoubleSidedConstants.xyz; #else float3 doubleSidedConstants = float3( 1.0, 1.0, 1.0 ); #endif // normals float3 normalTS = float3(0.0f, 0.0f, 1.0f); normalTS = surfaceDescription.Normal; GetNormalWS( fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants ); surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; bentNormalWS = surfaceData.normalWS; #ifdef ASE_BENT_NORMAL GetNormalWS( fragInputs, surfaceDescription.BentNormal, bentNormalWS, doubleSidedConstants ); #endif surfaceData.tangentWS = normalize( fragInputs.tangentToWorld[ 0 ].xyz ); #ifdef _MATERIAL_FEATURE_ANISOTROPY surfaceData.tangentWS = TransformTangentToWorld( surfaceDescription.Tangent, fragInputs.tangentToWorld ); #endif surfaceData.tangentWS = Orthonormalize( surfaceData.tangentWS, surfaceData.normalWS ); // decals #if HAVE_DECALS if( _EnableDecals ) { DecalSurfaceData decalSurfaceData = GetDecalSurfaceData( posInput, surfaceDescription.Alpha ); ApplyDecalToSurfaceData( decalSurfaceData, surfaceData ); } #endif #if defined(_SPECULAR_OCCLUSION_CUSTOM) #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO( V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness( surfaceData.perceptualSmoothness ) ); #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion( ClampNdotV( dot( surfaceData.normalWS, V ) ), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness( surfaceData.perceptualSmoothness ) ); #endif #ifdef _ENABLE_GEOMETRIC_SPECULAR_AA surfaceData.perceptualSmoothness = GeometricNormalFiltering( surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[ 2 ], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold ); #endif // debug #if defined(DEBUG_DISPLAY) if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) { surfaceData.metallic = 0; } ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); #endif } void GetSurfaceAndBuiltinData(GlobalSurfaceDescription surfaceDescription, FragInputs fragInputs, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData) { #ifdef LOD_FADE_CROSSFADE LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); #endif #ifdef _DOUBLESIDED_ON float3 doubleSidedConstants = _DoubleSidedConstants.xyz; #else float3 doubleSidedConstants = float3( 1.0, 1.0, 1.0 ); #endif ApplyDoubleSidedFlipOrMirror( fragInputs, doubleSidedConstants ); #ifdef _ALPHATEST_ON DoAlphaTest( surfaceDescription.Alpha, surfaceDescription.AlphaClipThreshold ); #endif #ifdef _DEPTHOFFSET_ON builtinData.depthOffset = surfaceDescription.DepthOffset; ApplyDepthOffsetPositionInput( V, surfaceDescription.DepthOffset, GetViewForwardDir(), GetWorldToHClipMatrix(), posInput ); #endif float3 bentNormalWS; BuildSurfaceData( fragInputs, surfaceDescription, V, posInput, surfaceData, bentNormalWS ); InitBuiltinData( posInput, surfaceDescription.Alpha, bentNormalWS, -fragInputs.tangentToWorld[ 2 ], fragInputs.texCoord1, fragInputs.texCoord2, builtinData ); #ifdef _ASE_BAKEDGI builtinData.bakeDiffuseLighting = surfaceDescription.BakedGI; #endif #ifdef _ASE_BAKEDBACKGI builtinData.backBakeDiffuseLighting = surfaceDescription.BakedBackGI; #endif builtinData.emissiveColor = surfaceDescription.Emission; #if (SHADERPASS == SHADERPASS_DISTORTION) builtinData.distortion = surfaceDescription.Distortion; builtinData.distortionBlur = surfaceDescription.DistortionBlur; #else builtinData.distortion = float2(0.0, 0.0); builtinData.distortionBlur = 0.0; #endif PostInitBuiltinData(V, posInput, surfaceData, builtinData); } PackedVaryingsMeshToPS VertexFunction(AttributesMesh inputMesh ) { PackedVaryingsMeshToPS outputPackedVaryingsMeshToPS; UNITY_SETUP_INSTANCE_ID(inputMesh); UNITY_TRANSFER_INSTANCE_ID(inputMesh, outputPackedVaryingsMeshToPS); UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( outputPackedVaryingsMeshToPS ); float4 ase_clipPos = TransformWorldToHClip( TransformObjectToWorld(inputMesh.positionOS)); float4 screenPos = ComputeScreenPos( ase_clipPos , _ProjectionParams.x ); outputPackedVaryingsMeshToPS.ase_texcoord6 = screenPos; outputPackedVaryingsMeshToPS.ase_texcoord5.xy = inputMesh.ase_texcoord.xy; //setting value to unused interpolator channels and avoid initialization warnings outputPackedVaryingsMeshToPS.ase_texcoord5.zw = 0; #ifdef ASE_ABSOLUTE_VERTEX_POS float3 defaultVertexValue = inputMesh.positionOS.xyz; #else float3 defaultVertexValue = float3( 0, 0, 0 ); #endif float3 vertexValue = defaultVertexValue ; #ifdef ASE_ABSOLUTE_VERTEX_POS inputMesh.positionOS.xyz = vertexValue; #else inputMesh.positionOS.xyz += vertexValue; #endif inputMesh.normalOS = inputMesh.normalOS ; inputMesh.tangentOS = inputMesh.tangentOS ; float3 positionRWS = TransformObjectToWorld(inputMesh.positionOS); float3 normalWS = TransformObjectToWorldNormal(inputMesh.normalOS); float4 tangentWS = float4(TransformObjectToWorldDir(inputMesh.tangentOS.xyz), inputMesh.tangentOS.w); outputPackedVaryingsMeshToPS.positionCS = TransformWorldToHClip(positionRWS); outputPackedVaryingsMeshToPS.interp00.xyz = positionRWS; outputPackedVaryingsMeshToPS.interp01.xyz = normalWS; outputPackedVaryingsMeshToPS.interp02.xyzw = tangentWS; outputPackedVaryingsMeshToPS.interp03.xyzw = inputMesh.uv1; outputPackedVaryingsMeshToPS.interp04.xyzw = inputMesh.uv2; return outputPackedVaryingsMeshToPS; } #if defined(TESSELLATION_ON) struct VertexControl { float3 positionOS : INTERNALTESSPOS; float3 normalOS : NORMAL; float4 tangentOS : TANGENT; float4 uv1 : TEXCOORD1; float4 uv2 : TEXCOORD2; float4 ase_texcoord : TEXCOORD0; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct TessellationFactors { float edge[3] : SV_TessFactor; float inside : SV_InsideTessFactor; }; VertexControl Vert ( AttributesMesh v ) { VertexControl o; UNITY_SETUP_INSTANCE_ID(v); UNITY_TRANSFER_INSTANCE_ID(v, o); o.positionOS = v.positionOS; o.normalOS = v.normalOS; o.tangentOS = v.tangentOS; o.uv1 = v.uv1; o.uv2 = v.uv2; o.ase_texcoord = v.ase_texcoord; return o; } TessellationFactors TessellationFunction (InputPatch v) { TessellationFactors o; float4 tf = 1; float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; #if (SHADEROPTIONS_CAMERA_RELATIVE_RENDERING != 0) float3 cameraPos = 0; #else float3 cameraPos = _WorldSpaceCameraPos; #endif #if defined(ASE_FIXED_TESSELLATION) tf = FixedTess( tessValue ); #elif defined(ASE_DISTANCE_TESSELLATION) tf = DistanceBasedTess(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), cameraPos ); #elif defined(ASE_LENGTH_TESSELLATION) tf = EdgeLengthBasedTess(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), edgeLength, GetObjectToWorldMatrix(), cameraPos, _ScreenParams ); #elif defined(ASE_LENGTH_CULL_TESSELLATION) tf = EdgeLengthBasedTessCull(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), cameraPos, _ScreenParams, _FrustumPlanes ); #endif o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; return o; } [domain("tri")] [partitioning("fractional_odd")] [outputtopology("triangle_cw")] [patchconstantfunc("TessellationFunction")] [outputcontrolpoints(3)] VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) { return patch[id]; } [domain("tri")] PackedVaryingsMeshToPS DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) { AttributesMesh o = (AttributesMesh) 0; o.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; o.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; o.tangentOS = patch[0].tangentOS * bary.x + patch[1].tangentOS * bary.y + patch[2].tangentOS * bary.z; o.uv1 = patch[0].uv1 * bary.x + patch[1].uv1 * bary.y + patch[2].uv1 * bary.z; o.uv2 = patch[0].uv2 * bary.x + patch[1].uv2 * bary.y + patch[2].uv2 * bary.z; o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; #if defined(ASE_PHONG_TESSELLATION) float3 pp[3]; for (int i = 0; i < 3; ++i) pp[i] = o.positionOS.xyz - patch[i].normalOS * (dot(o.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); float phongStrength = _TessPhongStrength; o.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.positionOS.xyz; #endif UNITY_TRANSFER_INSTANCE_ID(patch[0], o); return VertexFunction(o); } #else PackedVaryingsMeshToPS Vert ( AttributesMesh v ) { return VertexFunction( v ); } #endif void Frag( PackedVaryingsMeshToPS packedInput, OUTPUT_GBUFFER(outGBuffer) #ifdef _DEPTHOFFSET_ON , out float outputDepth : SV_Depth #endif ) { UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( packedInput ); UNITY_SETUP_INSTANCE_ID( packedInput ); FragInputs input; ZERO_INITIALIZE(FragInputs, input); input.tangentToWorld = k_identity3x3; float3 positionRWS = packedInput.interp00.xyz; float3 normalWS = packedInput.interp01.xyz; float4 tangentWS = packedInput.interp02.xyzw; input.positionSS = packedInput.positionCS; input.positionRWS = positionRWS; input.tangentToWorld = BuildTangentToWorld(tangentWS, normalWS); input.texCoord1 = packedInput.interp03.xyzw; input.texCoord2 = packedInput.interp04.xyzw; #if _DOUBLESIDED_ON && SHADER_STAGE_FRAGMENT input.isFrontFace = IS_FRONT_VFACE( packedInput.cullFace, true, false); #elif SHADER_STAGE_FRAGMENT #if defined(ASE_NEED_CULLFACE) input.isFrontFace = IS_FRONT_VFACE( packedInput.cullFace, true, false ); #endif #endif half isFrontFace = input.isFrontFace; PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); SurfaceData surfaceData; BuiltinData builtinData; GlobalSurfaceDescription surfaceDescription = (GlobalSurfaceDescription)0; float2 uv_BC = packedInput.ase_texcoord5.xy * _BC_ST.xy + _BC_ST.zw; float4 tex2DNode1 = tex2D( _BC, uv_BC ); float2 uv_Mask = packedInput.ase_texcoord5.xy * _Mask_ST.xy + _Mask_ST.zw; float4 tex2DNode2 = tex2D( _Mask, uv_Mask ); float4 lerpResult28 = lerp( float4( 0,0,0,0 ) , _BlendColor01 , tex2DNode2.r); float4 lerpResult29 = lerp( float4( 0,0,0,0 ) , _BlendColor02 , tex2DNode2.g); float4 lerpResult30 = lerp( float4( 0,0,0,0 ) , _BlendColor03 , tex2DNode2.b); float4 lerpResult31 = lerp( float4( 0,0,0,0 ) , _BlendColor04 , tex2DNode2.a); float4 lerpResult132 = lerp( tex2DNode1 , ( lerpResult28 + lerpResult29 + lerpResult30 + lerpResult31 ) , ( ( _BlendColorPower01 * tex2DNode2.r ) + ( _BlendColorPower02 * tex2DNode2.g ) + ( _BlendColorPower03 * tex2DNode2.b ) + ( _BlendColorPower04 * tex2DNode2.a ) )); float2 uv_Texture01 = packedInput.ase_texcoord5.xy * _Texture01_ST.xy + _Texture01_ST.zw; float4 lerpResult55 = lerp( float4( 0,0,0,0 ) , tex2D( _Texture01, uv_Texture01 ) , tex2DNode2.r); #ifdef _BLENDTEXTURE01_ON float4 staticSwitch60 = lerpResult55; #else float4 staticSwitch60 = tex2DNode1; #endif float2 uv_Texture02 = packedInput.ase_texcoord5.xy * _Texture02_ST.xy + _Texture02_ST.zw; float4 lerpResult56 = lerp( float4( 0,0,0,0 ) , tex2D( _Texture02, uv_Texture02 ) , tex2DNode2.g); #ifdef _BLENDTEXTURE02_ON float4 staticSwitch61 = lerpResult56; #else float4 staticSwitch61 = tex2DNode1; #endif float2 uv_Texture03 = packedInput.ase_texcoord5.xy * _Texture03_ST.xy + _Texture03_ST.zw; float4 lerpResult57 = lerp( float4( 0,0,0,0 ) , tex2D( _Texture03, uv_Texture03 ) , tex2DNode2.b); #ifdef _BLENDTEXTURE03_ON float4 staticSwitch62 = lerpResult57; #else float4 staticSwitch62 = tex2DNode1; #endif float2 uv_Texture04 = packedInput.ase_texcoord5.xy * _Texture04_ST.xy + _Texture04_ST.zw; float4 lerpResult58 = lerp( float4( 0,0,0,0 ) , tex2D( _Texture04, uv_Texture04 ) , tex2DNode2.a); #ifdef _BLENDTEXTURE04_ON float4 staticSwitch63 = lerpResult58; #else float4 staticSwitch63 = tex2DNode1; #endif float temp_output_27_0 = ( tex2DNode2.r + tex2DNode2.g + tex2DNode2.b + tex2DNode2.a ); float4 lerpResult71 = lerp( tex2DNode1 , ( ( staticSwitch60 * tex2DNode2.r ) + ( staticSwitch61 * tex2DNode2.g ) + ( staticSwitch62 * tex2DNode2.b ) + ( staticSwitch63 * tex2DNode2.a ) ) , temp_output_27_0); #ifdef _BLENDTEXTUREMODE_ON float4 staticSwitch72 = lerpResult71; #else float4 staticSwitch72 = lerpResult132; #endif float2 uv_Dirt = packedInput.ase_texcoord5.xy * _Dirt_ST.xy + _Dirt_ST.zw; float4 tex2DNode80 = tex2D( _Dirt, uv_Dirt ); float4 lerpResult87 = lerp( staticSwitch72 , ( tex2DNode80 * _DirtBoots ) , ( _DirtBoots * tex2DNode80.a )); float2 uv_Normal = packedInput.ase_texcoord5.xy * _Normal_ST.xy + _Normal_ST.zw; float2 uv_Metallic = packedInput.ase_texcoord5.xy * _Metallic_ST.xy + _Metallic_ST.zw; float4 tex2DNode76 = tex2D( _Metallic, uv_Metallic ); float4 lerpResult128 = lerp( tex2DNode76 , ( ( ( _MetallicBoots01 * tex2DNode2.r ) + ( _MetallicBoots02 * tex2DNode2.g ) + ( _MetallicBoots03 * tex2DNode2.b ) + ( _MetallicBoots04 * tex2DNode2.a ) ) * tex2DNode76 ) , temp_output_27_0); float2 uv_EmissiveMask1 = packedInput.ase_texcoord5.xy * _EmissiveMask1_ST.xy + _EmissiveMask1_ST.zw; float4 tex2DNode231 = tex2D( _EmissiveMask1, uv_EmissiveMask1 ); float2 temp_cast_2 = (_EmissivePannerTilling1).xx; float2 texCoord223 = packedInput.ase_texcoord5.xy * temp_cast_2 + float2( 0,0 ); float2 panner224 = ( ( _TimeParameters.x ) * _PannerProperty1 + texCoord223); float4 tex2DNode228 = tex2D( _EmissivePannerMap1, panner224 ); float2 uv_Roughness = packedInput.ase_texcoord5.xy * _Roughness_ST.xy + _Roughness_ST.zw; float4 temp_output_148_0 = ( 1.0 - tex2D( _Roughness, uv_Roughness ) ); float4 lerpResult119 = lerp( temp_output_148_0 , ( ( ( _RoughnessBoost01 * tex2DNode2.r ) + ( _RoughnessBoost02 * tex2DNode2.g ) + ( _RoughnessBoost03 * tex2DNode2.b ) + ( _RoughnessBoost04 * tex2DNode2.a ) ) * temp_output_148_0 ) , temp_output_27_0); float4 temp_cast_4 = (( _DirtRoughness_Power * _DirtBoots )).xxxx; float4 lerpResult88 = lerp( lerpResult119 , temp_cast_4 , ( _DirtBoots * tex2DNode80.a )); float2 uv_AO = packedInput.ase_texcoord5.xy * _AO_ST.xy + _AO_ST.zw; float4 color219 = IsGammaSpace() ? float4(1,1,1,0) : float4(1,1,1,0); float4 temp_cast_7 = (( tex2DNode1.a * _OpacityBoosts )).xxxx; #ifdef _USEALPHACUTOUT_ON float4 staticSwitch218 = temp_cast_7; #else float4 staticSwitch218 = color219; #endif float4 screenPos = packedInput.ase_texcoord6; float4 ase_screenPosNorm = screenPos / screenPos.w; ase_screenPosNorm.z = ( UNITY_NEAR_CLIP_VALUE >= 0 ) ? ase_screenPosNorm.z : ase_screenPosNorm.z * 0.5 + 0.5; float2 clipScreen212 = ase_screenPosNorm.xy * _ScreenParams.xy; float dither212 = Dither4x4Bayer( fmod(clipScreen212.x, 4), fmod(clipScreen212.y, 4) ); dither212 = step( dither212, ( tex2DNode1.a * _DitherBoosts ) ); surfaceDescription.Albedo = lerpResult87.rgb; surfaceDescription.Normal = UnpackNormalScale( tex2D( _Normal, uv_Normal ), 1.0f ); surfaceDescription.BentNormal = float3( 0, 0, 1 ); surfaceDescription.CoatMask = 0; surfaceDescription.Metallic = lerpResult128.r; #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR surfaceDescription.Specular = 0; #endif surfaceDescription.Emission = ( _Emissivepowerboost1 * ( ( tex2DNode231.r * tex2DNode228 * _EmissiveColor2 * _EmissiveBoots2 ) + ( tex2DNode231.g * tex2DNode228 * _EmissiveColor3 * _EmissiveBoots3 ) + ( tex2DNode231.b * tex2DNode228 * _EmissiveColor4 * _EmissiveBoots4 ) + ( tex2DNode231.a * tex2DNode228 * _EmissiveColor5 * _EmissiveBoots5 ) ) ).rgb; surfaceDescription.Smoothness = lerpResult88.r; surfaceDescription.Occlusion = tex2D( _AO, uv_AO ).r; surfaceDescription.Alpha = staticSwitch218.r; #ifdef _ALPHATEST_ON surfaceDescription.AlphaClipThreshold = ( 1.0 - dither212 ); #endif #ifdef _ALPHATEST_SHADOW_ON surfaceDescription.AlphaClipThresholdShadow = 0.5; #endif surfaceDescription.AlphaClipThresholdDepthPrepass = 0.5; surfaceDescription.AlphaClipThresholdDepthPostpass = 0.5; #ifdef _ENABLE_GEOMETRIC_SPECULAR_AA surfaceDescription.SpecularAAScreenSpaceVariance = 0; surfaceDescription.SpecularAAThreshold = 0; #endif #ifdef _SPECULAR_OCCLUSION_CUSTOM surfaceDescription.SpecularOcclusion = 0; #endif #if defined(_HAS_REFRACTION) || defined(_MATERIAL_FEATURE_TRANSMISSION) surfaceDescription.Thickness = 1; #endif #ifdef _HAS_REFRACTION surfaceDescription.RefractionIndex = 1; surfaceDescription.RefractionColor = float3( 1, 1, 1 ); surfaceDescription.RefractionDistance = 0; #endif #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING surfaceDescription.SubsurfaceMask = 1; #endif #if defined( _MATERIAL_FEATURE_SUBSURFACE_SCATTERING ) || defined( _MATERIAL_FEATURE_TRANSMISSION ) surfaceDescription.DiffusionProfile = 0; #endif #ifdef _MATERIAL_FEATURE_ANISOTROPY surfaceDescription.Anisotropy = 1; surfaceDescription.Tangent = float3( 1, 0, 0 ); #endif #ifdef _MATERIAL_FEATURE_IRIDESCENCE surfaceDescription.IridescenceMask = 0; surfaceDescription.IridescenceThickness = 0; #endif #ifdef _ASE_DISTORTION surfaceDescription.Distortion = float2 ( 2, -1 ); surfaceDescription.DistortionBlur = 1; #endif #ifdef _ASE_BAKEDGI surfaceDescription.BakedGI = 0; #endif #ifdef _ASE_BAKEDBACKGI surfaceDescription.BakedBackGI = 0; #endif #ifdef _DEPTHOFFSET_ON surfaceDescription.DepthOffset = 0; #endif GetSurfaceAndBuiltinData( surfaceDescription, input, V, posInput, surfaceData, builtinData ); ENCODE_INTO_GBUFFER( surfaceData, builtinData, posInput.positionSS, outGBuffer ); #ifdef _DEPTHOFFSET_ON outputDepth = posInput.deviceDepth; #endif } ENDHLSL } Pass { Name "META" Tags { "LightMode"="Meta" } Cull Off HLSLPROGRAM #define _SPECULAR_OCCLUSION_FROM_AO 1 #define _AMBIENT_OCCLUSION 1 #define ASE_SRP_VERSION 70403 #pragma shader_feature _SURFACE_TYPE_TRANSPARENT #pragma shader_feature_local _DOUBLESIDED_ON #pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY #pragma shader_feature_local _ENABLE_FOG_ON_TRANSPARENT #pragma shader_feature_local _ALPHATEST_ON #define SHADERPASS SHADERPASS_LIGHT_TRANSPORT #pragma vertex Vert #pragma fragment Frag //#define UNITY_MATERIAL_LIT #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) #define OUTPUT_SPLIT_LIGHTING #endif #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" #ifdef DEBUG_DISPLAY #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" #endif #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" #pragma shader_feature _BLENDTEXTUREMODE_ON #pragma shader_feature _BLENDTEXTURE01_ON #pragma shader_feature _BLENDTEXTURE02_ON #pragma shader_feature _BLENDTEXTURE03_ON #pragma shader_feature _BLENDTEXTURE04_ON #pragma shader_feature_local _USEALPHACUTOUT_ON #if defined(_DOUBLESIDED_ON) && !defined(ASE_NEED_CULLFACE) #define ASE_NEED_CULLFACE 1 #endif struct AttributesMesh { float3 positionOS : POSITION; float3 normalOS : NORMAL; float4 tangentOS : TANGENT; float4 uv0 : TEXCOORD0; float4 uv1 : TEXCOORD1; float4 uv2 : TEXCOORD2; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct PackedVaryingsMeshToPS { float4 positionCS : SV_Position; float4 ase_texcoord : TEXCOORD0; float4 ase_texcoord1 : TEXCOORD1; UNITY_VERTEX_INPUT_INSTANCE_ID #if defined(SHADER_STAGE_FRAGMENT) && defined(ASE_NEED_CULLFACE) FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; #endif }; CBUFFER_START( UnityPerMaterial ) float4 _BC_ST; float4 _EmissiveColor2; float4 _EmissiveColor4; float4 _EmissiveMask1_ST; float4 _EmissiveColor5; float4 _Roughness_ST; float4 _Metallic_ST; float4 _Normal_ST; float4 _Texture04_ST; float4 _Texture03_ST; float4 _Texture02_ST; float4 _Dirt_ST; float4 _EmissiveColor3; float4 _BlendColor01; float4 _Mask_ST; float4 _BlendColor02; float4 _AO_ST; float4 _BlendColor04; float4 _Texture01_ST; float4 _BlendColor03; float2 _PannerProperty1; float _EmissiveBoots4; float _EmissiveBoots5; float _DirtRoughness_Power; float _RoughnessBoost02; float _EmissiveBoots3; float _RoughnessBoost04; float _RoughnessBoost01; float _RoughnessBoost03; float _MetallicBoots04; float _EmissivePannerTilling1; float _Emissivepowerboost1; float _OpacityBoosts; float _MetallicBoots03; float _MetallicBoots02; float _MetallicBoots01; float _DirtBoots; float _BlendColorPower04; float _BlendColorPower03; float _BlendColorPower02; float _BlendColorPower01; float _EmissiveBoots2; float _DitherBoosts; float4 _EmissionColor; float _AlphaCutoff; float _RenderQueueType; #ifdef _ADD_PRECOMPUTED_VELOCITY float _AddPrecomputedVelocity; #endif float _StencilRef; float _StencilWriteMask; float _StencilRefDepth; float _StencilWriteMaskDepth; float _StencilRefMV; float _StencilWriteMaskMV; float _StencilRefDistortionVec; float _StencilWriteMaskDistortionVec; float _StencilWriteMaskGBuffer; float _StencilRefGBuffer; float _ZTestGBuffer; float _RequireSplitLighting; float _ReceivesSSR; float _SurfaceType; float _BlendMode; float _SrcBlend; float _DstBlend; float _AlphaSrcBlend; float _AlphaDstBlend; float _ZWrite; float _TransparentZWrite; float _CullMode; float _TransparentSortPriority; float _EnableFogOnTransparent; float _CullModeForward; float _TransparentCullMode; float _ZTestDepthEqualForOpaque; float _ZTestTransparent; float _TransparentBackfaceEnable; float _AlphaCutoffEnable; float _UseShadowThreshold; float _DoubleSidedEnable; float _DoubleSidedNormalMode; float4 _DoubleSidedConstants; #ifdef TESSELLATION_ON float _TessPhongStrength; float _TessValue; float _TessMin; float _TessMax; float _TessEdgeLength; float _TessMaxDisp; #endif CBUFFER_END sampler2D _BC; sampler2D _Mask; SAMPLER(sampler_Mask); sampler2D _Texture01; sampler2D _Texture02; sampler2D _Texture03; sampler2D _Texture04; sampler2D _Dirt; SAMPLER(sampler_Dirt); sampler2D _Normal; sampler2D _Metallic; sampler2D _EmissiveMask1; SAMPLER(sampler_EmissiveMask1); sampler2D _EmissivePannerMap1; sampler2D _Roughness; sampler2D _AO; SAMPLER(sampler_BC); inline float Dither4x4Bayer( int x, int y ) { const float dither[ 16 ] = { 1, 9, 3, 11, 13, 5, 15, 7, 4, 12, 2, 10, 16, 8, 14, 6 }; int r = y * 4 + x; return dither[r] / 16; // same # of instructions as pre-dividing due to compiler magic } void BuildSurfaceData(FragInputs fragInputs, inout GlobalSurfaceDescription surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) { ZERO_INITIALIZE(SurfaceData, surfaceData); surfaceData.specularOcclusion = 1.0; // surface data surfaceData.baseColor = surfaceDescription.Albedo; surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; surfaceData.ambientOcclusion = surfaceDescription.Occlusion; surfaceData.metallic = surfaceDescription.Metallic; surfaceData.coatMask = surfaceDescription.CoatMask; #ifdef _SPECULAR_OCCLUSION_CUSTOM surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; #endif #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; #endif #if defined(_HAS_REFRACTION) || defined(_MATERIAL_FEATURE_TRANSMISSION) surfaceData.thickness = surfaceDescription.Thickness; #endif #if defined( _MATERIAL_FEATURE_SUBSURFACE_SCATTERING ) || defined( _MATERIAL_FEATURE_TRANSMISSION ) surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfile); #endif #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR surfaceData.specularColor = surfaceDescription.Specular; #endif #ifdef _MATERIAL_FEATURE_ANISOTROPY surfaceData.anisotropy = surfaceDescription.Anisotropy; #endif #ifdef _MATERIAL_FEATURE_IRIDESCENCE surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; #endif // refraction #ifdef _HAS_REFRACTION if( _EnableSSRefraction ) { surfaceData.ior = surfaceDescription.RefractionIndex; surfaceData.transmittanceColor = surfaceDescription.RefractionColor; surfaceData.atDistance = surfaceDescription.RefractionDistance; surfaceData.transmittanceMask = ( 1.0 - surfaceDescription.Alpha ); surfaceDescription.Alpha = 1.0; } else { surfaceData.ior = 1.0; surfaceData.transmittanceColor = float3( 1.0, 1.0, 1.0 ); surfaceData.atDistance = 1.0; surfaceData.transmittanceMask = 0.0; surfaceDescription.Alpha = 1.0; } #else surfaceData.ior = 1.0; surfaceData.transmittanceColor = float3( 1.0, 1.0, 1.0 ); surfaceData.atDistance = 1.0; surfaceData.transmittanceMask = 0.0; #endif // material features surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; #endif #ifdef _MATERIAL_FEATURE_TRANSMISSION surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; #endif #ifdef _MATERIAL_FEATURE_ANISOTROPY surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; #endif #ifdef ASE_LIT_CLEAR_COAT surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; #endif #ifdef _MATERIAL_FEATURE_IRIDESCENCE surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; #endif #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; #endif // others #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) surfaceData.baseColor *= ( 1.0 - Max3( surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b ) ); #endif #ifdef _DOUBLESIDED_ON float3 doubleSidedConstants = _DoubleSidedConstants.xyz; #else float3 doubleSidedConstants = float3( 1.0, 1.0, 1.0 ); #endif // normals float3 normalTS = float3(0.0f, 0.0f, 1.0f); normalTS = surfaceDescription.Normal; GetNormalWS( fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants ); surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; bentNormalWS = surfaceData.normalWS; #ifdef ASE_BENT_NORMAL GetNormalWS( fragInputs, surfaceDescription.BentNormal, bentNormalWS, doubleSidedConstants ); #endif surfaceData.tangentWS = normalize( fragInputs.tangentToWorld[ 0 ].xyz ); #ifdef _MATERIAL_FEATURE_ANISOTROPY surfaceData.tangentWS = TransformTangentToWorld( surfaceDescription.Tangent, fragInputs.tangentToWorld ); #endif surfaceData.tangentWS = Orthonormalize( surfaceData.tangentWS, surfaceData.normalWS ); // decals #if HAVE_DECALS if( _EnableDecals ) { DecalSurfaceData decalSurfaceData = GetDecalSurfaceData( posInput, surfaceDescription.Alpha ); ApplyDecalToSurfaceData( decalSurfaceData, surfaceData ); } #endif #if defined(_SPECULAR_OCCLUSION_CUSTOM) #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO( V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness( surfaceData.perceptualSmoothness ) ); #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion( ClampNdotV( dot( surfaceData.normalWS, V ) ), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness( surfaceData.perceptualSmoothness ) ); #endif #ifdef _ENABLE_GEOMETRIC_SPECULAR_AA surfaceData.perceptualSmoothness = GeometricNormalFiltering( surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[ 2 ], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold ); #endif // debug #if defined(DEBUG_DISPLAY) if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) { surfaceData.metallic = 0; } ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); #endif } void GetSurfaceAndBuiltinData(GlobalSurfaceDescription surfaceDescription, FragInputs fragInputs, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData) { #ifdef LOD_FADE_CROSSFADE LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); #endif #ifdef _DOUBLESIDED_ON float3 doubleSidedConstants = _DoubleSidedConstants.xyz; #else float3 doubleSidedConstants = float3( 1.0, 1.0, 1.0 ); #endif ApplyDoubleSidedFlipOrMirror( fragInputs, doubleSidedConstants ); #ifdef _ALPHATEST_ON DoAlphaTest( surfaceDescription.Alpha, surfaceDescription.AlphaClipThreshold ); #endif #ifdef _DEPTHOFFSET_ON builtinData.depthOffset = surfaceDescription.DepthOffset; ApplyDepthOffsetPositionInput( V, surfaceDescription.DepthOffset, GetViewForwardDir(), GetWorldToHClipMatrix(), posInput ); #endif float3 bentNormalWS; BuildSurfaceData( fragInputs, surfaceDescription, V, posInput, surfaceData, bentNormalWS ); InitBuiltinData( posInput, surfaceDescription.Alpha, bentNormalWS, -fragInputs.tangentToWorld[ 2 ], fragInputs.texCoord1, fragInputs.texCoord2, builtinData ); builtinData.emissiveColor = surfaceDescription.Emission; #if (SHADERPASS == SHADERPASS_DISTORTION) builtinData.distortion = surfaceDescription.Distortion; builtinData.distortionBlur = surfaceDescription.DistortionBlur; #else builtinData.distortion = float2(0.0, 0.0); builtinData.distortionBlur = 0.0; #endif PostInitBuiltinData(V, posInput, surfaceData, builtinData); } CBUFFER_START(UnityMetaPass) bool4 unity_MetaVertexControl; bool4 unity_MetaFragmentControl; CBUFFER_END float unity_OneOverOutputBoost; float unity_MaxOutputValue; PackedVaryingsMeshToPS VertexFunction(AttributesMesh inputMesh ) { PackedVaryingsMeshToPS outputPackedVaryingsMeshToPS; UNITY_SETUP_INSTANCE_ID(inputMesh); UNITY_TRANSFER_INSTANCE_ID(inputMesh, outputPackedVaryingsMeshToPS); float4 ase_clipPos = TransformWorldToHClip( TransformObjectToWorld(inputMesh.positionOS)); float4 screenPos = ComputeScreenPos( ase_clipPos , _ProjectionParams.x ); outputPackedVaryingsMeshToPS.ase_texcoord1 = screenPos; outputPackedVaryingsMeshToPS.ase_texcoord.xy = inputMesh.uv0.xy; //setting value to unused interpolator channels and avoid initialization warnings outputPackedVaryingsMeshToPS.ase_texcoord.zw = 0; #ifdef ASE_ABSOLUTE_VERTEX_POS float3 defaultVertexValue = inputMesh.positionOS.xyz; #else float3 defaultVertexValue = float3( 0, 0, 0 ); #endif float3 vertexValue = defaultVertexValue ; #ifdef ASE_ABSOLUTE_VERTEX_POS inputMesh.positionOS.xyz = vertexValue; #else inputMesh.positionOS.xyz += vertexValue; #endif inputMesh.normalOS = inputMesh.normalOS ; inputMesh.tangentOS = inputMesh.tangentOS ; float2 uv = float2(0.0, 0.0); if (unity_MetaVertexControl.x) { uv = inputMesh.uv1.xy * unity_LightmapST.xy + unity_LightmapST.zw; } else if (unity_MetaVertexControl.y) { uv = inputMesh.uv2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; } outputPackedVaryingsMeshToPS.positionCS = float4(uv * 2.0 - 1.0, inputMesh.positionOS.z > 0 ? 1.0e-4 : 0.0, 1.0); return outputPackedVaryingsMeshToPS; } #if defined(TESSELLATION_ON) struct VertexControl { float3 positionOS : INTERNALTESSPOS; float3 normalOS : NORMAL; float4 tangentOS : TANGENT; float4 uv0 : TEXCOORD0; float4 uv1 : TEXCOORD1; float4 uv2 : TEXCOORD2; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct TessellationFactors { float edge[3] : SV_TessFactor; float inside : SV_InsideTessFactor; }; VertexControl Vert ( AttributesMesh v ) { VertexControl o; UNITY_SETUP_INSTANCE_ID(v); UNITY_TRANSFER_INSTANCE_ID(v, o); o.positionOS = v.positionOS; o.normalOS = v.normalOS; o.tangentOS = v.tangentOS; o.uv0 = v.uv0; o.uv1 = v.uv1; o.uv2 = v.uv2; return o; } TessellationFactors TessellationFunction (InputPatch v) { TessellationFactors o; float4 tf = 1; float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; #if (SHADEROPTIONS_CAMERA_RELATIVE_RENDERING != 0) float3 cameraPos = 0; #else float3 cameraPos = _WorldSpaceCameraPos; #endif #if defined(ASE_FIXED_TESSELLATION) tf = FixedTess( tessValue ); #elif defined(ASE_DISTANCE_TESSELLATION) tf = DistanceBasedTess(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), cameraPos ); #elif defined(ASE_LENGTH_TESSELLATION) tf = EdgeLengthBasedTess(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), edgeLength, GetObjectToWorldMatrix(), cameraPos, _ScreenParams ); #elif defined(ASE_LENGTH_CULL_TESSELLATION) tf = EdgeLengthBasedTessCull(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), cameraPos, _ScreenParams, _FrustumPlanes ); #endif o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; return o; } [domain("tri")] [partitioning("fractional_odd")] [outputtopology("triangle_cw")] [patchconstantfunc("TessellationFunction")] [outputcontrolpoints(3)] VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) { return patch[id]; } [domain("tri")] PackedVaryingsMeshToPS DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) { AttributesMesh o = (AttributesMesh) 0; o.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; o.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; o.tangentOS = patch[0].tangentOS * bary.x + patch[1].tangentOS * bary.y + patch[2].tangentOS * bary.z; o.uv0 = patch[0].uv0 * bary.x + patch[1].uv0 * bary.y + patch[2].uv0 * bary.z; o.uv1 = patch[0].uv1 * bary.x + patch[1].uv1 * bary.y + patch[2].uv1 * bary.z; o.uv2 = patch[0].uv2 * bary.x + patch[1].uv2 * bary.y + patch[2].uv2 * bary.z; #if defined(ASE_PHONG_TESSELLATION) float3 pp[3]; for (int i = 0; i < 3; ++i) pp[i] = o.positionOS.xyz - patch[i].normalOS * (dot(o.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); float phongStrength = _TessPhongStrength; o.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.positionOS.xyz; #endif UNITY_TRANSFER_INSTANCE_ID(patch[0], o); return VertexFunction(o); } #else PackedVaryingsMeshToPS Vert ( AttributesMesh v ) { return VertexFunction( v ); } #endif float4 Frag(PackedVaryingsMeshToPS packedInput ) : SV_Target { UNITY_SETUP_INSTANCE_ID( packedInput ); FragInputs input; ZERO_INITIALIZE(FragInputs, input); input.tangentToWorld = k_identity3x3; input.positionSS = packedInput.positionCS; #if _DOUBLESIDED_ON && SHADER_STAGE_FRAGMENT input.isFrontFace = IS_FRONT_VFACE( packedInput.cullFace, true, false); #elif SHADER_STAGE_FRAGMENT #if defined(ASE_NEED_CULLFACE) input.isFrontFace = IS_FRONT_VFACE(packedInput.cullFace, true, false); #endif #endif half isFrontFace = input.isFrontFace; PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); float3 V = float3(1.0, 1.0, 1.0); SurfaceData surfaceData; BuiltinData builtinData; GlobalSurfaceDescription surfaceDescription = (GlobalSurfaceDescription)0; float2 uv_BC = packedInput.ase_texcoord.xy * _BC_ST.xy + _BC_ST.zw; float4 tex2DNode1 = tex2D( _BC, uv_BC ); float2 uv_Mask = packedInput.ase_texcoord.xy * _Mask_ST.xy + _Mask_ST.zw; float4 tex2DNode2 = tex2D( _Mask, uv_Mask ); float4 lerpResult28 = lerp( float4( 0,0,0,0 ) , _BlendColor01 , tex2DNode2.r); float4 lerpResult29 = lerp( float4( 0,0,0,0 ) , _BlendColor02 , tex2DNode2.g); float4 lerpResult30 = lerp( float4( 0,0,0,0 ) , _BlendColor03 , tex2DNode2.b); float4 lerpResult31 = lerp( float4( 0,0,0,0 ) , _BlendColor04 , tex2DNode2.a); float4 lerpResult132 = lerp( tex2DNode1 , ( lerpResult28 + lerpResult29 + lerpResult30 + lerpResult31 ) , ( ( _BlendColorPower01 * tex2DNode2.r ) + ( _BlendColorPower02 * tex2DNode2.g ) + ( _BlendColorPower03 * tex2DNode2.b ) + ( _BlendColorPower04 * tex2DNode2.a ) )); float2 uv_Texture01 = packedInput.ase_texcoord.xy * _Texture01_ST.xy + _Texture01_ST.zw; float4 lerpResult55 = lerp( float4( 0,0,0,0 ) , tex2D( _Texture01, uv_Texture01 ) , tex2DNode2.r); #ifdef _BLENDTEXTURE01_ON float4 staticSwitch60 = lerpResult55; #else float4 staticSwitch60 = tex2DNode1; #endif float2 uv_Texture02 = packedInput.ase_texcoord.xy * _Texture02_ST.xy + _Texture02_ST.zw; float4 lerpResult56 = lerp( float4( 0,0,0,0 ) , tex2D( _Texture02, uv_Texture02 ) , tex2DNode2.g); #ifdef _BLENDTEXTURE02_ON float4 staticSwitch61 = lerpResult56; #else float4 staticSwitch61 = tex2DNode1; #endif float2 uv_Texture03 = packedInput.ase_texcoord.xy * _Texture03_ST.xy + _Texture03_ST.zw; float4 lerpResult57 = lerp( float4( 0,0,0,0 ) , tex2D( _Texture03, uv_Texture03 ) , tex2DNode2.b); #ifdef _BLENDTEXTURE03_ON float4 staticSwitch62 = lerpResult57; #else float4 staticSwitch62 = tex2DNode1; #endif float2 uv_Texture04 = packedInput.ase_texcoord.xy * _Texture04_ST.xy + _Texture04_ST.zw; float4 lerpResult58 = lerp( float4( 0,0,0,0 ) , tex2D( _Texture04, uv_Texture04 ) , tex2DNode2.a); #ifdef _BLENDTEXTURE04_ON float4 staticSwitch63 = lerpResult58; #else float4 staticSwitch63 = tex2DNode1; #endif float temp_output_27_0 = ( tex2DNode2.r + tex2DNode2.g + tex2DNode2.b + tex2DNode2.a ); float4 lerpResult71 = lerp( tex2DNode1 , ( ( staticSwitch60 * tex2DNode2.r ) + ( staticSwitch61 * tex2DNode2.g ) + ( staticSwitch62 * tex2DNode2.b ) + ( staticSwitch63 * tex2DNode2.a ) ) , temp_output_27_0); #ifdef _BLENDTEXTUREMODE_ON float4 staticSwitch72 = lerpResult71; #else float4 staticSwitch72 = lerpResult132; #endif float2 uv_Dirt = packedInput.ase_texcoord.xy * _Dirt_ST.xy + _Dirt_ST.zw; float4 tex2DNode80 = tex2D( _Dirt, uv_Dirt ); float4 lerpResult87 = lerp( staticSwitch72 , ( tex2DNode80 * _DirtBoots ) , ( _DirtBoots * tex2DNode80.a )); float2 uv_Normal = packedInput.ase_texcoord.xy * _Normal_ST.xy + _Normal_ST.zw; float2 uv_Metallic = packedInput.ase_texcoord.xy * _Metallic_ST.xy + _Metallic_ST.zw; float4 tex2DNode76 = tex2D( _Metallic, uv_Metallic ); float4 lerpResult128 = lerp( tex2DNode76 , ( ( ( _MetallicBoots01 * tex2DNode2.r ) + ( _MetallicBoots02 * tex2DNode2.g ) + ( _MetallicBoots03 * tex2DNode2.b ) + ( _MetallicBoots04 * tex2DNode2.a ) ) * tex2DNode76 ) , temp_output_27_0); float2 uv_EmissiveMask1 = packedInput.ase_texcoord.xy * _EmissiveMask1_ST.xy + _EmissiveMask1_ST.zw; float4 tex2DNode231 = tex2D( _EmissiveMask1, uv_EmissiveMask1 ); float2 temp_cast_2 = (_EmissivePannerTilling1).xx; float2 texCoord223 = packedInput.ase_texcoord.xy * temp_cast_2 + float2( 0,0 ); float2 panner224 = ( ( _TimeParameters.x ) * _PannerProperty1 + texCoord223); float4 tex2DNode228 = tex2D( _EmissivePannerMap1, panner224 ); float2 uv_Roughness = packedInput.ase_texcoord.xy * _Roughness_ST.xy + _Roughness_ST.zw; float4 temp_output_148_0 = ( 1.0 - tex2D( _Roughness, uv_Roughness ) ); float4 lerpResult119 = lerp( temp_output_148_0 , ( ( ( _RoughnessBoost01 * tex2DNode2.r ) + ( _RoughnessBoost02 * tex2DNode2.g ) + ( _RoughnessBoost03 * tex2DNode2.b ) + ( _RoughnessBoost04 * tex2DNode2.a ) ) * temp_output_148_0 ) , temp_output_27_0); float4 temp_cast_4 = (( _DirtRoughness_Power * _DirtBoots )).xxxx; float4 lerpResult88 = lerp( lerpResult119 , temp_cast_4 , ( _DirtBoots * tex2DNode80.a )); float2 uv_AO = packedInput.ase_texcoord.xy * _AO_ST.xy + _AO_ST.zw; float4 color219 = IsGammaSpace() ? float4(1,1,1,0) : float4(1,1,1,0); float4 temp_cast_7 = (( tex2DNode1.a * _OpacityBoosts )).xxxx; #ifdef _USEALPHACUTOUT_ON float4 staticSwitch218 = temp_cast_7; #else float4 staticSwitch218 = color219; #endif float4 screenPos = packedInput.ase_texcoord1; float4 ase_screenPosNorm = screenPos / screenPos.w; ase_screenPosNorm.z = ( UNITY_NEAR_CLIP_VALUE >= 0 ) ? ase_screenPosNorm.z : ase_screenPosNorm.z * 0.5 + 0.5; float2 clipScreen212 = ase_screenPosNorm.xy * _ScreenParams.xy; float dither212 = Dither4x4Bayer( fmod(clipScreen212.x, 4), fmod(clipScreen212.y, 4) ); dither212 = step( dither212, ( tex2DNode1.a * _DitherBoosts ) ); surfaceDescription.Albedo = lerpResult87.rgb; surfaceDescription.Normal = UnpackNormalScale( tex2D( _Normal, uv_Normal ), 1.0f ); surfaceDescription.BentNormal = float3( 0, 0, 1 ); surfaceDescription.CoatMask = 0; surfaceDescription.Metallic = lerpResult128.r; #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR surfaceDescription.Specular = 0; #endif surfaceDescription.Emission = ( _Emissivepowerboost1 * ( ( tex2DNode231.r * tex2DNode228 * _EmissiveColor2 * _EmissiveBoots2 ) + ( tex2DNode231.g * tex2DNode228 * _EmissiveColor3 * _EmissiveBoots3 ) + ( tex2DNode231.b * tex2DNode228 * _EmissiveColor4 * _EmissiveBoots4 ) + ( tex2DNode231.a * tex2DNode228 * _EmissiveColor5 * _EmissiveBoots5 ) ) ).rgb; surfaceDescription.Smoothness = lerpResult88.r; surfaceDescription.Occlusion = tex2D( _AO, uv_AO ).r; surfaceDescription.Alpha = staticSwitch218.r; #ifdef _ALPHATEST_ON surfaceDescription.AlphaClipThreshold = ( 1.0 - dither212 ); #endif #ifdef _ENABLE_GEOMETRIC_SPECULAR_AA surfaceDescription.SpecularAAScreenSpaceVariance = 0; surfaceDescription.SpecularAAThreshold = 0; #endif #ifdef _SPECULAR_OCCLUSION_CUSTOM surfaceDescription.SpecularOcclusion = 0; #endif #if defined(_HAS_REFRACTION) || defined(_MATERIAL_FEATURE_TRANSMISSION) surfaceDescription.Thickness = 1; #endif #ifdef _HAS_REFRACTION surfaceDescription.RefractionIndex = 1; surfaceDescription.RefractionColor = float3( 1, 1, 1 ); surfaceDescription.RefractionDistance = 0; #endif #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING surfaceDescription.SubsurfaceMask = 1; #endif #if defined( _MATERIAL_FEATURE_SUBSURFACE_SCATTERING ) || defined( _MATERIAL_FEATURE_TRANSMISSION ) surfaceDescription.DiffusionProfile = 0; #endif #ifdef _MATERIAL_FEATURE_ANISOTROPY surfaceDescription.Anisotropy = 1; surfaceDescription.Tangent = float3( 1, 0, 0 ); #endif #ifdef _MATERIAL_FEATURE_IRIDESCENCE surfaceDescription.IridescenceMask = 0; surfaceDescription.IridescenceThickness = 0; #endif GetSurfaceAndBuiltinData(surfaceDescription,input, V, posInput, surfaceData, builtinData); BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); LightTransportData lightTransportData = GetLightTransportData(surfaceData, builtinData, bsdfData); float4 res = float4(0.0, 0.0, 0.0, 1.0); if (unity_MetaFragmentControl.x) { res.rgb = clamp(pow(abs(lightTransportData.diffuseColor), saturate(unity_OneOverOutputBoost)), 0, unity_MaxOutputValue); } if (unity_MetaFragmentControl.y) { res.rgb = lightTransportData.emissiveColor; } return res; } ENDHLSL } Pass { Name "ShadowCaster" Tags { "LightMode"="ShadowCaster" } Cull [_CullMode] ZWrite On ZClip [_ZClip] ZTest LEqual ColorMask 0 HLSLPROGRAM #define _SPECULAR_OCCLUSION_FROM_AO 1 #define _AMBIENT_OCCLUSION 1 #define ASE_SRP_VERSION 70403 #pragma shader_feature _SURFACE_TYPE_TRANSPARENT #pragma shader_feature_local _DOUBLESIDED_ON #pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY #pragma shader_feature_local _ENABLE_FOG_ON_TRANSPARENT #pragma shader_feature_local _ALPHATEST_ON #define SHADERPASS SHADERPASS_SHADOWS #pragma vertex Vert #pragma fragment Frag //#define UNITY_MATERIAL_LIT #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) #define OUTPUT_SPLIT_LIGHTING #endif #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" //#define USE_LEGACY_UNITY_MATRIX_VARIABLES #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" #ifdef DEBUG_DISPLAY #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" #endif #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" #pragma shader_feature_local _USEALPHACUTOUT_ON #if defined(_DOUBLESIDED_ON) && !defined(ASE_NEED_CULLFACE) #define ASE_NEED_CULLFACE 1 #endif struct AttributesMesh { float3 positionOS : POSITION; float3 normalOS : NORMAL; float4 ase_texcoord : TEXCOORD0; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct PackedVaryingsMeshToPS { float4 positionCS : SV_Position; float3 interp00 : TEXCOORD0; float4 ase_texcoord1 : TEXCOORD1; float4 ase_texcoord2 : TEXCOORD2; UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO #if defined(SHADER_STAGE_FRAGMENT) && defined(ASE_NEED_CULLFACE) FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; #endif }; CBUFFER_START( UnityPerMaterial ) float4 _BC_ST; float4 _EmissiveColor2; float4 _EmissiveColor4; float4 _EmissiveMask1_ST; float4 _EmissiveColor5; float4 _Roughness_ST; float4 _Metallic_ST; float4 _Normal_ST; float4 _Texture04_ST; float4 _Texture03_ST; float4 _Texture02_ST; float4 _Dirt_ST; float4 _EmissiveColor3; float4 _BlendColor01; float4 _Mask_ST; float4 _BlendColor02; float4 _AO_ST; float4 _BlendColor04; float4 _Texture01_ST; float4 _BlendColor03; float2 _PannerProperty1; float _EmissiveBoots4; float _EmissiveBoots5; float _DirtRoughness_Power; float _RoughnessBoost02; float _EmissiveBoots3; float _RoughnessBoost04; float _RoughnessBoost01; float _RoughnessBoost03; float _MetallicBoots04; float _EmissivePannerTilling1; float _Emissivepowerboost1; float _OpacityBoosts; float _MetallicBoots03; float _MetallicBoots02; float _MetallicBoots01; float _DirtBoots; float _BlendColorPower04; float _BlendColorPower03; float _BlendColorPower02; float _BlendColorPower01; float _EmissiveBoots2; float _DitherBoosts; float4 _EmissionColor; float _AlphaCutoff; float _RenderQueueType; #ifdef _ADD_PRECOMPUTED_VELOCITY float _AddPrecomputedVelocity; #endif float _StencilRef; float _StencilWriteMask; float _StencilRefDepth; float _StencilWriteMaskDepth; float _StencilRefMV; float _StencilWriteMaskMV; float _StencilRefDistortionVec; float _StencilWriteMaskDistortionVec; float _StencilWriteMaskGBuffer; float _StencilRefGBuffer; float _ZTestGBuffer; float _RequireSplitLighting; float _ReceivesSSR; float _SurfaceType; float _BlendMode; float _SrcBlend; float _DstBlend; float _AlphaSrcBlend; float _AlphaDstBlend; float _ZWrite; float _TransparentZWrite; float _CullMode; float _TransparentSortPriority; float _EnableFogOnTransparent; float _CullModeForward; float _TransparentCullMode; float _ZTestDepthEqualForOpaque; float _ZTestTransparent; float _TransparentBackfaceEnable; float _AlphaCutoffEnable; float _UseShadowThreshold; float _DoubleSidedEnable; float _DoubleSidedNormalMode; float4 _DoubleSidedConstants; #ifdef TESSELLATION_ON float _TessPhongStrength; float _TessValue; float _TessMin; float _TessMax; float _TessEdgeLength; float _TessMaxDisp; #endif CBUFFER_END sampler2D _BC; SAMPLER(sampler_BC); inline float Dither4x4Bayer( int x, int y ) { const float dither[ 16 ] = { 1, 9, 3, 11, 13, 5, 15, 7, 4, 12, 2, 10, 16, 8, 14, 6 }; int r = y * 4 + x; return dither[r] / 16; // same # of instructions as pre-dividing due to compiler magic } void BuildSurfaceData(FragInputs fragInputs, inout AlphaSurfaceDescription surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) { ZERO_INITIALIZE(SurfaceData, surfaceData); surfaceData.specularOcclusion = 1.0; // surface data // refraction #ifdef _HAS_REFRACTION if( _EnableSSRefraction ) { surfaceData.transmittanceMask = ( 1.0 - surfaceDescription.Alpha ); surfaceDescription.Alpha = 1.0; } else { surfaceData.ior = 1.0; surfaceData.transmittanceColor = float3( 1.0, 1.0, 1.0 ); surfaceData.atDistance = 1.0; surfaceData.transmittanceMask = 0.0; surfaceDescription.Alpha = 1.0; } #else surfaceData.ior = 1.0; surfaceData.transmittanceColor = float3( 1.0, 1.0, 1.0 ); surfaceData.atDistance = 1.0; surfaceData.transmittanceMask = 0.0; #endif // material features surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; #endif #ifdef _MATERIAL_FEATURE_TRANSMISSION surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; #endif #ifdef _MATERIAL_FEATURE_ANISOTROPY surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; #endif #ifdef ASE_LIT_CLEAR_COAT surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; #endif #ifdef _MATERIAL_FEATURE_IRIDESCENCE surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; #endif #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; #endif // others #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) surfaceData.baseColor *= ( 1.0 - Max3( surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b ) ); #endif #ifdef _DOUBLESIDED_ON float3 doubleSidedConstants = _DoubleSidedConstants.xyz; #else float3 doubleSidedConstants = float3( 1.0, 1.0, 1.0 ); #endif // normals float3 normalTS = float3(0.0f, 0.0f, 1.0f); GetNormalWS( fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants ); surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; bentNormalWS = surfaceData.normalWS; surfaceData.tangentWS = normalize( fragInputs.tangentToWorld[ 0 ].xyz ); surfaceData.tangentWS = Orthonormalize( surfaceData.tangentWS, surfaceData.normalWS ); // decals #if HAVE_DECALS if( _EnableDecals ) { DecalSurfaceData decalSurfaceData = GetDecalSurfaceData( posInput, surfaceDescription.Alpha ); ApplyDecalToSurfaceData( decalSurfaceData, surfaceData ); } #endif #if defined(_SPECULAR_OCCLUSION_CUSTOM) #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO( V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness( surfaceData.perceptualSmoothness ) ); #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion( ClampNdotV( dot( surfaceData.normalWS, V ) ), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness( surfaceData.perceptualSmoothness ) ); #endif // debug #if defined(DEBUG_DISPLAY) if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) { surfaceData.metallic = 0; } ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); #endif } void GetSurfaceAndBuiltinData(AlphaSurfaceDescription surfaceDescription, FragInputs fragInputs, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData) { #ifdef LOD_FADE_CROSSFADE LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); #endif #ifdef _DOUBLESIDED_ON float3 doubleSidedConstants = _DoubleSidedConstants.xyz; #else float3 doubleSidedConstants = float3( 1.0, 1.0, 1.0 ); #endif ApplyDoubleSidedFlipOrMirror( fragInputs, doubleSidedConstants ); #ifdef _ALPHATEST_ON #ifdef _ALPHATEST_SHADOW_ON DoAlphaTest( surfaceDescription.Alpha, surfaceDescription.AlphaClipThresholdShadow ); #else DoAlphaTest( surfaceDescription.Alpha, surfaceDescription.AlphaClipThreshold ); #endif #endif #ifdef _DEPTHOFFSET_ON builtinData.depthOffset = surfaceDescription.DepthOffset; ApplyDepthOffsetPositionInput( V, surfaceDescription.DepthOffset, GetViewForwardDir(), GetWorldToHClipMatrix(), posInput ); #endif float3 bentNormalWS; BuildSurfaceData( fragInputs, surfaceDescription, V, posInput, surfaceData, bentNormalWS ); InitBuiltinData( posInput, surfaceDescription.Alpha, bentNormalWS, -fragInputs.tangentToWorld[ 2 ], fragInputs.texCoord1, fragInputs.texCoord2, builtinData ); PostInitBuiltinData(V, posInput, surfaceData, builtinData); } PackedVaryingsMeshToPS VertexFunction(AttributesMesh inputMesh ) { PackedVaryingsMeshToPS outputPackedVaryingsMeshToPS; UNITY_SETUP_INSTANCE_ID(inputMesh); UNITY_TRANSFER_INSTANCE_ID(inputMesh, outputPackedVaryingsMeshToPS); UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( outputPackedVaryingsMeshToPS ); float4 ase_clipPos = TransformWorldToHClip( TransformObjectToWorld(inputMesh.positionOS)); float4 screenPos = ComputeScreenPos( ase_clipPos , _ProjectionParams.x ); outputPackedVaryingsMeshToPS.ase_texcoord2 = screenPos; outputPackedVaryingsMeshToPS.ase_texcoord1.xy = inputMesh.ase_texcoord.xy; //setting value to unused interpolator channels and avoid initialization warnings outputPackedVaryingsMeshToPS.ase_texcoord1.zw = 0; #ifdef ASE_ABSOLUTE_VERTEX_POS float3 defaultVertexValue = inputMesh.positionOS.xyz; #else float3 defaultVertexValue = float3( 0, 0, 0 ); #endif float3 vertexValue = defaultVertexValue ; #ifdef ASE_ABSOLUTE_VERTEX_POS inputMesh.positionOS.xyz = vertexValue; #else inputMesh.positionOS.xyz += vertexValue; #endif inputMesh.normalOS = inputMesh.normalOS ; float3 positionRWS = TransformObjectToWorld(inputMesh.positionOS); outputPackedVaryingsMeshToPS.positionCS = TransformWorldToHClip(positionRWS); outputPackedVaryingsMeshToPS.interp00.xyz = positionRWS; return outputPackedVaryingsMeshToPS; } #if defined(TESSELLATION_ON) struct VertexControl { float3 positionOS : INTERNALTESSPOS; float3 normalOS : NORMAL; float4 ase_texcoord : TEXCOORD0; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct TessellationFactors { float edge[3] : SV_TessFactor; float inside : SV_InsideTessFactor; }; VertexControl Vert ( AttributesMesh v ) { VertexControl o; UNITY_SETUP_INSTANCE_ID(v); UNITY_TRANSFER_INSTANCE_ID(v, o); o.positionOS = v.positionOS; o.normalOS = v.normalOS; o.ase_texcoord = v.ase_texcoord; return o; } TessellationFactors TessellationFunction (InputPatch v) { TessellationFactors o; float4 tf = 1; float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; #if (SHADEROPTIONS_CAMERA_RELATIVE_RENDERING != 0) float3 cameraPos = 0; #else float3 cameraPos = _WorldSpaceCameraPos; #endif #if defined(ASE_FIXED_TESSELLATION) tf = FixedTess( tessValue ); #elif defined(ASE_DISTANCE_TESSELLATION) tf = DistanceBasedTess(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), cameraPos ); #elif defined(ASE_LENGTH_TESSELLATION) tf = EdgeLengthBasedTess(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), edgeLength, GetObjectToWorldMatrix(), cameraPos, _ScreenParams ); #elif defined(ASE_LENGTH_CULL_TESSELLATION) tf = EdgeLengthBasedTessCull(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), cameraPos, _ScreenParams, _FrustumPlanes ); #endif o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; return o; } [domain("tri")] [partitioning("fractional_odd")] [outputtopology("triangle_cw")] [patchconstantfunc("TessellationFunction")] [outputcontrolpoints(3)] VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) { return patch[id]; } [domain("tri")] PackedVaryingsMeshToPS DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) { AttributesMesh o = (AttributesMesh) 0; o.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; o.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; #if defined(ASE_PHONG_TESSELLATION) float3 pp[3]; for (int i = 0; i < 3; ++i) pp[i] = o.positionOS.xyz - patch[i].normalOS * (dot(o.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); float phongStrength = _TessPhongStrength; o.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.positionOS.xyz; #endif UNITY_TRANSFER_INSTANCE_ID(patch[0], o); return VertexFunction(o); } #else PackedVaryingsMeshToPS Vert ( AttributesMesh v ) { return VertexFunction( v ); } #endif void Frag( PackedVaryingsMeshToPS packedInput #ifdef WRITE_NORMAL_BUFFER , out float4 outNormalBuffer : SV_Target0 #ifdef WRITE_MSAA_DEPTH , out float1 depthColor : SV_Target1 #endif #elif defined(WRITE_MSAA_DEPTH) , out float4 outNormalBuffer : SV_Target0 , out float1 depthColor : SV_Target1 #elif defined(SCENESELECTIONPASS) , out float4 outColor : SV_Target0 #endif #ifdef _DEPTHOFFSET_ON , out float outputDepth : SV_Depth #endif ) { UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( packedInput ); UNITY_SETUP_INSTANCE_ID( packedInput ); float3 positionRWS = packedInput.interp00.xyz; FragInputs input; ZERO_INITIALIZE(FragInputs, input); input.tangentToWorld = k_identity3x3; input.positionSS = packedInput.positionCS; input.positionRWS = positionRWS; #if _DOUBLESIDED_ON && SHADER_STAGE_FRAGMENT input.isFrontFace = IS_FRONT_VFACE( packedInput.cullFace, true, false); #elif SHADER_STAGE_FRAGMENT #if defined(ASE_NEED_CULLFACE) input.isFrontFace = IS_FRONT_VFACE( packedInput.cullFace, true, false ); #endif #endif half isFrontFace = input.isFrontFace; PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); AlphaSurfaceDescription surfaceDescription = (AlphaSurfaceDescription)0; float4 color219 = IsGammaSpace() ? float4(1,1,1,0) : float4(1,1,1,0); float2 uv_BC = packedInput.ase_texcoord1.xy * _BC_ST.xy + _BC_ST.zw; float4 tex2DNode1 = tex2D( _BC, uv_BC ); float4 temp_cast_0 = (( tex2DNode1.a * _OpacityBoosts )).xxxx; #ifdef _USEALPHACUTOUT_ON float4 staticSwitch218 = temp_cast_0; #else float4 staticSwitch218 = color219; #endif float4 screenPos = packedInput.ase_texcoord2; float4 ase_screenPosNorm = screenPos / screenPos.w; ase_screenPosNorm.z = ( UNITY_NEAR_CLIP_VALUE >= 0 ) ? ase_screenPosNorm.z : ase_screenPosNorm.z * 0.5 + 0.5; float2 clipScreen212 = ase_screenPosNorm.xy * _ScreenParams.xy; float dither212 = Dither4x4Bayer( fmod(clipScreen212.x, 4), fmod(clipScreen212.y, 4) ); dither212 = step( dither212, ( tex2DNode1.a * _DitherBoosts ) ); surfaceDescription.Alpha = staticSwitch218.r; #ifdef _ALPHATEST_ON surfaceDescription.AlphaClipThreshold = ( 1.0 - dither212 ); #endif #ifdef _ALPHATEST_SHADOW_ON surfaceDescription.AlphaClipThresholdShadow = 0.5; #endif #ifdef _DEPTHOFFSET_ON surfaceDescription.DepthOffset = 0; #endif SurfaceData surfaceData; BuiltinData builtinData; GetSurfaceAndBuiltinData(surfaceDescription, input, V, posInput, surfaceData, builtinData); #ifdef _DEPTHOFFSET_ON outputDepth = posInput.deviceDepth; #endif #ifdef WRITE_NORMAL_BUFFER EncodeIntoNormalBuffer( ConvertSurfaceDataToNormalData( surfaceData ), posInput.positionSS, outNormalBuffer ); #ifdef WRITE_MSAA_DEPTH depthColor = packedInput.positionCS.z; #endif #elif defined(WRITE_MSAA_DEPTH) outNormalBuffer = float4( 0.0, 0.0, 0.0, 1.0 ); depthColor = packedInput.positionCS.z; #elif defined(SCENESELECTIONPASS) outColor = float4( _ObjectId, _PassValue, 1.0, 1.0 ); #endif } ENDHLSL } Pass { Name "SceneSelectionPass" Tags { "LightMode"="SceneSelectionPass" } ColorMask 0 HLSLPROGRAM #define _SPECULAR_OCCLUSION_FROM_AO 1 #define _AMBIENT_OCCLUSION 1 #define ASE_SRP_VERSION 70403 #pragma shader_feature _SURFACE_TYPE_TRANSPARENT #pragma shader_feature_local _DOUBLESIDED_ON #pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY #pragma shader_feature_local _ENABLE_FOG_ON_TRANSPARENT #pragma shader_feature_local _ALPHATEST_ON #define SHADERPASS SHADERPASS_DEPTH_ONLY #define SCENESELECTIONPASS #pragma editor_sync_compilation #pragma vertex Vert #pragma fragment Frag //#define UNITY_MATERIAL_LIT #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) #define OUTPUT_SPLIT_LIGHTING #endif #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" #ifdef DEBUG_DISPLAY #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" #endif #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" #pragma shader_feature_local _USEALPHACUTOUT_ON #if defined(_DOUBLESIDED_ON) && !defined(ASE_NEED_CULLFACE) #define ASE_NEED_CULLFACE 1 #endif struct AttributesMesh { float3 positionOS : POSITION; float3 normalOS : NORMAL; float4 ase_texcoord : TEXCOORD0; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct PackedVaryingsMeshToPS { float4 positionCS : SV_Position; float3 interp00 : TEXCOORD0; float4 ase_texcoord1 : TEXCOORD1; float4 ase_texcoord2 : TEXCOORD2; UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO #if defined(SHADER_STAGE_FRAGMENT) && defined(ASE_NEED_CULLFACE) FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; #endif }; int _ObjectId; int _PassValue; CBUFFER_START( UnityPerMaterial ) float4 _BC_ST; float4 _EmissiveColor2; float4 _EmissiveColor4; float4 _EmissiveMask1_ST; float4 _EmissiveColor5; float4 _Roughness_ST; float4 _Metallic_ST; float4 _Normal_ST; float4 _Texture04_ST; float4 _Texture03_ST; float4 _Texture02_ST; float4 _Dirt_ST; float4 _EmissiveColor3; float4 _BlendColor01; float4 _Mask_ST; float4 _BlendColor02; float4 _AO_ST; float4 _BlendColor04; float4 _Texture01_ST; float4 _BlendColor03; float2 _PannerProperty1; float _EmissiveBoots4; float _EmissiveBoots5; float _DirtRoughness_Power; float _RoughnessBoost02; float _EmissiveBoots3; float _RoughnessBoost04; float _RoughnessBoost01; float _RoughnessBoost03; float _MetallicBoots04; float _EmissivePannerTilling1; float _Emissivepowerboost1; float _OpacityBoosts; float _MetallicBoots03; float _MetallicBoots02; float _MetallicBoots01; float _DirtBoots; float _BlendColorPower04; float _BlendColorPower03; float _BlendColorPower02; float _BlendColorPower01; float _EmissiveBoots2; float _DitherBoosts; float4 _EmissionColor; float _AlphaCutoff; float _RenderQueueType; #ifdef _ADD_PRECOMPUTED_VELOCITY float _AddPrecomputedVelocity; #endif float _StencilRef; float _StencilWriteMask; float _StencilRefDepth; float _StencilWriteMaskDepth; float _StencilRefMV; float _StencilWriteMaskMV; float _StencilRefDistortionVec; float _StencilWriteMaskDistortionVec; float _StencilWriteMaskGBuffer; float _StencilRefGBuffer; float _ZTestGBuffer; float _RequireSplitLighting; float _ReceivesSSR; float _SurfaceType; float _BlendMode; float _SrcBlend; float _DstBlend; float _AlphaSrcBlend; float _AlphaDstBlend; float _ZWrite; float _TransparentZWrite; float _CullMode; float _TransparentSortPriority; float _EnableFogOnTransparent; float _CullModeForward; float _TransparentCullMode; float _ZTestDepthEqualForOpaque; float _ZTestTransparent; float _TransparentBackfaceEnable; float _AlphaCutoffEnable; float _UseShadowThreshold; float _DoubleSidedEnable; float _DoubleSidedNormalMode; float4 _DoubleSidedConstants; #ifdef TESSELLATION_ON float _TessPhongStrength; float _TessValue; float _TessMin; float _TessMax; float _TessEdgeLength; float _TessMaxDisp; #endif CBUFFER_END sampler2D _BC; SAMPLER(sampler_BC); inline float Dither4x4Bayer( int x, int y ) { const float dither[ 16 ] = { 1, 9, 3, 11, 13, 5, 15, 7, 4, 12, 2, 10, 16, 8, 14, 6 }; int r = y * 4 + x; return dither[r] / 16; // same # of instructions as pre-dividing due to compiler magic } void BuildSurfaceData(FragInputs fragInputs, inout SceneSurfaceDescription surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) { ZERO_INITIALIZE(SurfaceData, surfaceData); surfaceData.specularOcclusion = 1.0; // surface data // refraction #ifdef _HAS_REFRACTION if( _EnableSSRefraction ) { surfaceData.transmittanceMask = ( 1.0 - surfaceDescription.Alpha ); surfaceDescription.Alpha = 1.0; } else { surfaceData.ior = 1.0; surfaceData.transmittanceColor = float3( 1.0, 1.0, 1.0 ); surfaceData.atDistance = 1.0; surfaceData.transmittanceMask = 0.0; surfaceDescription.Alpha = 1.0; } #else surfaceData.ior = 1.0; surfaceData.transmittanceColor = float3( 1.0, 1.0, 1.0 ); surfaceData.atDistance = 1.0; surfaceData.transmittanceMask = 0.0; #endif // material features surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; #endif #ifdef _MATERIAL_FEATURE_TRANSMISSION surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; #endif #ifdef _MATERIAL_FEATURE_ANISOTROPY surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; #endif #ifdef ASE_LIT_CLEAR_COAT surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; #endif #ifdef _MATERIAL_FEATURE_IRIDESCENCE surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; #endif #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; #endif // others #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) surfaceData.baseColor *= ( 1.0 - Max3( surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b ) ); #endif #ifdef _DOUBLESIDED_ON float3 doubleSidedConstants = _DoubleSidedConstants.xyz; #else float3 doubleSidedConstants = float3( 1.0, 1.0, 1.0 ); #endif // normals float3 normalTS = float3(0.0f, 0.0f, 1.0f); GetNormalWS( fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants ); surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; bentNormalWS = surfaceData.normalWS; surfaceData.tangentWS = normalize( fragInputs.tangentToWorld[ 0 ].xyz ); surfaceData.tangentWS = Orthonormalize( surfaceData.tangentWS, surfaceData.normalWS ); // decals #if HAVE_DECALS if( _EnableDecals ) { DecalSurfaceData decalSurfaceData = GetDecalSurfaceData( posInput, surfaceDescription.Alpha ); ApplyDecalToSurfaceData( decalSurfaceData, surfaceData ); } #endif #if defined(_SPECULAR_OCCLUSION_CUSTOM) #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO( V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness( surfaceData.perceptualSmoothness ) ); #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion( ClampNdotV( dot( surfaceData.normalWS, V ) ), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness( surfaceData.perceptualSmoothness ) ); #endif // debug #if defined(DEBUG_DISPLAY) if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) { surfaceData.metallic = 0; } ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); #endif } void GetSurfaceAndBuiltinData(SceneSurfaceDescription surfaceDescription, FragInputs fragInputs, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData) { #ifdef LOD_FADE_CROSSFADE LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); #endif #ifdef _DOUBLESIDED_ON float3 doubleSidedConstants = _DoubleSidedConstants.xyz; #else float3 doubleSidedConstants = float3( 1.0, 1.0, 1.0 ); #endif ApplyDoubleSidedFlipOrMirror( fragInputs, doubleSidedConstants ); #ifdef _ALPHATEST_ON DoAlphaTest( surfaceDescription.Alpha, surfaceDescription.AlphaClipThreshold ); #endif #ifdef _DEPTHOFFSET_ON builtinData.depthOffset = surfaceDescription.DepthOffset; ApplyDepthOffsetPositionInput( V, surfaceDescription.DepthOffset, GetViewForwardDir(), GetWorldToHClipMatrix(), posInput ); #endif float3 bentNormalWS; BuildSurfaceData( fragInputs, surfaceDescription, V, posInput, surfaceData, bentNormalWS ); InitBuiltinData( posInput, surfaceDescription.Alpha, bentNormalWS, -fragInputs.tangentToWorld[ 2 ], fragInputs.texCoord1, fragInputs.texCoord2, builtinData ); PostInitBuiltinData(V, posInput, surfaceData, builtinData); } PackedVaryingsMeshToPS VertexFunction(AttributesMesh inputMesh ) { PackedVaryingsMeshToPS outputPackedVaryingsMeshToPS; UNITY_SETUP_INSTANCE_ID(inputMesh); UNITY_TRANSFER_INSTANCE_ID(inputMesh, outputPackedVaryingsMeshToPS); UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( outputPackedVaryingsMeshToPS ); float4 ase_clipPos = TransformWorldToHClip( TransformObjectToWorld(inputMesh.positionOS)); float4 screenPos = ComputeScreenPos( ase_clipPos , _ProjectionParams.x ); outputPackedVaryingsMeshToPS.ase_texcoord2 = screenPos; outputPackedVaryingsMeshToPS.ase_texcoord1.xy = inputMesh.ase_texcoord.xy; //setting value to unused interpolator channels and avoid initialization warnings outputPackedVaryingsMeshToPS.ase_texcoord1.zw = 0; #ifdef ASE_ABSOLUTE_VERTEX_POS float3 defaultVertexValue = inputMesh.positionOS.xyz; #else float3 defaultVertexValue = float3( 0, 0, 0 ); #endif float3 vertexValue = defaultVertexValue ; #ifdef ASE_ABSOLUTE_VERTEX_POS inputMesh.positionOS.xyz = vertexValue; #else inputMesh.positionOS.xyz += vertexValue; #endif inputMesh.normalOS = inputMesh.normalOS ; float3 positionRWS = TransformObjectToWorld(inputMesh.positionOS); outputPackedVaryingsMeshToPS.positionCS = TransformWorldToHClip(positionRWS); outputPackedVaryingsMeshToPS.interp00.xyz = positionRWS; return outputPackedVaryingsMeshToPS; } #if defined(TESSELLATION_ON) struct VertexControl { float3 positionOS : INTERNALTESSPOS; float3 normalOS : NORMAL; float4 ase_texcoord : TEXCOORD0; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct TessellationFactors { float edge[3] : SV_TessFactor; float inside : SV_InsideTessFactor; }; VertexControl Vert ( AttributesMesh v ) { VertexControl o; UNITY_SETUP_INSTANCE_ID(v); UNITY_TRANSFER_INSTANCE_ID(v, o); o.positionOS = v.positionOS; o.normalOS = v.normalOS; o.ase_texcoord = v.ase_texcoord; return o; } TessellationFactors TessellationFunction (InputPatch v) { TessellationFactors o; float4 tf = 1; float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; #if (SHADEROPTIONS_CAMERA_RELATIVE_RENDERING != 0) float3 cameraPos = 0; #else float3 cameraPos = _WorldSpaceCameraPos; #endif #if defined(ASE_FIXED_TESSELLATION) tf = FixedTess( tessValue ); #elif defined(ASE_DISTANCE_TESSELLATION) tf = DistanceBasedTess(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), cameraPos ); #elif defined(ASE_LENGTH_TESSELLATION) tf = EdgeLengthBasedTess(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), edgeLength, GetObjectToWorldMatrix(), cameraPos, _ScreenParams ); #elif defined(ASE_LENGTH_CULL_TESSELLATION) tf = EdgeLengthBasedTessCull(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), cameraPos, _ScreenParams, _FrustumPlanes ); #endif o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; return o; } [domain("tri")] [partitioning("fractional_odd")] [outputtopology("triangle_cw")] [patchconstantfunc("TessellationFunction")] [outputcontrolpoints(3)] VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) { return patch[id]; } [domain("tri")] PackedVaryingsMeshToPS DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) { AttributesMesh o = (AttributesMesh) 0; o.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; o.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; #if defined(ASE_PHONG_TESSELLATION) float3 pp[3]; for (int i = 0; i < 3; ++i) pp[i] = o.positionOS.xyz - patch[i].normalOS * (dot(o.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); float phongStrength = _TessPhongStrength; o.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.positionOS.xyz; #endif UNITY_TRANSFER_INSTANCE_ID(patch[0], o); return VertexFunction(o); } #else PackedVaryingsMeshToPS Vert ( AttributesMesh v ) { return VertexFunction( v ); } #endif void Frag( PackedVaryingsMeshToPS packedInput #ifdef WRITE_NORMAL_BUFFER , out float4 outNormalBuffer : SV_Target0 #ifdef WRITE_MSAA_DEPTH , out float1 depthColor : SV_Target1 #endif #elif defined(WRITE_MSAA_DEPTH) , out float4 outNormalBuffer : SV_Target0 , out float1 depthColor : SV_Target1 #elif defined(SCENESELECTIONPASS) , out float4 outColor : SV_Target0 #endif #ifdef _DEPTHOFFSET_ON , out float outputDepth : SV_Depth #endif ) { UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( packedInput ); UNITY_SETUP_INSTANCE_ID( packedInput ); float3 positionRWS = packedInput.interp00.xyz; FragInputs input; ZERO_INITIALIZE(FragInputs, input); input.tangentToWorld = k_identity3x3; input.positionSS = packedInput.positionCS; input.positionRWS = positionRWS; #if _DOUBLESIDED_ON && SHADER_STAGE_FRAGMENT input.isFrontFace = IS_FRONT_VFACE( packedInput.cullFace, true, false); #elif SHADER_STAGE_FRAGMENT #if defined(ASE_NEED_CULLFACE) input.isFrontFace = IS_FRONT_VFACE( packedInput.cullFace, true, false ); #endif #endif half isFrontFace = input.isFrontFace; PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); SceneSurfaceDescription surfaceDescription = (SceneSurfaceDescription)0; float4 color219 = IsGammaSpace() ? float4(1,1,1,0) : float4(1,1,1,0); float2 uv_BC = packedInput.ase_texcoord1.xy * _BC_ST.xy + _BC_ST.zw; float4 tex2DNode1 = tex2D( _BC, uv_BC ); float4 temp_cast_0 = (( tex2DNode1.a * _OpacityBoosts )).xxxx; #ifdef _USEALPHACUTOUT_ON float4 staticSwitch218 = temp_cast_0; #else float4 staticSwitch218 = color219; #endif float4 screenPos = packedInput.ase_texcoord2; float4 ase_screenPosNorm = screenPos / screenPos.w; ase_screenPosNorm.z = ( UNITY_NEAR_CLIP_VALUE >= 0 ) ? ase_screenPosNorm.z : ase_screenPosNorm.z * 0.5 + 0.5; float2 clipScreen212 = ase_screenPosNorm.xy * _ScreenParams.xy; float dither212 = Dither4x4Bayer( fmod(clipScreen212.x, 4), fmod(clipScreen212.y, 4) ); dither212 = step( dither212, ( tex2DNode1.a * _DitherBoosts ) ); surfaceDescription.Alpha = staticSwitch218.r; #ifdef _ALPHATEST_ON surfaceDescription.AlphaClipThreshold = ( 1.0 - dither212 ); #endif #ifdef _DEPTHOFFSET_ON surfaceDescription.DepthOffset = 0; #endif SurfaceData surfaceData; BuiltinData builtinData; GetSurfaceAndBuiltinData(surfaceDescription, input, V, posInput, surfaceData, builtinData); #ifdef _DEPTHOFFSET_ON outputDepth = posInput.deviceDepth; #endif #ifdef WRITE_NORMAL_BUFFER EncodeIntoNormalBuffer( ConvertSurfaceDataToNormalData( surfaceData ), posInput.positionSS, outNormalBuffer ); #ifdef WRITE_MSAA_DEPTH depthColor = packedInput.positionCS.z; #endif #elif defined(WRITE_MSAA_DEPTH) outNormalBuffer = float4( 0.0, 0.0, 0.0, 1.0 ); depthColor = packedInput.positionCS.z; #elif defined(SCENESELECTIONPASS) outColor = float4( _ObjectId, _PassValue, 1.0, 1.0 ); #endif } ENDHLSL } Pass { Name "DepthOnly" Tags { "LightMode"="DepthOnly" } Cull [_CullMode] ZWrite On Stencil { Ref [_StencilRefDepth] WriteMask [_StencilWriteMaskDepth] Comp Always Pass Replace Fail Keep ZFail Keep } HLSLPROGRAM #define _SPECULAR_OCCLUSION_FROM_AO 1 #define _AMBIENT_OCCLUSION 1 #define ASE_SRP_VERSION 70403 #pragma shader_feature _SURFACE_TYPE_TRANSPARENT #pragma shader_feature_local _DOUBLESIDED_ON #pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY #pragma shader_feature_local _ENABLE_FOG_ON_TRANSPARENT #pragma shader_feature_local _ALPHATEST_ON #define SHADERPASS SHADERPASS_DEPTH_ONLY #pragma multi_compile _ WRITE_NORMAL_BUFFER #pragma multi_compile _ WRITE_MSAA_DEPTH #pragma vertex Vert #pragma fragment Frag //#define UNITY_MATERIAL_LIT #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) #define OUTPUT_SPLIT_LIGHTING #endif #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" #ifdef DEBUG_DISPLAY #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" #endif #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" #pragma shader_feature_local _USEALPHACUTOUT_ON #if defined(_DOUBLESIDED_ON) && !defined(ASE_NEED_CULLFACE) #define ASE_NEED_CULLFACE 1 #endif struct AttributesMesh { float3 positionOS : POSITION; float3 normalOS : NORMAL; float4 tangentOS : TANGENT; float4 ase_texcoord : TEXCOORD0; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct PackedVaryingsMeshToPS { float4 positionCS : SV_Position; float3 interp00 : TEXCOORD0; float3 interp01 : TEXCOORD1; float4 interp02 : TEXCOORD2; float4 ase_texcoord3 : TEXCOORD3; float4 ase_texcoord4 : TEXCOORD4; UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO #if defined(SHADER_STAGE_FRAGMENT) && defined(ASE_NEED_CULLFACE) FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; #endif }; CBUFFER_START( UnityPerMaterial ) float4 _BC_ST; float4 _EmissiveColor2; float4 _EmissiveColor4; float4 _EmissiveMask1_ST; float4 _EmissiveColor5; float4 _Roughness_ST; float4 _Metallic_ST; float4 _Normal_ST; float4 _Texture04_ST; float4 _Texture03_ST; float4 _Texture02_ST; float4 _Dirt_ST; float4 _EmissiveColor3; float4 _BlendColor01; float4 _Mask_ST; float4 _BlendColor02; float4 _AO_ST; float4 _BlendColor04; float4 _Texture01_ST; float4 _BlendColor03; float2 _PannerProperty1; float _EmissiveBoots4; float _EmissiveBoots5; float _DirtRoughness_Power; float _RoughnessBoost02; float _EmissiveBoots3; float _RoughnessBoost04; float _RoughnessBoost01; float _RoughnessBoost03; float _MetallicBoots04; float _EmissivePannerTilling1; float _Emissivepowerboost1; float _OpacityBoosts; float _MetallicBoots03; float _MetallicBoots02; float _MetallicBoots01; float _DirtBoots; float _BlendColorPower04; float _BlendColorPower03; float _BlendColorPower02; float _BlendColorPower01; float _EmissiveBoots2; float _DitherBoosts; float4 _EmissionColor; float _AlphaCutoff; float _RenderQueueType; #ifdef _ADD_PRECOMPUTED_VELOCITY float _AddPrecomputedVelocity; #endif float _StencilRef; float _StencilWriteMask; float _StencilRefDepth; float _StencilWriteMaskDepth; float _StencilRefMV; float _StencilWriteMaskMV; float _StencilRefDistortionVec; float _StencilWriteMaskDistortionVec; float _StencilWriteMaskGBuffer; float _StencilRefGBuffer; float _ZTestGBuffer; float _RequireSplitLighting; float _ReceivesSSR; float _SurfaceType; float _BlendMode; float _SrcBlend; float _DstBlend; float _AlphaSrcBlend; float _AlphaDstBlend; float _ZWrite; float _TransparentZWrite; float _CullMode; float _TransparentSortPriority; float _EnableFogOnTransparent; float _CullModeForward; float _TransparentCullMode; float _ZTestDepthEqualForOpaque; float _ZTestTransparent; float _TransparentBackfaceEnable; float _AlphaCutoffEnable; float _UseShadowThreshold; float _DoubleSidedEnable; float _DoubleSidedNormalMode; float4 _DoubleSidedConstants; #ifdef TESSELLATION_ON float _TessPhongStrength; float _TessValue; float _TessMin; float _TessMax; float _TessEdgeLength; float _TessMaxDisp; #endif CBUFFER_END sampler2D _Normal; sampler2D _Roughness; sampler2D _Mask; SAMPLER(sampler_Mask); sampler2D _Dirt; SAMPLER(sampler_Dirt); sampler2D _BC; SAMPLER(sampler_BC); inline float Dither4x4Bayer( int x, int y ) { const float dither[ 16 ] = { 1, 9, 3, 11, 13, 5, 15, 7, 4, 12, 2, 10, 16, 8, 14, 6 }; int r = y * 4 + x; return dither[r] / 16; // same # of instructions as pre-dividing due to compiler magic } void BuildSurfaceData(FragInputs fragInputs, inout SmoothSurfaceDescription surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) { ZERO_INITIALIZE(SurfaceData, surfaceData); surfaceData.specularOcclusion = 1.0; // surface data surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; // refraction #ifdef _HAS_REFRACTION if( _EnableSSRefraction ) { surfaceData.transmittanceMask = ( 1.0 - surfaceDescription.Alpha ); surfaceDescription.Alpha = 1.0; } else { surfaceData.ior = 1.0; surfaceData.transmittanceColor = float3( 1.0, 1.0, 1.0 ); surfaceData.atDistance = 1.0; surfaceData.transmittanceMask = 0.0; surfaceDescription.Alpha = 1.0; } #else surfaceData.ior = 1.0; surfaceData.transmittanceColor = float3( 1.0, 1.0, 1.0 ); surfaceData.atDistance = 1.0; surfaceData.transmittanceMask = 0.0; #endif // material features surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; #endif #ifdef _MATERIAL_FEATURE_TRANSMISSION surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; #endif #ifdef _MATERIAL_FEATURE_ANISOTROPY surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; #endif #ifdef ASE_LIT_CLEAR_COAT surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; #endif #ifdef _MATERIAL_FEATURE_IRIDESCENCE surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; #endif #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; #endif // others #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) surfaceData.baseColor *= ( 1.0 - Max3( surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b ) ); #endif #ifdef _DOUBLESIDED_ON float3 doubleSidedConstants = _DoubleSidedConstants.xyz; #else float3 doubleSidedConstants = float3( 1.0, 1.0, 1.0 ); #endif // normals float3 normalTS = float3(0.0f, 0.0f, 1.0f); normalTS = surfaceDescription.Normal; GetNormalWS( fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants ); surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; bentNormalWS = surfaceData.normalWS; surfaceData.tangentWS = normalize( fragInputs.tangentToWorld[ 0 ].xyz ); surfaceData.tangentWS = Orthonormalize( surfaceData.tangentWS, surfaceData.normalWS ); // decals #if HAVE_DECALS if( _EnableDecals ) { DecalSurfaceData decalSurfaceData = GetDecalSurfaceData( posInput, surfaceDescription.Alpha ); ApplyDecalToSurfaceData( decalSurfaceData, surfaceData ); } #endif #if defined(_SPECULAR_OCCLUSION_CUSTOM) #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO( V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness( surfaceData.perceptualSmoothness ) ); #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion( ClampNdotV( dot( surfaceData.normalWS, V ) ), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness( surfaceData.perceptualSmoothness ) ); #endif // debug #if defined(DEBUG_DISPLAY) if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) { surfaceData.metallic = 0; } ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); #endif } void GetSurfaceAndBuiltinData(SmoothSurfaceDescription surfaceDescription, FragInputs fragInputs, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData) { #ifdef LOD_FADE_CROSSFADE LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); #endif #ifdef _DOUBLESIDED_ON float3 doubleSidedConstants = _DoubleSidedConstants.xyz; #else float3 doubleSidedConstants = float3( 1.0, 1.0, 1.0 ); #endif ApplyDoubleSidedFlipOrMirror( fragInputs, doubleSidedConstants ); #ifdef _ALPHATEST_ON DoAlphaTest( surfaceDescription.Alpha, surfaceDescription.AlphaClipThreshold ); #endif #ifdef _DEPTHOFFSET_ON builtinData.depthOffset = surfaceDescription.DepthOffset; ApplyDepthOffsetPositionInput( V, surfaceDescription.DepthOffset, GetViewForwardDir(), GetWorldToHClipMatrix(), posInput ); #endif float3 bentNormalWS; BuildSurfaceData( fragInputs, surfaceDescription, V, posInput, surfaceData, bentNormalWS ); InitBuiltinData( posInput, surfaceDescription.Alpha, bentNormalWS, -fragInputs.tangentToWorld[ 2 ], fragInputs.texCoord1, fragInputs.texCoord2, builtinData ); PostInitBuiltinData(V, posInput, surfaceData, builtinData); } PackedVaryingsMeshToPS VertexFunction(AttributesMesh inputMesh ) { PackedVaryingsMeshToPS outputPackedVaryingsMeshToPS; UNITY_SETUP_INSTANCE_ID(inputMesh); UNITY_TRANSFER_INSTANCE_ID(inputMesh, outputPackedVaryingsMeshToPS); UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( outputPackedVaryingsMeshToPS ); float4 ase_clipPos = TransformWorldToHClip( TransformObjectToWorld(inputMesh.positionOS)); float4 screenPos = ComputeScreenPos( ase_clipPos , _ProjectionParams.x ); outputPackedVaryingsMeshToPS.ase_texcoord4 = screenPos; outputPackedVaryingsMeshToPS.ase_texcoord3.xy = inputMesh.ase_texcoord.xy; //setting value to unused interpolator channels and avoid initialization warnings outputPackedVaryingsMeshToPS.ase_texcoord3.zw = 0; #ifdef ASE_ABSOLUTE_VERTEX_POS float3 defaultVertexValue = inputMesh.positionOS.xyz; #else float3 defaultVertexValue = float3( 0, 0, 0 ); #endif float3 vertexValue = defaultVertexValue ; #ifdef ASE_ABSOLUTE_VERTEX_POS inputMesh.positionOS.xyz = vertexValue; #else inputMesh.positionOS.xyz += vertexValue; #endif inputMesh.normalOS = inputMesh.normalOS ; inputMesh.tangentOS = inputMesh.tangentOS ; float3 positionRWS = TransformObjectToWorld(inputMesh.positionOS); float3 normalWS = TransformObjectToWorldNormal(inputMesh.normalOS); float4 tangentWS = float4(TransformObjectToWorldDir(inputMesh.tangentOS.xyz), inputMesh.tangentOS.w); outputPackedVaryingsMeshToPS.positionCS = TransformWorldToHClip(positionRWS); outputPackedVaryingsMeshToPS.interp00.xyz = positionRWS; outputPackedVaryingsMeshToPS.interp01.xyz = normalWS; outputPackedVaryingsMeshToPS.interp02.xyzw = tangentWS; return outputPackedVaryingsMeshToPS; } #if defined(TESSELLATION_ON) struct VertexControl { float3 positionOS : INTERNALTESSPOS; float3 normalOS : NORMAL; float4 tangentOS : TANGENT; float4 ase_texcoord : TEXCOORD0; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct TessellationFactors { float edge[3] : SV_TessFactor; float inside : SV_InsideTessFactor; }; VertexControl Vert ( AttributesMesh v ) { VertexControl o; UNITY_SETUP_INSTANCE_ID(v); UNITY_TRANSFER_INSTANCE_ID(v, o); o.positionOS = v.positionOS; o.normalOS = v.normalOS; o.tangentOS = v.tangentOS; o.ase_texcoord = v.ase_texcoord; return o; } TessellationFactors TessellationFunction (InputPatch v) { TessellationFactors o; float4 tf = 1; float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; #if (SHADEROPTIONS_CAMERA_RELATIVE_RENDERING != 0) float3 cameraPos = 0; #else float3 cameraPos = _WorldSpaceCameraPos; #endif #if defined(ASE_FIXED_TESSELLATION) tf = FixedTess( tessValue ); #elif defined(ASE_DISTANCE_TESSELLATION) tf = DistanceBasedTess(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), cameraPos ); #elif defined(ASE_LENGTH_TESSELLATION) tf = EdgeLengthBasedTess(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), edgeLength, GetObjectToWorldMatrix(), cameraPos, _ScreenParams ); #elif defined(ASE_LENGTH_CULL_TESSELLATION) tf = EdgeLengthBasedTessCull(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), cameraPos, _ScreenParams, _FrustumPlanes ); #endif o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; return o; } [domain("tri")] [partitioning("fractional_odd")] [outputtopology("triangle_cw")] [patchconstantfunc("TessellationFunction")] [outputcontrolpoints(3)] VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) { return patch[id]; } [domain("tri")] PackedVaryingsMeshToPS DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) { AttributesMesh o = (AttributesMesh) 0; o.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; o.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; o.tangentOS = patch[0].tangentOS * bary.x + patch[1].tangentOS * bary.y + patch[2].tangentOS * bary.z; o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; #if defined(ASE_PHONG_TESSELLATION) float3 pp[3]; for (int i = 0; i < 3; ++i) pp[i] = o.positionOS.xyz - patch[i].normalOS * (dot(o.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); float phongStrength = _TessPhongStrength; o.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.positionOS.xyz; #endif UNITY_TRANSFER_INSTANCE_ID(patch[0], o); return VertexFunction(o); } #else PackedVaryingsMeshToPS Vert ( AttributesMesh v ) { return VertexFunction( v ); } #endif void Frag( PackedVaryingsMeshToPS packedInput #ifdef WRITE_NORMAL_BUFFER , out float4 outNormalBuffer : SV_Target0 #ifdef WRITE_MSAA_DEPTH , out float1 depthColor : SV_Target1 #endif #elif defined(WRITE_MSAA_DEPTH) , out float4 outNormalBuffer : SV_Target0 , out float1 depthColor : SV_Target1 #elif defined(SCENESELECTIONPASS) , out float4 outColor : SV_Target0 #endif #ifdef _DEPTHOFFSET_ON , out float outputDepth : SV_Depth #endif ) { UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( packedInput ); UNITY_SETUP_INSTANCE_ID( packedInput ); float3 positionRWS = packedInput.interp00.xyz; float3 normalWS = packedInput.interp01.xyz; float4 tangentWS = packedInput.interp02.xyzw; FragInputs input; ZERO_INITIALIZE(FragInputs, input); input.tangentToWorld = k_identity3x3; input.positionSS = packedInput.positionCS; input.positionRWS = positionRWS; input.tangentToWorld = BuildTangentToWorld(tangentWS, normalWS); #if _DOUBLESIDED_ON && SHADER_STAGE_FRAGMENT input.isFrontFace = IS_FRONT_VFACE( packedInput.cullFace, true, false); #elif SHADER_STAGE_FRAGMENT #if defined(ASE_NEED_CULLFACE) input.isFrontFace = IS_FRONT_VFACE( packedInput.cullFace, true, false ); #endif #endif half isFrontFace = input.isFrontFace; PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); SmoothSurfaceDescription surfaceDescription = (SmoothSurfaceDescription)0; float2 uv_Normal = packedInput.ase_texcoord3.xy * _Normal_ST.xy + _Normal_ST.zw; float2 uv_Roughness = packedInput.ase_texcoord3.xy * _Roughness_ST.xy + _Roughness_ST.zw; float4 temp_output_148_0 = ( 1.0 - tex2D( _Roughness, uv_Roughness ) ); float2 uv_Mask = packedInput.ase_texcoord3.xy * _Mask_ST.xy + _Mask_ST.zw; float4 tex2DNode2 = tex2D( _Mask, uv_Mask ); float temp_output_27_0 = ( tex2DNode2.r + tex2DNode2.g + tex2DNode2.b + tex2DNode2.a ); float4 lerpResult119 = lerp( temp_output_148_0 , ( ( ( _RoughnessBoost01 * tex2DNode2.r ) + ( _RoughnessBoost02 * tex2DNode2.g ) + ( _RoughnessBoost03 * tex2DNode2.b ) + ( _RoughnessBoost04 * tex2DNode2.a ) ) * temp_output_148_0 ) , temp_output_27_0); float4 temp_cast_0 = (( _DirtRoughness_Power * _DirtBoots )).xxxx; float2 uv_Dirt = packedInput.ase_texcoord3.xy * _Dirt_ST.xy + _Dirt_ST.zw; float4 tex2DNode80 = tex2D( _Dirt, uv_Dirt ); float4 lerpResult88 = lerp( lerpResult119 , temp_cast_0 , ( _DirtBoots * tex2DNode80.a )); float4 color219 = IsGammaSpace() ? float4(1,1,1,0) : float4(1,1,1,0); float2 uv_BC = packedInput.ase_texcoord3.xy * _BC_ST.xy + _BC_ST.zw; float4 tex2DNode1 = tex2D( _BC, uv_BC ); float4 temp_cast_2 = (( tex2DNode1.a * _OpacityBoosts )).xxxx; #ifdef _USEALPHACUTOUT_ON float4 staticSwitch218 = temp_cast_2; #else float4 staticSwitch218 = color219; #endif float4 screenPos = packedInput.ase_texcoord4; float4 ase_screenPosNorm = screenPos / screenPos.w; ase_screenPosNorm.z = ( UNITY_NEAR_CLIP_VALUE >= 0 ) ? ase_screenPosNorm.z : ase_screenPosNorm.z * 0.5 + 0.5; float2 clipScreen212 = ase_screenPosNorm.xy * _ScreenParams.xy; float dither212 = Dither4x4Bayer( fmod(clipScreen212.x, 4), fmod(clipScreen212.y, 4) ); dither212 = step( dither212, ( tex2DNode1.a * _DitherBoosts ) ); surfaceDescription.Normal = UnpackNormalScale( tex2D( _Normal, uv_Normal ), 1.0f ); surfaceDescription.Smoothness = lerpResult88.r; surfaceDescription.Alpha = staticSwitch218.r; #ifdef _ALPHATEST_ON surfaceDescription.AlphaClipThreshold = ( 1.0 - dither212 ); #endif #ifdef _DEPTHOFFSET_ON surfaceDescription.DepthOffset = 0; #endif SurfaceData surfaceData; BuiltinData builtinData; GetSurfaceAndBuiltinData(surfaceDescription, input, V, posInput, surfaceData, builtinData); #ifdef _DEPTHOFFSET_ON outputDepth = posInput.deviceDepth; #endif #ifdef WRITE_NORMAL_BUFFER EncodeIntoNormalBuffer( ConvertSurfaceDataToNormalData( surfaceData ), posInput.positionSS, outNormalBuffer ); #ifdef WRITE_MSAA_DEPTH depthColor = packedInput.positionCS.z; #endif #elif defined(WRITE_MSAA_DEPTH) outNormalBuffer = float4( 0.0, 0.0, 0.0, 1.0 ); depthColor = packedInput.positionCS.z; #elif defined(SCENESELECTIONPASS) outColor = float4( _ObjectId, _PassValue, 1.0, 1.0 ); #endif } ENDHLSL } Pass { Name "Motion Vectors" Tags { "LightMode"="MotionVectors" } Cull [_CullMode] ZWrite On Stencil { Ref [_StencilRefMV] WriteMask [_StencilWriteMaskMV] Comp Always Pass Replace Fail Keep ZFail Keep } HLSLPROGRAM #define _SPECULAR_OCCLUSION_FROM_AO 1 #define _AMBIENT_OCCLUSION 1 #define ASE_SRP_VERSION 70403 #pragma shader_feature _SURFACE_TYPE_TRANSPARENT #pragma shader_feature_local _DOUBLESIDED_ON #pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY #pragma shader_feature_local _ENABLE_FOG_ON_TRANSPARENT #pragma shader_feature_local _ALPHATEST_ON #define SHADERPASS SHADERPASS_MOTION_VECTORS #pragma multi_compile _ WRITE_NORMAL_BUFFER #pragma multi_compile _ WRITE_MSAA_DEPTH #pragma vertex Vert #pragma fragment Frag //#define UNITY_MATERIAL_LIT #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) #define OUTPUT_SPLIT_LIGHTING #endif #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" #ifdef DEBUG_DISPLAY #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" #endif #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" #pragma shader_feature_local _USEALPHACUTOUT_ON #if defined(_DOUBLESIDED_ON) && !defined(ASE_NEED_CULLFACE) #define ASE_NEED_CULLFACE 1 #endif struct AttributesMesh { float3 positionOS : POSITION; float3 normalOS : NORMAL; float3 previousPositionOS : TEXCOORD4; #if defined (_ADD_PRECOMPUTED_VELOCITY) float3 precomputedVelocity : TEXCOORD5; #endif float4 ase_texcoord : TEXCOORD0; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct PackedVaryingsMeshToPS { float4 vmeshPositionCS : SV_Position; float3 vmeshInterp00 : TEXCOORD0; float3 vpassInterpolators0 : TEXCOORD1; //interpolators0 float3 vpassInterpolators1 : TEXCOORD2; //interpolators1 float4 ase_texcoord3 : TEXCOORD3; float4 ase_texcoord4 : TEXCOORD4; UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO #if defined(SHADER_STAGE_FRAGMENT) && defined(ASE_NEED_CULLFACE) FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; #endif }; CBUFFER_START( UnityPerMaterial ) float4 _BC_ST; float4 _EmissiveColor2; float4 _EmissiveColor4; float4 _EmissiveMask1_ST; float4 _EmissiveColor5; float4 _Roughness_ST; float4 _Metallic_ST; float4 _Normal_ST; float4 _Texture04_ST; float4 _Texture03_ST; float4 _Texture02_ST; float4 _Dirt_ST; float4 _EmissiveColor3; float4 _BlendColor01; float4 _Mask_ST; float4 _BlendColor02; float4 _AO_ST; float4 _BlendColor04; float4 _Texture01_ST; float4 _BlendColor03; float2 _PannerProperty1; float _EmissiveBoots4; float _EmissiveBoots5; float _DirtRoughness_Power; float _RoughnessBoost02; float _EmissiveBoots3; float _RoughnessBoost04; float _RoughnessBoost01; float _RoughnessBoost03; float _MetallicBoots04; float _EmissivePannerTilling1; float _Emissivepowerboost1; float _OpacityBoosts; float _MetallicBoots03; float _MetallicBoots02; float _MetallicBoots01; float _DirtBoots; float _BlendColorPower04; float _BlendColorPower03; float _BlendColorPower02; float _BlendColorPower01; float _EmissiveBoots2; float _DitherBoosts; float4 _EmissionColor; float _AlphaCutoff; float _RenderQueueType; #ifdef _ADD_PRECOMPUTED_VELOCITY float _AddPrecomputedVelocity; #endif float _StencilRef; float _StencilWriteMask; float _StencilRefDepth; float _StencilWriteMaskDepth; float _StencilRefMV; float _StencilWriteMaskMV; float _StencilRefDistortionVec; float _StencilWriteMaskDistortionVec; float _StencilWriteMaskGBuffer; float _StencilRefGBuffer; float _ZTestGBuffer; float _RequireSplitLighting; float _ReceivesSSR; float _SurfaceType; float _BlendMode; float _SrcBlend; float _DstBlend; float _AlphaSrcBlend; float _AlphaDstBlend; float _ZWrite; float _TransparentZWrite; float _CullMode; float _TransparentSortPriority; float _EnableFogOnTransparent; float _CullModeForward; float _TransparentCullMode; float _ZTestDepthEqualForOpaque; float _ZTestTransparent; float _TransparentBackfaceEnable; float _AlphaCutoffEnable; float _UseShadowThreshold; float _DoubleSidedEnable; float _DoubleSidedNormalMode; float4 _DoubleSidedConstants; #ifdef TESSELLATION_ON float _TessPhongStrength; float _TessValue; float _TessMin; float _TessMax; float _TessEdgeLength; float _TessMaxDisp; #endif CBUFFER_END sampler2D _Normal; sampler2D _Roughness; sampler2D _Mask; SAMPLER(sampler_Mask); sampler2D _Dirt; SAMPLER(sampler_Dirt); sampler2D _BC; SAMPLER(sampler_BC); inline float Dither4x4Bayer( int x, int y ) { const float dither[ 16 ] = { 1, 9, 3, 11, 13, 5, 15, 7, 4, 12, 2, 10, 16, 8, 14, 6 }; int r = y * 4 + x; return dither[r] / 16; // same # of instructions as pre-dividing due to compiler magic } void BuildSurfaceData(FragInputs fragInputs, inout SmoothSurfaceDescription surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) { ZERO_INITIALIZE(SurfaceData, surfaceData); surfaceData.specularOcclusion = 1.0; // surface data surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; // refraction #ifdef _HAS_REFRACTION if( _EnableSSRefraction ) { surfaceData.transmittanceMask = ( 1.0 - surfaceDescription.Alpha ); surfaceDescription.Alpha = 1.0; } else { surfaceData.ior = 1.0; surfaceData.transmittanceColor = float3( 1.0, 1.0, 1.0 ); surfaceData.atDistance = 1.0; surfaceData.transmittanceMask = 0.0; surfaceDescription.Alpha = 1.0; } #else surfaceData.ior = 1.0; surfaceData.transmittanceColor = float3( 1.0, 1.0, 1.0 ); surfaceData.atDistance = 1.0; surfaceData.transmittanceMask = 0.0; #endif // material features surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; #endif #ifdef _MATERIAL_FEATURE_TRANSMISSION surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; #endif #ifdef _MATERIAL_FEATURE_ANISOTROPY surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; #endif #ifdef ASE_LIT_CLEAR_COAT surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; #endif #ifdef _MATERIAL_FEATURE_IRIDESCENCE surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; #endif #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; #endif // others #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) surfaceData.baseColor *= ( 1.0 - Max3( surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b ) ); #endif #ifdef _DOUBLESIDED_ON float3 doubleSidedConstants = _DoubleSidedConstants.xyz; #else float3 doubleSidedConstants = float3( 1.0, 1.0, 1.0 ); #endif // normals float3 normalTS = float3(0.0f, 0.0f, 1.0f); normalTS = surfaceDescription.Normal; GetNormalWS( fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants ); surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; bentNormalWS = surfaceData.normalWS; surfaceData.tangentWS = normalize( fragInputs.tangentToWorld[ 0 ].xyz ); surfaceData.tangentWS = Orthonormalize( surfaceData.tangentWS, surfaceData.normalWS ); // decals #if HAVE_DECALS if( _EnableDecals ) { DecalSurfaceData decalSurfaceData = GetDecalSurfaceData( posInput, surfaceDescription.Alpha ); ApplyDecalToSurfaceData( decalSurfaceData, surfaceData ); } #endif #if defined(_SPECULAR_OCCLUSION_CUSTOM) #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO( V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness( surfaceData.perceptualSmoothness ) ); #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion( ClampNdotV( dot( surfaceData.normalWS, V ) ), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness( surfaceData.perceptualSmoothness ) ); #endif // debug #if defined(DEBUG_DISPLAY) if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) { surfaceData.metallic = 0; } ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); #endif } void GetSurfaceAndBuiltinData(SmoothSurfaceDescription surfaceDescription, FragInputs fragInputs, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData) { #ifdef LOD_FADE_CROSSFADE LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); #endif #ifdef _DOUBLESIDED_ON float3 doubleSidedConstants = _DoubleSidedConstants.xyz; #else float3 doubleSidedConstants = float3( 1.0, 1.0, 1.0 ); #endif ApplyDoubleSidedFlipOrMirror( fragInputs, doubleSidedConstants ); #ifdef _ALPHATEST_ON DoAlphaTest( surfaceDescription.Alpha, surfaceDescription.AlphaClipThreshold ); #endif #ifdef _DEPTHOFFSET_ON builtinData.depthOffset = surfaceDescription.DepthOffset; ApplyDepthOffsetPositionInput( V, surfaceDescription.DepthOffset, GetViewForwardDir(), GetWorldToHClipMatrix(), posInput ); #endif float3 bentNormalWS; BuildSurfaceData( fragInputs, surfaceDescription, V, posInput, surfaceData, bentNormalWS ); InitBuiltinData( posInput, surfaceDescription.Alpha, bentNormalWS, -fragInputs.tangentToWorld[ 2 ], fragInputs.texCoord1, fragInputs.texCoord2, builtinData ); PostInitBuiltinData(V, posInput, surfaceData, builtinData); } AttributesMesh ApplyMeshModification(AttributesMesh inputMesh, float3 timeParameters, inout PackedVaryingsMeshToPS outputPackedVaryingsMeshToPS ) { _TimeParameters.xyz = timeParameters; float4 ase_clipPos = TransformWorldToHClip( TransformObjectToWorld(inputMesh.positionOS)); float4 screenPos = ComputeScreenPos( ase_clipPos , _ProjectionParams.x ); outputPackedVaryingsMeshToPS.ase_texcoord4 = screenPos; outputPackedVaryingsMeshToPS.ase_texcoord3.xy = inputMesh.ase_texcoord.xy; //setting value to unused interpolator channels and avoid initialization warnings outputPackedVaryingsMeshToPS.ase_texcoord3.zw = 0; #ifdef ASE_ABSOLUTE_VERTEX_POS float3 defaultVertexValue = inputMesh.positionOS.xyz; #else float3 defaultVertexValue = float3( 0, 0, 0 ); #endif float3 vertexValue = defaultVertexValue ; #ifdef ASE_ABSOLUTE_VERTEX_POS inputMesh.positionOS.xyz = vertexValue; #else inputMesh.positionOS.xyz += vertexValue; #endif inputMesh.normalOS = inputMesh.normalOS ; return inputMesh; } PackedVaryingsMeshToPS VertexFunction(AttributesMesh inputMesh) { PackedVaryingsMeshToPS outputPackedVaryingsMeshToPS = (PackedVaryingsMeshToPS)0; AttributesMesh defaultMesh = inputMesh; UNITY_SETUP_INSTANCE_ID(inputMesh); UNITY_TRANSFER_INSTANCE_ID(inputMesh, outputPackedVaryingsMeshToPS); UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( outputPackedVaryingsMeshToPS ); inputMesh = ApplyMeshModification( inputMesh, _TimeParameters.xyz, outputPackedVaryingsMeshToPS); float3 positionRWS = TransformObjectToWorld(inputMesh.positionOS); float3 normalWS = TransformObjectToWorldNormal(inputMesh.normalOS); float3 VMESHpositionRWS = positionRWS; float4 VMESHpositionCS = TransformWorldToHClip(positionRWS); float4 VPASSpreviousPositionCS; float4 VPASSpositionCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(VMESHpositionRWS, 1.0)); bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; if (forceNoMotion) { VPASSpreviousPositionCS = float4(0.0, 0.0, 0.0, 1.0); } else { bool hasDeformation = unity_MotionVectorsParams.x > 0.0; float3 effectivePositionOS = (hasDeformation ? inputMesh.previousPositionOS : defaultMesh.positionOS); #if defined(_ADD_PRECOMPUTED_VELOCITY) effectivePositionOS -= inputMesh.precomputedVelocity; #endif #if defined(HAVE_MESH_MODIFICATION) AttributesMesh previousMesh = defaultMesh; previousMesh.positionOS = effectivePositionOS ; PackedVaryingsMeshToPS test = (PackedVaryingsMeshToPS)0; float3 curTime = _TimeParameters.xyz; previousMesh = ApplyMeshModification(previousMesh, _LastTimeParameters.xyz, test); _TimeParameters.xyz = curTime; float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.positionOS); #else float3 previousPositionRWS = TransformPreviousObjectToWorld(effectivePositionOS); #endif #ifdef ATTRIBUTES_NEED_NORMAL float3 normalWS = TransformPreviousObjectToWorldNormal(defaultMesh.normalOS); #else float3 normalWS = float3(0.0, 0.0, 0.0); #endif #if defined(HAVE_VERTEX_MODIFICATION) //ApplyVertexModification(inputMesh, normalWS, previousPositionRWS, _LastTimeParameters.xyz); #endif VPASSpreviousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); } outputPackedVaryingsMeshToPS.vmeshPositionCS = VMESHpositionCS; outputPackedVaryingsMeshToPS.vmeshInterp00.xyz = VMESHpositionRWS; outputPackedVaryingsMeshToPS.vpassInterpolators0 = float3(VPASSpositionCS.xyw); outputPackedVaryingsMeshToPS.vpassInterpolators1 = float3(VPASSpreviousPositionCS.xyw); return outputPackedVaryingsMeshToPS; } #if defined(TESSELLATION_ON) struct VertexControl { float3 positionOS : INTERNALTESSPOS; float3 normalOS : NORMAL; float3 previousPositionOS : TEXCOORD4; #if defined (_ADD_PRECOMPUTED_VELOCITY) float3 precomputedVelocity : TEXCOORD5; #endif float4 ase_texcoord : TEXCOORD0; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct TessellationFactors { float edge[3] : SV_TessFactor; float inside : SV_InsideTessFactor; }; VertexControl Vert ( AttributesMesh v ) { VertexControl o; UNITY_SETUP_INSTANCE_ID(v); UNITY_TRANSFER_INSTANCE_ID(v, o); o.positionOS = v.positionOS; o.normalOS = v.normalOS; o.previousPositionOS = v.previousPositionOS; #if defined (_ADD_PRECOMPUTED_VELOCITY) o.precomputedVelocity = v.precomputedVelocity; #endif o.ase_texcoord = v.ase_texcoord; return o; } TessellationFactors TessellationFunction (InputPatch v) { TessellationFactors o; float4 tf = 1; float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; #if (SHADEROPTIONS_CAMERA_RELATIVE_RENDERING != 0) float3 cameraPos = 0; #else float3 cameraPos = _WorldSpaceCameraPos; #endif #if defined(ASE_FIXED_TESSELLATION) tf = FixedTess( tessValue ); #elif defined(ASE_DISTANCE_TESSELLATION) tf = DistanceBasedTess(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), cameraPos ); #elif defined(ASE_LENGTH_TESSELLATION) tf = EdgeLengthBasedTess(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), edgeLength, GetObjectToWorldMatrix(), cameraPos, _ScreenParams ); #elif defined(ASE_LENGTH_CULL_TESSELLATION) tf = EdgeLengthBasedTessCull(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), cameraPos, _ScreenParams, _FrustumPlanes ); #endif o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; return o; } [domain("tri")] [partitioning("fractional_odd")] [outputtopology("triangle_cw")] [patchconstantfunc("TessellationFunction")] [outputcontrolpoints(3)] VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) { return patch[id]; } [domain("tri")] PackedVaryingsMeshToPS DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) { AttributesMesh o = (AttributesMesh) 0; o.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; o.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; o.previousPositionOS = patch[0].previousPositionOS * bary.x + patch[1].previousPositionOS * bary.y + patch[2].previousPositionOS * bary.z; #if defined (_ADD_PRECOMPUTED_VELOCITY) o.precomputedVelocity = patch[0].precomputedVelocity * bary.x + patch[1].precomputedVelocity * bary.y + patch[2].precomputedVelocity * bary.z; #endif o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; #if defined(ASE_PHONG_TESSELLATION) float3 pp[3]; for (int i = 0; i < 3; ++i) pp[i] = o.positionOS.xyz - patch[i].normalOS * (dot(o.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); float phongStrength = _TessPhongStrength; o.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.positionOS.xyz; #endif UNITY_TRANSFER_INSTANCE_ID(patch[0], o); return VertexFunction(o); } #else PackedVaryingsMeshToPS Vert ( AttributesMesh v ) { return VertexFunction( v ); } #endif void Frag( PackedVaryingsMeshToPS packedInput , out float4 outMotionVector : SV_Target0 #ifdef WRITE_NORMAL_BUFFER , out float4 outNormalBuffer : SV_Target1 #ifdef WRITE_MSAA_DEPTH , out float1 depthColor : SV_Target2 #endif #elif defined(WRITE_MSAA_DEPTH) , out float4 outNormalBuffer : SV_Target1 , out float1 depthColor : SV_Target2 #endif #ifdef _DEPTHOFFSET_ON , out float outputDepth : SV_Depth #endif ) { UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( packedInput ); UNITY_SETUP_INSTANCE_ID( packedInput ); FragInputs input; ZERO_INITIALIZE(FragInputs, input); input.tangentToWorld = k_identity3x3; input.positionSS = packedInput.vmeshPositionCS; input.positionRWS = packedInput.vmeshInterp00.xyz; PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); SurfaceData surfaceData; BuiltinData builtinData; SmoothSurfaceDescription surfaceDescription = (SmoothSurfaceDescription)0; float2 uv_Normal = packedInput.ase_texcoord3.xy * _Normal_ST.xy + _Normal_ST.zw; float2 uv_Roughness = packedInput.ase_texcoord3.xy * _Roughness_ST.xy + _Roughness_ST.zw; float4 temp_output_148_0 = ( 1.0 - tex2D( _Roughness, uv_Roughness ) ); float2 uv_Mask = packedInput.ase_texcoord3.xy * _Mask_ST.xy + _Mask_ST.zw; float4 tex2DNode2 = tex2D( _Mask, uv_Mask ); float temp_output_27_0 = ( tex2DNode2.r + tex2DNode2.g + tex2DNode2.b + tex2DNode2.a ); float4 lerpResult119 = lerp( temp_output_148_0 , ( ( ( _RoughnessBoost01 * tex2DNode2.r ) + ( _RoughnessBoost02 * tex2DNode2.g ) + ( _RoughnessBoost03 * tex2DNode2.b ) + ( _RoughnessBoost04 * tex2DNode2.a ) ) * temp_output_148_0 ) , temp_output_27_0); float4 temp_cast_0 = (( _DirtRoughness_Power * _DirtBoots )).xxxx; float2 uv_Dirt = packedInput.ase_texcoord3.xy * _Dirt_ST.xy + _Dirt_ST.zw; float4 tex2DNode80 = tex2D( _Dirt, uv_Dirt ); float4 lerpResult88 = lerp( lerpResult119 , temp_cast_0 , ( _DirtBoots * tex2DNode80.a )); float4 color219 = IsGammaSpace() ? float4(1,1,1,0) : float4(1,1,1,0); float2 uv_BC = packedInput.ase_texcoord3.xy * _BC_ST.xy + _BC_ST.zw; float4 tex2DNode1 = tex2D( _BC, uv_BC ); float4 temp_cast_2 = (( tex2DNode1.a * _OpacityBoosts )).xxxx; #ifdef _USEALPHACUTOUT_ON float4 staticSwitch218 = temp_cast_2; #else float4 staticSwitch218 = color219; #endif float4 screenPos = packedInput.ase_texcoord4; float4 ase_screenPosNorm = screenPos / screenPos.w; ase_screenPosNorm.z = ( UNITY_NEAR_CLIP_VALUE >= 0 ) ? ase_screenPosNorm.z : ase_screenPosNorm.z * 0.5 + 0.5; float2 clipScreen212 = ase_screenPosNorm.xy * _ScreenParams.xy; float dither212 = Dither4x4Bayer( fmod(clipScreen212.x, 4), fmod(clipScreen212.y, 4) ); dither212 = step( dither212, ( tex2DNode1.a * _DitherBoosts ) ); surfaceDescription.Normal = UnpackNormalScale( tex2D( _Normal, uv_Normal ), 1.0f ); surfaceDescription.Smoothness = lerpResult88.r; surfaceDescription.Alpha = staticSwitch218.r; #ifdef _ALPHATEST_ON surfaceDescription.AlphaClipThreshold = ( 1.0 - dither212 ); #endif #ifdef _DEPTHOFFSET_ON surfaceDescription.DepthOffset = 0; #endif GetSurfaceAndBuiltinData( surfaceDescription, input, V, posInput, surfaceData, builtinData ); float4 VPASSpositionCS = float4(packedInput.vpassInterpolators0.xy, 0.0, packedInput.vpassInterpolators0.z); float4 VPASSpreviousPositionCS = float4(packedInput.vpassInterpolators1.xy, 0.0, packedInput.vpassInterpolators1.z); #ifdef _DEPTHOFFSET_ON VPASSpositionCS.w += builtinData.depthOffset; VPASSpreviousPositionCS.w += builtinData.depthOffset; #endif float2 motionVector = CalculateMotionVector( VPASSpositionCS, VPASSpreviousPositionCS ); EncodeMotionVector( motionVector * 0.5, outMotionVector ); bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; if( forceNoMotion ) outMotionVector = float4( 2.0, 0.0, 0.0, 0.0 ); #ifdef WRITE_NORMAL_BUFFER EncodeIntoNormalBuffer( ConvertSurfaceDataToNormalData( surfaceData ), posInput.positionSS, outNormalBuffer ); #ifdef WRITE_MSAA_DEPTH depthColor = packedInput.vmeshPositionCS.z; #endif #elif defined(WRITE_MSAA_DEPTH) outNormalBuffer = float4( 0.0, 0.0, 0.0, 1.0 ); depthColor = packedInput.vmeshPositionCS.z; #endif #ifdef _DEPTHOFFSET_ON outputDepth = posInput.deviceDepth; #endif } ENDHLSL } Pass { Name "Forward" Tags { "LightMode"="Forward" } Blend [_SrcBlend] [_DstBlend], [_AlphaSrcBlend] [_AlphaDstBlend] Cull [_CullModeForward] ZTest [_ZTestDepthEqualForOpaque] ZWrite [_ZWrite] Stencil { Ref [_StencilRef] WriteMask [_StencilWriteMask] Comp Always Pass Replace Fail Keep ZFail Keep } ColorMask [_ColorMaskTransparentVel] 1 HLSLPROGRAM #define _SPECULAR_OCCLUSION_FROM_AO 1 #define _AMBIENT_OCCLUSION 1 #define ASE_SRP_VERSION 70403 #pragma shader_feature _SURFACE_TYPE_TRANSPARENT #pragma shader_feature_local _DOUBLESIDED_ON #pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY #pragma shader_feature_local _ENABLE_FOG_ON_TRANSPARENT #pragma shader_feature_local _ALPHATEST_ON #if !defined(DEBUG_DISPLAY) && defined(_ALPHATEST_ON) #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST #endif #define SHADERPASS SHADERPASS_FORWARD #pragma multi_compile _ DEBUG_DISPLAY #pragma multi_compile _ LIGHTMAP_ON #pragma multi_compile _ DIRLIGHTMAP_COMBINED #pragma multi_compile _ DYNAMICLIGHTMAP_ON #pragma multi_compile _ SHADOWS_SHADOWMASK #pragma multi_compile DECALS_OFF DECALS_3RT DECALS_4RT #pragma multi_compile USE_FPTL_LIGHTLIST USE_CLUSTERED_LIGHTLIST #pragma multi_compile SHADOW_LOW SHADOW_MEDIUM SHADOW_HIGH #pragma vertex Vert #pragma fragment Frag //#define UNITY_MATERIAL_LIT #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) #define OUTPUT_SPLIT_LIGHTING #endif #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" #ifdef DEBUG_DISPLAY #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" #endif #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" #define HAS_LIGHTLOOP #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" #pragma shader_feature _BLENDTEXTUREMODE_ON #pragma shader_feature _BLENDTEXTURE01_ON #pragma shader_feature _BLENDTEXTURE02_ON #pragma shader_feature _BLENDTEXTURE03_ON #pragma shader_feature _BLENDTEXTURE04_ON #pragma shader_feature_local _USEALPHACUTOUT_ON #if defined(_DOUBLESIDED_ON) && !defined(ASE_NEED_CULLFACE) #define ASE_NEED_CULLFACE 1 #endif struct AttributesMesh { float3 positionOS : POSITION; float3 normalOS : NORMAL; float4 tangentOS : TANGENT; float4 uv1 : TEXCOORD1; float4 uv2 : TEXCOORD2; #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR float3 previousPositionOS : TEXCOORD4; #if defined (_ADD_PRECOMPUTED_VELOCITY) float3 precomputedVelocity : TEXCOORD5; #endif #endif float4 ase_texcoord : TEXCOORD0; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct PackedVaryingsMeshToPS { float4 positionCS : SV_Position; float3 interp00 : TEXCOORD0; float3 interp01 : TEXCOORD1; float4 interp02 : TEXCOORD2; float4 interp03 : TEXCOORD3; float4 interp04 : TEXCOORD4; #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR float3 vpassPositionCS : TEXCOORD5; float3 vpassPreviousPositionCS : TEXCOORD6; #endif float4 ase_texcoord7 : TEXCOORD7; float4 ase_texcoord8 : TEXCOORD8; UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO #if defined(SHADER_STAGE_FRAGMENT) && defined(ASE_NEED_CULLFACE) FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; #endif }; CBUFFER_START( UnityPerMaterial ) float4 _BC_ST; float4 _EmissiveColor2; float4 _EmissiveColor4; float4 _EmissiveMask1_ST; float4 _EmissiveColor5; float4 _Roughness_ST; float4 _Metallic_ST; float4 _Normal_ST; float4 _Texture04_ST; float4 _Texture03_ST; float4 _Texture02_ST; float4 _Dirt_ST; float4 _EmissiveColor3; float4 _BlendColor01; float4 _Mask_ST; float4 _BlendColor02; float4 _AO_ST; float4 _BlendColor04; float4 _Texture01_ST; float4 _BlendColor03; float2 _PannerProperty1; float _EmissiveBoots4; float _EmissiveBoots5; float _DirtRoughness_Power; float _RoughnessBoost02; float _EmissiveBoots3; float _RoughnessBoost04; float _RoughnessBoost01; float _RoughnessBoost03; float _MetallicBoots04; float _EmissivePannerTilling1; float _Emissivepowerboost1; float _OpacityBoosts; float _MetallicBoots03; float _MetallicBoots02; float _MetallicBoots01; float _DirtBoots; float _BlendColorPower04; float _BlendColorPower03; float _BlendColorPower02; float _BlendColorPower01; float _EmissiveBoots2; float _DitherBoosts; float4 _EmissionColor; float _AlphaCutoff; float _RenderQueueType; #ifdef _ADD_PRECOMPUTED_VELOCITY float _AddPrecomputedVelocity; #endif float _StencilRef; float _StencilWriteMask; float _StencilRefDepth; float _StencilWriteMaskDepth; float _StencilRefMV; float _StencilWriteMaskMV; float _StencilRefDistortionVec; float _StencilWriteMaskDistortionVec; float _StencilWriteMaskGBuffer; float _StencilRefGBuffer; float _ZTestGBuffer; float _RequireSplitLighting; float _ReceivesSSR; float _SurfaceType; float _BlendMode; float _SrcBlend; float _DstBlend; float _AlphaSrcBlend; float _AlphaDstBlend; float _ZWrite; float _TransparentZWrite; float _CullMode; float _TransparentSortPriority; float _EnableFogOnTransparent; float _CullModeForward; float _TransparentCullMode; float _ZTestDepthEqualForOpaque; float _ZTestTransparent; float _TransparentBackfaceEnable; float _AlphaCutoffEnable; float _UseShadowThreshold; float _DoubleSidedEnable; float _DoubleSidedNormalMode; float4 _DoubleSidedConstants; #ifdef TESSELLATION_ON float _TessPhongStrength; float _TessValue; float _TessMin; float _TessMax; float _TessEdgeLength; float _TessMaxDisp; #endif CBUFFER_END sampler2D _BC; sampler2D _Mask; SAMPLER(sampler_Mask); sampler2D _Texture01; sampler2D _Texture02; sampler2D _Texture03; sampler2D _Texture04; sampler2D _Dirt; SAMPLER(sampler_Dirt); sampler2D _Normal; sampler2D _Metallic; sampler2D _EmissiveMask1; SAMPLER(sampler_EmissiveMask1); sampler2D _EmissivePannerMap1; sampler2D _Roughness; sampler2D _AO; SAMPLER(sampler_BC); inline float Dither4x4Bayer( int x, int y ) { const float dither[ 16 ] = { 1, 9, 3, 11, 13, 5, 15, 7, 4, 12, 2, 10, 16, 8, 14, 6 }; int r = y * 4 + x; return dither[r] / 16; // same # of instructions as pre-dividing due to compiler magic } void BuildSurfaceData(FragInputs fragInputs, inout GlobalSurfaceDescription surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) { ZERO_INITIALIZE(SurfaceData, surfaceData); surfaceData.specularOcclusion = 1.0; // surface data surfaceData.baseColor = surfaceDescription.Albedo; surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; surfaceData.ambientOcclusion = surfaceDescription.Occlusion; surfaceData.metallic = surfaceDescription.Metallic; surfaceData.coatMask = surfaceDescription.CoatMask; #ifdef _SPECULAR_OCCLUSION_CUSTOM surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; #endif #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; #endif #if defined(_HAS_REFRACTION) || defined(_MATERIAL_FEATURE_TRANSMISSION) surfaceData.thickness = surfaceDescription.Thickness; #endif #if defined( _MATERIAL_FEATURE_SUBSURFACE_SCATTERING ) || defined( _MATERIAL_FEATURE_TRANSMISSION ) surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfile); #endif #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR surfaceData.specularColor = surfaceDescription.Specular; #endif #ifdef _MATERIAL_FEATURE_ANISOTROPY surfaceData.anisotropy = surfaceDescription.Anisotropy; #endif #ifdef _MATERIAL_FEATURE_IRIDESCENCE surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; #endif // refraction #ifdef _HAS_REFRACTION if( _EnableSSRefraction ) { surfaceData.ior = surfaceDescription.RefractionIndex; surfaceData.transmittanceColor = surfaceDescription.RefractionColor; surfaceData.atDistance = surfaceDescription.RefractionDistance; surfaceData.transmittanceMask = ( 1.0 - surfaceDescription.Alpha ); surfaceDescription.Alpha = 1.0; } else { surfaceData.ior = 1.0; surfaceData.transmittanceColor = float3( 1.0, 1.0, 1.0 ); surfaceData.atDistance = 1.0; surfaceData.transmittanceMask = 0.0; surfaceDescription.Alpha = 1.0; } #else surfaceData.ior = 1.0; surfaceData.transmittanceColor = float3( 1.0, 1.0, 1.0 ); surfaceData.atDistance = 1.0; surfaceData.transmittanceMask = 0.0; #endif // material features surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; #endif #ifdef _MATERIAL_FEATURE_TRANSMISSION surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; #endif #ifdef _MATERIAL_FEATURE_ANISOTROPY surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; #endif #ifdef ASE_LIT_CLEAR_COAT surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; #endif #ifdef _MATERIAL_FEATURE_IRIDESCENCE surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; #endif #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; #endif // others #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) surfaceData.baseColor *= ( 1.0 - Max3( surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b ) ); #endif #ifdef _DOUBLESIDED_ON float3 doubleSidedConstants = _DoubleSidedConstants.xyz; #else float3 doubleSidedConstants = float3( 1.0, 1.0, 1.0 ); #endif // normals float3 normalTS = float3(0.0f, 0.0f, 1.0f); normalTS = surfaceDescription.Normal; GetNormalWS( fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants ); surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; bentNormalWS = surfaceData.normalWS; #ifdef ASE_BENT_NORMAL GetNormalWS( fragInputs, surfaceDescription.BentNormal, bentNormalWS, doubleSidedConstants ); #endif surfaceData.tangentWS = normalize( fragInputs.tangentToWorld[ 0 ].xyz ); #ifdef _MATERIAL_FEATURE_ANISOTROPY surfaceData.tangentWS = TransformTangentToWorld( surfaceDescription.Tangent, fragInputs.tangentToWorld ); #endif surfaceData.tangentWS = Orthonormalize( surfaceData.tangentWS, surfaceData.normalWS ); // decals #if HAVE_DECALS if( _EnableDecals ) { DecalSurfaceData decalSurfaceData = GetDecalSurfaceData( posInput, surfaceDescription.Alpha ); ApplyDecalToSurfaceData( decalSurfaceData, surfaceData ); } #endif #if defined(_SPECULAR_OCCLUSION_CUSTOM) #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO( V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness( surfaceData.perceptualSmoothness ) ); #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion( ClampNdotV( dot( surfaceData.normalWS, V ) ), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness( surfaceData.perceptualSmoothness ) ); #endif #ifdef _ENABLE_GEOMETRIC_SPECULAR_AA surfaceData.perceptualSmoothness = GeometricNormalFiltering( surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[ 2 ], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold ); #endif // debug #if defined(DEBUG_DISPLAY) if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) { surfaceData.metallic = 0; } ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); #endif } void GetSurfaceAndBuiltinData(GlobalSurfaceDescription surfaceDescription, FragInputs fragInputs, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData) { #ifdef LOD_FADE_CROSSFADE LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); #endif #ifdef _DOUBLESIDED_ON float3 doubleSidedConstants = _DoubleSidedConstants.xyz; #else float3 doubleSidedConstants = float3( 1.0, 1.0, 1.0 ); #endif ApplyDoubleSidedFlipOrMirror( fragInputs, doubleSidedConstants ); #ifdef _ALPHATEST_ON DoAlphaTest( surfaceDescription.Alpha, surfaceDescription.AlphaClipThreshold ); #endif #ifdef _DEPTHOFFSET_ON builtinData.depthOffset = surfaceDescription.DepthOffset; ApplyDepthOffsetPositionInput( V, surfaceDescription.DepthOffset, GetViewForwardDir(), GetWorldToHClipMatrix(), posInput ); #endif float3 bentNormalWS; BuildSurfaceData( fragInputs, surfaceDescription, V, posInput, surfaceData, bentNormalWS ); InitBuiltinData( posInput, surfaceDescription.Alpha, bentNormalWS, -fragInputs.tangentToWorld[ 2 ], fragInputs.texCoord1, fragInputs.texCoord2, builtinData ); #ifdef _ASE_BAKEDGI builtinData.bakeDiffuseLighting = surfaceDescription.BakedGI; #endif #ifdef _ASE_BAKEDBACKGI builtinData.backBakeDiffuseLighting = surfaceDescription.BakedBackGI; #endif builtinData.emissiveColor = surfaceDescription.Emission; PostInitBuiltinData(V, posInput, surfaceData, builtinData); } AttributesMesh ApplyMeshModification(AttributesMesh inputMesh, float3 timeParameters, inout PackedVaryingsMeshToPS outputPackedVaryingsMeshToPS ) { _TimeParameters.xyz = timeParameters; float4 ase_clipPos = TransformWorldToHClip( TransformObjectToWorld(inputMesh.positionOS)); float4 screenPos = ComputeScreenPos( ase_clipPos , _ProjectionParams.x ); outputPackedVaryingsMeshToPS.ase_texcoord8 = screenPos; outputPackedVaryingsMeshToPS.ase_texcoord7.xy = inputMesh.ase_texcoord.xy; //setting value to unused interpolator channels and avoid initialization warnings outputPackedVaryingsMeshToPS.ase_texcoord7.zw = 0; #ifdef ASE_ABSOLUTE_VERTEX_POS float3 defaultVertexValue = inputMesh.positionOS.xyz; #else float3 defaultVertexValue = float3( 0, 0, 0 ); #endif float3 vertexValue = defaultVertexValue; #ifdef ASE_ABSOLUTE_VERTEX_POS inputMesh.positionOS.xyz = vertexValue; #else inputMesh.positionOS.xyz += vertexValue; #endif inputMesh.normalOS = inputMesh.normalOS; inputMesh.tangentOS = inputMesh.tangentOS; return inputMesh; } PackedVaryingsMeshToPS VertexFunction(AttributesMesh inputMesh) { PackedVaryingsMeshToPS outputPackedVaryingsMeshToPS = (PackedVaryingsMeshToPS)0; AttributesMesh defaultMesh = inputMesh; UNITY_SETUP_INSTANCE_ID(inputMesh); UNITY_TRANSFER_INSTANCE_ID(inputMesh, outputPackedVaryingsMeshToPS); UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( outputPackedVaryingsMeshToPS ); inputMesh = ApplyMeshModification( inputMesh, _TimeParameters.xyz, outputPackedVaryingsMeshToPS); float3 positionRWS = TransformObjectToWorld(inputMesh.positionOS); float3 normalWS = TransformObjectToWorldNormal(inputMesh.normalOS); float4 tangentWS = float4(TransformObjectToWorldDir(inputMesh.tangentOS.xyz), inputMesh.tangentOS.w); #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR float4 VPASSpreviousPositionCS; float4 VPASSpositionCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS, 1.0)); bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; if (forceNoMotion) { VPASSpreviousPositionCS = float4(0.0, 0.0, 0.0, 1.0); } else { bool hasDeformation = unity_MotionVectorsParams.x > 0.0; float3 effectivePositionOS = (hasDeformation ? inputMesh.previousPositionOS : defaultMesh.positionOS); #if defined(_ADD_PRECOMPUTED_VELOCITY) effectivePositionOS -= inputMesh.precomputedVelocity; #endif #if defined(HAVE_MESH_MODIFICATION) AttributesMesh previousMesh = defaultMesh; previousMesh.positionOS = effectivePositionOS ; PackedVaryingsMeshToPS test = (PackedVaryingsMeshToPS)0; float3 curTime = _TimeParameters.xyz; previousMesh = ApplyMeshModification(previousMesh, _LastTimeParameters.xyz, test); _TimeParameters.xyz = curTime; float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.positionOS); #else float3 previousPositionRWS = TransformPreviousObjectToWorld(effectivePositionOS); #endif #ifdef ATTRIBUTES_NEED_NORMAL float3 normalWS = TransformPreviousObjectToWorldNormal(defaultMesh.normalOS); #else float3 normalWS = float3(0.0, 0.0, 0.0); #endif #if defined(HAVE_VERTEX_MODIFICATION) //ApplyVertexModification(inputMesh, normalWS, previousPositionRWS, _LastTimeParameters.xyz); #endif VPASSpreviousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); } #endif outputPackedVaryingsMeshToPS.positionCS = TransformWorldToHClip(positionRWS); outputPackedVaryingsMeshToPS.interp00.xyz = positionRWS; outputPackedVaryingsMeshToPS.interp01.xyz = normalWS; outputPackedVaryingsMeshToPS.interp02.xyzw = tangentWS; outputPackedVaryingsMeshToPS.interp03.xyzw = inputMesh.uv1; outputPackedVaryingsMeshToPS.interp04.xyzw = inputMesh.uv2; #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR outputPackedVaryingsMeshToPS.vpassPositionCS = float3(VPASSpositionCS.xyw); outputPackedVaryingsMeshToPS.vpassPreviousPositionCS = float3(VPASSpreviousPositionCS.xyw); #endif return outputPackedVaryingsMeshToPS; } #if defined(TESSELLATION_ON) struct VertexControl { float3 positionOS : INTERNALTESSPOS; float3 normalOS : NORMAL; float4 tangentOS : TANGENT; float4 uv1 : TEXCOORD1; float4 uv2 : TEXCOORD2; #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR float3 previousPositionOS : TEXCOORD4; #if defined (_ADD_PRECOMPUTED_VELOCITY) float3 precomputedVelocity : TEXCOORD5; #endif #endif float4 ase_texcoord : TEXCOORD0; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct TessellationFactors { float edge[3] : SV_TessFactor; float inside : SV_InsideTessFactor; }; VertexControl Vert ( AttributesMesh v ) { VertexControl o; UNITY_SETUP_INSTANCE_ID(v); UNITY_TRANSFER_INSTANCE_ID(v, o); o.positionOS = v.positionOS; o.normalOS = v.normalOS; o.tangentOS = v.tangentOS; o.uv1 = v.uv1; o.uv2 = v.uv2; #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR o.previousPositionOS = v.previousPositionOS; #if defined (_ADD_PRECOMPUTED_VELOCITY) o.precomputedVelocity = v.precomputedVelocity; #endif #endif o.ase_texcoord = v.ase_texcoord; return o; } TessellationFactors TessellationFunction (InputPatch v) { TessellationFactors o; float4 tf = 1; float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; #if (SHADEROPTIONS_CAMERA_RELATIVE_RENDERING != 0) float3 cameraPos = 0; #else float3 cameraPos = _WorldSpaceCameraPos; #endif #if defined(ASE_FIXED_TESSELLATION) tf = FixedTess( tessValue ); #elif defined(ASE_DISTANCE_TESSELLATION) tf = DistanceBasedTess(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), cameraPos ); #elif defined(ASE_LENGTH_TESSELLATION) tf = EdgeLengthBasedTess(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), edgeLength, GetObjectToWorldMatrix(), cameraPos, _ScreenParams ); #elif defined(ASE_LENGTH_CULL_TESSELLATION) tf = EdgeLengthBasedTessCull(float4(v[0].positionOS,1), float4(v[1].positionOS,1), float4(v[2].positionOS,1), edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), cameraPos, _ScreenParams, _FrustumPlanes ); #endif o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; return o; } [domain("tri")] [partitioning("fractional_odd")] [outputtopology("triangle_cw")] [patchconstantfunc("TessellationFunction")] [outputcontrolpoints(3)] VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) { return patch[id]; } [domain("tri")] PackedVaryingsMeshToPS DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) { AttributesMesh o = (AttributesMesh) 0; o.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; o.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; o.tangentOS = patch[0].tangentOS * bary.x + patch[1].tangentOS * bary.y + patch[2].tangentOS * bary.z; o.uv1 = patch[0].uv1 * bary.x + patch[1].uv1 * bary.y + patch[2].uv1 * bary.z; o.uv2 = patch[0].uv2 * bary.x + patch[1].uv2 * bary.y + patch[2].uv2 * bary.z; #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR o.previousPositionOS = patch[0].previousPositionOS * bary.x + patch[1].previousPositionOS * bary.y + patch[2].previousPositionOS * bary.z; #if defined (_ADD_PRECOMPUTED_VELOCITY) o.precomputedVelocity = patch[0].precomputedVelocity * bary.x + patch[1].precomputedVelocity * bary.y + patch[2].precomputedVelocity * bary.z; #endif #endif o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z; #if defined(ASE_PHONG_TESSELLATION) float3 pp[3]; for (int i = 0; i < 3; ++i) pp[i] = o.positionOS.xyz - patch[i].normalOS * (dot(o.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); float phongStrength = _TessPhongStrength; o.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.positionOS.xyz; #endif UNITY_TRANSFER_INSTANCE_ID(patch[0], o); return VertexFunction(o); } #else PackedVaryingsMeshToPS Vert ( AttributesMesh v ) { return VertexFunction( v ); } #endif void Frag(PackedVaryingsMeshToPS packedInput, #ifdef OUTPUT_SPLIT_LIGHTING out float4 outColor : SV_Target0, out float4 outDiffuseLighting : SV_Target1, OUTPUT_SSSBUFFER(outSSSBuffer) #else out float4 outColor : SV_Target0 #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR , out float4 outMotionVec : SV_Target1 #endif #endif #ifdef _DEPTHOFFSET_ON , out float outputDepth : SV_Depth #endif ) { #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR outMotionVec = float4(2.0, 0.0, 0.0, 0.0); #endif UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( packedInput ); UNITY_SETUP_INSTANCE_ID( packedInput ); float3 positionRWS = packedInput.interp00.xyz; float3 normalWS = packedInput.interp01.xyz; float4 tangentWS = packedInput.interp02.xyzw; FragInputs input; ZERO_INITIALIZE(FragInputs, input); input.tangentToWorld = k_identity3x3; input.positionSS = packedInput.positionCS; input.positionRWS = positionRWS; input.tangentToWorld = BuildTangentToWorld(tangentWS, normalWS); input.texCoord1 = packedInput.interp03.xyzw; input.texCoord2 = packedInput.interp04.xyzw; #if _DOUBLESIDED_ON && SHADER_STAGE_FRAGMENT input.isFrontFace = IS_FRONT_VFACE( packedInput.cullFace, true, false); #elif SHADER_STAGE_FRAGMENT #if defined(ASE_NEED_CULLFACE) input.isFrontFace = IS_FRONT_VFACE(packedInput.cullFace, true, false); #endif #endif half isFrontFace = input.isFrontFace; input.positionSS.xy = _OffScreenRendering > 0 ? (input.positionSS.xy * _OffScreenDownsampleFactor) : input.positionSS.xy; uint2 tileIndex = uint2(input.positionSS.xy) / GetTileSize (); PositionInputs posInput = GetPositionInput( input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz, tileIndex ); float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); GlobalSurfaceDescription surfaceDescription = (GlobalSurfaceDescription)0; float2 uv_BC = packedInput.ase_texcoord7.xy * _BC_ST.xy + _BC_ST.zw; float4 tex2DNode1 = tex2D( _BC, uv_BC ); float2 uv_Mask = packedInput.ase_texcoord7.xy * _Mask_ST.xy + _Mask_ST.zw; float4 tex2DNode2 = tex2D( _Mask, uv_Mask ); float4 lerpResult28 = lerp( float4( 0,0,0,0 ) , _BlendColor01 , tex2DNode2.r); float4 lerpResult29 = lerp( float4( 0,0,0,0 ) , _BlendColor02 , tex2DNode2.g); float4 lerpResult30 = lerp( float4( 0,0,0,0 ) , _BlendColor03 , tex2DNode2.b); float4 lerpResult31 = lerp( float4( 0,0,0,0 ) , _BlendColor04 , tex2DNode2.a); float4 lerpResult132 = lerp( tex2DNode1 , ( lerpResult28 + lerpResult29 + lerpResult30 + lerpResult31 ) , ( ( _BlendColorPower01 * tex2DNode2.r ) + ( _BlendColorPower02 * tex2DNode2.g ) + ( _BlendColorPower03 * tex2DNode2.b ) + ( _BlendColorPower04 * tex2DNode2.a ) )); float2 uv_Texture01 = packedInput.ase_texcoord7.xy * _Texture01_ST.xy + _Texture01_ST.zw; float4 lerpResult55 = lerp( float4( 0,0,0,0 ) , tex2D( _Texture01, uv_Texture01 ) , tex2DNode2.r); #ifdef _BLENDTEXTURE01_ON float4 staticSwitch60 = lerpResult55; #else float4 staticSwitch60 = tex2DNode1; #endif float2 uv_Texture02 = packedInput.ase_texcoord7.xy * _Texture02_ST.xy + _Texture02_ST.zw; float4 lerpResult56 = lerp( float4( 0,0,0,0 ) , tex2D( _Texture02, uv_Texture02 ) , tex2DNode2.g); #ifdef _BLENDTEXTURE02_ON float4 staticSwitch61 = lerpResult56; #else float4 staticSwitch61 = tex2DNode1; #endif float2 uv_Texture03 = packedInput.ase_texcoord7.xy * _Texture03_ST.xy + _Texture03_ST.zw; float4 lerpResult57 = lerp( float4( 0,0,0,0 ) , tex2D( _Texture03, uv_Texture03 ) , tex2DNode2.b); #ifdef _BLENDTEXTURE03_ON float4 staticSwitch62 = lerpResult57; #else float4 staticSwitch62 = tex2DNode1; #endif float2 uv_Texture04 = packedInput.ase_texcoord7.xy * _Texture04_ST.xy + _Texture04_ST.zw; float4 lerpResult58 = lerp( float4( 0,0,0,0 ) , tex2D( _Texture04, uv_Texture04 ) , tex2DNode2.a); #ifdef _BLENDTEXTURE04_ON float4 staticSwitch63 = lerpResult58; #else float4 staticSwitch63 = tex2DNode1; #endif float temp_output_27_0 = ( tex2DNode2.r + tex2DNode2.g + tex2DNode2.b + tex2DNode2.a ); float4 lerpResult71 = lerp( tex2DNode1 , ( ( staticSwitch60 * tex2DNode2.r ) + ( staticSwitch61 * tex2DNode2.g ) + ( staticSwitch62 * tex2DNode2.b ) + ( staticSwitch63 * tex2DNode2.a ) ) , temp_output_27_0); #ifdef _BLENDTEXTUREMODE_ON float4 staticSwitch72 = lerpResult71; #else float4 staticSwitch72 = lerpResult132; #endif float2 uv_Dirt = packedInput.ase_texcoord7.xy * _Dirt_ST.xy + _Dirt_ST.zw; float4 tex2DNode80 = tex2D( _Dirt, uv_Dirt ); float4 lerpResult87 = lerp( staticSwitch72 , ( tex2DNode80 * _DirtBoots ) , ( _DirtBoots * tex2DNode80.a )); float2 uv_Normal = packedInput.ase_texcoord7.xy * _Normal_ST.xy + _Normal_ST.zw; float2 uv_Metallic = packedInput.ase_texcoord7.xy * _Metallic_ST.xy + _Metallic_ST.zw; float4 tex2DNode76 = tex2D( _Metallic, uv_Metallic ); float4 lerpResult128 = lerp( tex2DNode76 , ( ( ( _MetallicBoots01 * tex2DNode2.r ) + ( _MetallicBoots02 * tex2DNode2.g ) + ( _MetallicBoots03 * tex2DNode2.b ) + ( _MetallicBoots04 * tex2DNode2.a ) ) * tex2DNode76 ) , temp_output_27_0); float2 uv_EmissiveMask1 = packedInput.ase_texcoord7.xy * _EmissiveMask1_ST.xy + _EmissiveMask1_ST.zw; float4 tex2DNode231 = tex2D( _EmissiveMask1, uv_EmissiveMask1 ); float2 temp_cast_2 = (_EmissivePannerTilling1).xx; float2 texCoord223 = packedInput.ase_texcoord7.xy * temp_cast_2 + float2( 0,0 ); float2 panner224 = ( ( _TimeParameters.x ) * _PannerProperty1 + texCoord223); float4 tex2DNode228 = tex2D( _EmissivePannerMap1, panner224 ); float2 uv_Roughness = packedInput.ase_texcoord7.xy * _Roughness_ST.xy + _Roughness_ST.zw; float4 temp_output_148_0 = ( 1.0 - tex2D( _Roughness, uv_Roughness ) ); float4 lerpResult119 = lerp( temp_output_148_0 , ( ( ( _RoughnessBoost01 * tex2DNode2.r ) + ( _RoughnessBoost02 * tex2DNode2.g ) + ( _RoughnessBoost03 * tex2DNode2.b ) + ( _RoughnessBoost04 * tex2DNode2.a ) ) * temp_output_148_0 ) , temp_output_27_0); float4 temp_cast_4 = (( _DirtRoughness_Power * _DirtBoots )).xxxx; float4 lerpResult88 = lerp( lerpResult119 , temp_cast_4 , ( _DirtBoots * tex2DNode80.a )); float2 uv_AO = packedInput.ase_texcoord7.xy * _AO_ST.xy + _AO_ST.zw; float4 color219 = IsGammaSpace() ? float4(1,1,1,0) : float4(1,1,1,0); float4 temp_cast_7 = (( tex2DNode1.a * _OpacityBoosts )).xxxx; #ifdef _USEALPHACUTOUT_ON float4 staticSwitch218 = temp_cast_7; #else float4 staticSwitch218 = color219; #endif float4 screenPos = packedInput.ase_texcoord8; float4 ase_screenPosNorm = screenPos / screenPos.w; ase_screenPosNorm.z = ( UNITY_NEAR_CLIP_VALUE >= 0 ) ? ase_screenPosNorm.z : ase_screenPosNorm.z * 0.5 + 0.5; float2 clipScreen212 = ase_screenPosNorm.xy * _ScreenParams.xy; float dither212 = Dither4x4Bayer( fmod(clipScreen212.x, 4), fmod(clipScreen212.y, 4) ); dither212 = step( dither212, ( tex2DNode1.a * _DitherBoosts ) ); surfaceDescription.Albedo = lerpResult87.rgb; surfaceDescription.Normal = UnpackNormalScale( tex2D( _Normal, uv_Normal ), 1.0f ); surfaceDescription.BentNormal = float3( 0, 0, 1 ); surfaceDescription.CoatMask = 0; surfaceDescription.Metallic = lerpResult128.r; #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR surfaceDescription.Specular = 0; #endif surfaceDescription.Emission = ( _Emissivepowerboost1 * ( ( tex2DNode231.r * tex2DNode228 * _EmissiveColor2 * _EmissiveBoots2 ) + ( tex2DNode231.g * tex2DNode228 * _EmissiveColor3 * _EmissiveBoots3 ) + ( tex2DNode231.b * tex2DNode228 * _EmissiveColor4 * _EmissiveBoots4 ) + ( tex2DNode231.a * tex2DNode228 * _EmissiveColor5 * _EmissiveBoots5 ) ) ).rgb; surfaceDescription.Smoothness = lerpResult88.r; surfaceDescription.Occlusion = tex2D( _AO, uv_AO ).r; surfaceDescription.Alpha = staticSwitch218.r; #ifdef _ALPHATEST_ON surfaceDescription.AlphaClipThreshold = ( 1.0 - dither212 ); #endif #ifdef _ENABLE_GEOMETRIC_SPECULAR_AA surfaceDescription.SpecularAAScreenSpaceVariance = 0; surfaceDescription.SpecularAAThreshold = 0; #endif #ifdef _SPECULAR_OCCLUSION_CUSTOM surfaceDescription.SpecularOcclusion = 0; #endif #if defined(_HAS_REFRACTION) || defined(_MATERIAL_FEATURE_TRANSMISSION) surfaceDescription.Thickness = 1; #endif #ifdef _HAS_REFRACTION surfaceDescription.RefractionIndex = 1; surfaceDescription.RefractionColor = float3( 1, 1, 1 ); surfaceDescription.RefractionDistance = 0; #endif #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING surfaceDescription.SubsurfaceMask = 1; #endif #if defined( _MATERIAL_FEATURE_SUBSURFACE_SCATTERING ) || defined( _MATERIAL_FEATURE_TRANSMISSION ) surfaceDescription.DiffusionProfile = 0; #endif #ifdef _MATERIAL_FEATURE_ANISOTROPY surfaceDescription.Anisotropy = 1; surfaceDescription.Tangent = float3( 1, 0, 0 ); #endif #ifdef _MATERIAL_FEATURE_IRIDESCENCE surfaceDescription.IridescenceMask = 0; surfaceDescription.IridescenceThickness = 0; #endif #ifdef _ASE_BAKEDGI surfaceDescription.BakedGI = 0; #endif #ifdef _ASE_BAKEDBACKGI surfaceDescription.BakedBackGI = 0; #endif #ifdef _DEPTHOFFSET_ON surfaceDescription.DepthOffset = 0; #endif SurfaceData surfaceData; BuiltinData builtinData; GetSurfaceAndBuiltinData(surfaceDescription,input, V, posInput, surfaceData, builtinData); BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); PreLightData preLightData = GetPreLightData(V, posInput, bsdfData); outColor = float4(0.0, 0.0, 0.0, 0.0); #ifdef DEBUG_DISPLAY #ifdef OUTPUT_SPLIT_LIGHTING outDiffuseLighting = 0; ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); #endif bool viewMaterial = false; int bufferSize = int(_DebugViewMaterialArray[0]); if (bufferSize != 0) { bool needLinearToSRGB = false; float3 result = float3(1.0, 0.0, 1.0); for (int index = 1; index <= bufferSize; index++) { int indexMaterialProperty = int(_DebugViewMaterialArray[index]); if (indexMaterialProperty != 0) { viewMaterial = true; GetPropertiesDataDebug(indexMaterialProperty, result, needLinearToSRGB); GetVaryingsDataDebug(indexMaterialProperty, input, result, needLinearToSRGB); GetBuiltinDataDebug(indexMaterialProperty, builtinData, result, needLinearToSRGB); GetSurfaceDataDebug(indexMaterialProperty, surfaceData, result, needLinearToSRGB); GetBSDFDataDebug(indexMaterialProperty, bsdfData, result, needLinearToSRGB); } } if (!needLinearToSRGB) result = SRGBToLinear(max(0, result)); outColor = float4(result, 1.0); } if (!viewMaterial) { if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_DIFFUSE_COLOR || _DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_SPECULAR_COLOR) { float3 result = float3(0.0, 0.0, 0.0); GetPBRValidatorDebug(surfaceData, result); outColor = float4(result, 1.0f); } else if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_TRANSPARENCY_OVERDRAW) { float4 result = _DebugTransparencyOverdrawWeight * float4(TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_A); outColor = result; } else #endif { #ifdef _SURFACE_TYPE_TRANSPARENT uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_TRANSPARENT; #else uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_OPAQUE; #endif float3 diffuseLighting; float3 specularLighting; LightLoop(V, posInput, preLightData, bsdfData, builtinData, featureFlags, diffuseLighting, specularLighting); diffuseLighting *= GetCurrentExposureMultiplier(); specularLighting *= GetCurrentExposureMultiplier(); #ifdef OUTPUT_SPLIT_LIGHTING if (_EnableSubsurfaceScattering != 0 && ShouldOutputSplitLighting(bsdfData)) { outColor = float4(specularLighting, 1.0); outDiffuseLighting = float4(TagLightingForSSS(diffuseLighting), 1.0); } else { outColor = float4(diffuseLighting + specularLighting, 1.0); outDiffuseLighting = 0; } ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); #else outColor = ApplyBlendMode(diffuseLighting, specularLighting, builtinData.opacity); outColor = EvaluateAtmosphericScattering(posInput, V, outColor); #endif #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR float4 VPASSpositionCS = float4(packedInput.vpassPositionCS.xy, 0.0, packedInput.vpassPositionCS.z); float4 VPASSpreviousPositionCS = float4(packedInput.vpassPreviousPositionCS.xy, 0.0, packedInput.vpassPreviousPositionCS.z); bool forceNoMotion = any(unity_MotionVectorsParams.yw == 0.0); if (!forceNoMotion) { float2 motionVec = CalculateMotionVector(VPASSpositionCS, VPASSpreviousPositionCS); EncodeMotionVector(motionVec * 0.5, outMotionVec); outMotionVec.zw = 1.0; } #endif } #ifdef DEBUG_DISPLAY } #endif #ifdef _DEPTHOFFSET_ON outputDepth = posInput.deviceDepth; #endif } ENDHLSL } } CustomEditor "UnityEditor.Rendering.HighDefinition.HDLitGUI" } /*ASEBEGIN Version=18500 2560;0;2560;1059;1294.767;2768.709;1.393682;True;False Node;AmplifyShaderEditor.SamplerNode;2;-3535.044,-1144.979;Inherit;True;Property;_Mask;Mask;8;0;Create;True;0;0;False;0;False;-1;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.SamplerNode;54;-2882.484,549.7479;Inherit;True;Property;_Texture04;Texture 04;36;0;Create;True;0;0;False;0;False;-1;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.SamplerNode;43;-2881.104,4.529496;Inherit;True;Property;_Texture02;Texture 02;34;0;Create;True;0;0;False;0;False;-1;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.SamplerNode;39;-2885.036,-281.1397;Inherit;True;Property;_Texture01;Texture 01;33;0;Create;True;0;0;False;0;False;-1;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.SamplerNode;50;-2882.945,273.4547;Inherit;True;Property;_Texture03;Texture 03;35;0;Create;True;0;0;False;0;False;-1;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.SamplerNode;1;-3525.175,-949.9409;Inherit;True;Property;_BC;Base Color;19;0;Create;False;0;0;False;0;False;-1;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.LerpOp;57;-2468.646,256.5266;Inherit;False;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.LerpOp;56;-2486.201,-16.73898;Inherit;False;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.LerpOp;58;-2457.471,532.6592;Inherit;False;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.RangedFloatNode;221;-3692.704,-2630.711;Inherit;False;Property;_EmissivePannerTilling1;Emissive Panner Tilling;48;0;Create;True;0;0;False;0;False;1;0;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.LerpOp;55;-2491.789,-300.0495;Inherit;False;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.TextureCoordinatesNode;223;-3365.707,-2655.456;Inherit;False;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.RangedFloatNode;197;-3355.767,-1809.179;Inherit;False;Property;_BlendColorPower03;Blend Color Power 03;25;0;Create;True;0;0;False;0;False;0;0;0;1;0;1;FLOAT;0 Node;AmplifyShaderEditor.TimeNode;220;-3349.707,-2367.457;Inherit;False;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.ColorNode;8;-3450.762,-1339.998;Float;False;Property;_BlendColor01;Blend Color 01;20;0;Create;True;0;0;False;0;False;1,1,1,0;1,1,1,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.StaticSwitch;63;-2211.201,-1.129412;Float;False;Property;_BlendTexture04;Blend Texture 04;32;0;Create;True;0;0;False;0;False;0;0;0;True;;Toggle;2;Key0;Key1;Create;False;True;9;1;COLOR;0,0,0,0;False;0;COLOR;0,0,0,0;False;2;COLOR;0,0,0,0;False;3;COLOR;0,0,0,0;False;4;COLOR;0,0,0,0;False;5;COLOR;0,0,0,0;False;6;COLOR;0,0,0,0;False;7;COLOR;0,0,0,0;False;8;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.RangedFloatNode;91;-400.3015,-255.9852;Float;False;Property;_RoughnessBoost02;Roughness Boost 02;16;0;Create;True;0;0;False;0;False;1;0;0;4;0;1;FLOAT;0 Node;AmplifyShaderEditor.StaticSwitch;62;-2210.348,-111.9511;Float;False;Property;_BlendTexture03;Blend Texture 03;31;0;Create;True;0;0;False;0;False;0;0;0;True;;Toggle;2;Key0;Key1;Create;False;True;9;1;COLOR;0,0,0,0;False;0;COLOR;0,0,0,0;False;2;COLOR;0,0,0,0;False;3;COLOR;0,0,0,0;False;4;COLOR;0,0,0,0;False;5;COLOR;0,0,0,0;False;6;COLOR;0,0,0,0;False;7;COLOR;0,0,0,0;False;8;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.ColorNode;15;-2668.823,-1342.768;Float;False;Property;_BlendColor04;Blend Color 04;26;0;Create;True;0;0;False;0;False;1,1,1,0;1,1,1,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.ColorNode;13;-2913.226,-1337.567;Float;False;Property;_BlendColor03;Blend Color 03;24;0;Create;True;0;0;False;0;False;1,1,1,0;1,1,1,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.RangedFloatNode;195;-3360.794,-1960.822;Inherit;False;Property;_BlendColorPower02;Blend Color Power 02;23;0;Create;True;0;0;False;0;False;0;0;0;1;0;1;FLOAT;0 Node;AmplifyShaderEditor.Vector2Node;222;-3333.707,-2527.456;Float;False;Property;_PannerProperty1;Panner Property;49;0;Create;True;0;0;False;0;False;0,0;0.1,0.1;0;3;FLOAT2;0;FLOAT;1;FLOAT;2 Node;AmplifyShaderEditor.RangedFloatNode;79;-402.4765,-391.8103;Float;False;Property;_RoughnessBoost01;Roughness Boost 01;15;0;Create;True;0;0;False;0;False;1;0;0;4;0;1;FLOAT;0 Node;AmplifyShaderEditor.ColorNode;10;-3192.849,-1341.105;Float;False;Property;_BlendColor02;Blend Color 02;22;0;Create;True;0;0;False;0;False;1,1,1,0;1,1,1,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.StaticSwitch;60;-2213.897,-327.3228;Float;False;Property;_BlendTexture01;Blend Texture 01;29;0;Create;True;0;0;False;0;False;0;0;0;True;;Toggle;2;Key0;Key1;Create;False;True;9;1;COLOR;0,0,0,0;False;0;COLOR;0,0,0,0;False;2;COLOR;0,0,0,0;False;3;COLOR;0,0,0,0;False;4;COLOR;0,0,0,0;False;5;COLOR;0,0,0,0;False;6;COLOR;0,0,0,0;False;7;COLOR;0,0,0,0;False;8;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.RangedFloatNode;93;-406.3015,-131.9857;Float;False;Property;_RoughnessBoost03;Roughness Boost 03;17;0;Create;True;0;0;False;0;False;1;0;0;4;0;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode;95;-403.0368,3.306535;Float;False;Property;_RoughnessBoost04;Roughness Boost 04;18;0;Create;True;0;0;False;0;False;1;0;0;4;0;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode;194;-3361.044,-1646.038;Inherit;False;Property;_BlendColorPower04;Blend Color Power 04;27;0;Create;True;0;0;False;0;False;0;0;0;1;0;1;FLOAT;0 Node;AmplifyShaderEditor.StaticSwitch;61;-2210.348,-219.3009;Float;False;Property;_BlendTexture02;Blend Texture 02;30;0;Create;True;0;0;False;0;False;0;0;0;True;;Toggle;2;Key0;Key1;Create;False;True;9;1;COLOR;0,0,0,0;False;0;COLOR;0,0,0,0;False;2;COLOR;0,0,0,0;False;3;COLOR;0,0,0,0;False;4;COLOR;0,0,0,0;False;5;COLOR;0,0,0,0;False;6;COLOR;0,0,0,0;False;7;COLOR;0,0,0,0;False;8;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.RangedFloatNode;196;-3360.974,-2093.263;Inherit;False;Property;_BlendColorPower01;Blend Color Power 01;21;0;Create;True;0;0;False;0;False;0;0;0;1;0;1;FLOAT;0 Node;AmplifyShaderEditor.PannerNode;224;-3045.707,-2495.456;Inherit;False;3;0;FLOAT2;0,0;False;2;FLOAT2;0,0;False;1;FLOAT;1;False;1;FLOAT2;0 Node;AmplifyShaderEditor.RangedFloatNode;101;445.4806,-377.6093;Float;False;Property;_MetallicBoots01;Metallic Boots 01;10;0;Create;True;0;0;False;0;False;1;0;0;4;0;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;201;-3024.749,-2094.943;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;112;-112.5647,-257.5991;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;114;-99.56467,-2.599104;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;111;-78.76467,-418.1983;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.LerpOp;31;-2424.927,-1526.771;Inherit;False;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.SamplerNode;77;-680.8719,316.6916;Inherit;True;Property;_Roughness;Roughness;14;0;Create;True;0;0;False;0;False;-1;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;64;-1853.199,-516.6637;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.LerpOp;28;-3058.5,-1532.375;Inherit;False;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;113;-105.5647,-130.5991;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.LerpOp;29;-2838.645,-1527.308;Inherit;False;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;199;-3050.791,-1650.632;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode;107;444.9202,17.50798;Float;False;Property;_MetallicBoots04;Metallic Boots 04;13;0;Create;True;0;0;False;0;False;1;0;0;4;0;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;200;-3046.512,-1812.475;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;67;-1851.464,-174.6741;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;66;-1853.199,-282.3062;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.RangedFloatNode;102;447.6557,-241.7838;Float;False;Property;_MetallicBoots02;Metallic Boots 02;11;0;Create;True;0;0;False;0;False;1;0;0;4;0;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;198;-3025.083,-1951.034;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.LerpOp;30;-2619.482,-1529.94;Inherit;False;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.RangedFloatNode;104;442.6555,-117.7843;Float;False;Property;_MetallicBoots03;Metallic Boots 03;12;0;Create;True;0;0;False;0;False;1;0;0;4;0;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;65;-1854.932,-396.8809;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.ColorNode;225;-3312.772,-3476.736;Float;False;Property;_EmissiveColor2;Emissive Color 01;39;0;Create;True;0;0;False;0;False;0,0,0,0;0.4009434,0.8080564,1,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.RangedFloatNode;226;-2911.139,-2826.751;Float;False;Property;_EmissiveBoots4;Emissive Boots 3;44;0;Create;True;0;0;False;0;False;0;0;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.ColorNode;227;-3314.189,-3285.786;Float;False;Property;_EmissiveColor3;Emissive Color 02;41;0;Create;True;0;0;False;0;False;0,0,0,0;0,0.6797385,1,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.SimpleAddOpNode;118;193.2208,-212.1163;Inherit;False;4;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SamplerNode;231;-2912.769,-3609.988;Inherit;True;Property;_EmissiveMask1;Emissive Mask;37;0;Create;True;0;0;False;0;False;-1;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.ColorNode;232;-3312.364,-3083.275;Float;False;Property;_EmissiveColor4;Emissive Color 03;43;0;Create;True;0;0;False;0;False;0,0,0,0;0.4009434,0.8080564,1,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.SamplerNode;228;-2773.707,-2495.456;Inherit;True;Property;_EmissivePannerMap1;Emissive Panner Map;47;0;Create;True;0;0;False;0;False;-1;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.RangedFloatNode;230;-2908.725,-2990.456;Float;False;Property;_EmissiveBoots2;Emissive Boots 1;40;0;Create;True;0;0;False;0;False;0;0;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode;233;-2910.871,-2905.79;Float;False;Property;_EmissiveBoots3;Emissive Boots 2;42;0;Create;True;0;0;False;0;False;0;2;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.ColorNode;229;-3309.588,-2885.105;Float;False;Property;_EmissiveColor5;Emissive Color 04;45;0;Create;True;0;0;False;0;False;0,0,0,0;0,0.6797385,1,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.RangedFloatNode;214;2.285561,-618.9001;Float;False;Property;_DitherBoosts;Dither Boosts;2;0;Create;True;0;0;False;0;False;1;0;0;10;0;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;123;755.8947,10.45098;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleAddOpNode;27;-2607.623,-1108.547;Inherit;False;4;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;121;742.8947,-244.5489;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode;234;-2911.944,-2751.472;Float;False;Property;_EmissiveBoots5;Emissive Boots 4;46;0;Create;True;0;0;False;0;False;0;0;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleAddOpNode;181;-2707.118,-1788.901;Inherit;False;4;4;0;COLOR;0,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;1;COLOR;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;122;749.8947,-117.549;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleAddOpNode;70;-1467.807,-348.2731;Inherit;False;4;4;0;COLOR;0,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;1;COLOR;0 Node;AmplifyShaderEditor.SimpleAddOpNode;202;-2779.849,-2082.889;Inherit;True;4;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;120;734.8947,-376.5493;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.OneMinusNode;148;-335.2743,319.5164;Inherit;False;1;0;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;236;-2292.133,-3203.789;Inherit;False;4;4;0;FLOAT;0;False;1;COLOR;0,0,0,0;False;2;COLOR;0,0,0,0;False;3;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.SamplerNode;80;-838.1128,-1503.332;Inherit;True;Property;_Dirt;Dirt;3;0;Create;True;0;0;False;0;False;-1;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.SamplerNode;76;324.6086,198.0175;Inherit;True;Property;_Metallic;Metallic;9;0;Create;True;0;0;False;0;False;-1;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;237;-2273.441,-2855.357;Inherit;False;4;4;0;FLOAT;0;False;1;COLOR;0,0,0,0;False;2;COLOR;0,0,0,0;False;3;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;238;-2278.732,-2995.544;Inherit;False;4;4;0;FLOAT;0;False;1;COLOR;0,0,0,0;False;2;COLOR;0,0,0,0;False;3;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.SimpleAddOpNode;127;1048.68,-199.0663;Inherit;False;4;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode;215;-18.36774,-925.219;Float;False;Property;_OpacityBoosts;Opacity Boosts;1;0;Create;True;0;0;False;0;False;9.5;0;0;20;0;1;FLOAT;0 Node;AmplifyShaderEditor.LerpOp;132;-2183.457,-1796.143;Inherit;False;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.LerpOp;71;-1243.507,-392.5125;Inherit;False;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;117;75.43529,107.4009;Inherit;False;2;2;0;FLOAT;0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.RangedFloatNode;149;-791.2319,-1305.685;Float;False;Property;_DirtRoughness_Power;DirtRoughness_Power;5;0;Create;True;0;0;False;0;False;0;0;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode;86;-817.8184,-1613.895;Float;False;Property;_DirtBoots;Dirt Boots;4;0;Create;True;0;0;False;0;False;0;0;0;2;0;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;235;-2294.177,-3384.571;Inherit;False;4;4;0;FLOAT;0;False;1;COLOR;0,0,0,0;False;2;COLOR;0,0,0,0;False;3;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;213;307.4252,-716.8876;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.ColorNode;219;540.7869,-1196.996;Inherit;False;Constant;_ZeroMask;Zero Mask;51;0;Create;True;0;0;False;0;False;1,1,1,0;0,0,0,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;84;-92.35083,-1627.187;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.LerpOp;119;55.27619,230.8377;Inherit;False;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;82;-92.35077,-1376.695;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;83;-95.50151,-1501.153;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode;240;-1408.035,-3003.794;Inherit;False;Property;_Emissivepowerboost1;Emissive power boost;38;0;Create;True;0;0;False;0;False;100;100;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;81;-92.35077,-1247.51;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleAddOpNode;239;-2040.737,-3169.392;Inherit;False;4;4;0;COLOR;0,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;1;COLOR;0 Node;AmplifyShaderEditor.StaticSwitch;72;-834.3411,-172.6555;Float;False;Property;_BlendTextureMode;Blend Texture Mode;28;0;Create;True;0;0;False;0;False;0;0;0;True;;Toggle;2;Key0;Key1;Create;False;True;9;1;COLOR;0,0,0,0;False;0;COLOR;0,0,0,0;False;2;COLOR;0,0,0,0;False;3;COLOR;0,0,0,0;False;4;COLOR;0,0,0,0;False;5;COLOR;0,0,0,0;False;6;COLOR;0,0,0,0;False;7;COLOR;0,0,0,0;False;8;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;126;916.8947,127.451;Inherit;False;2;2;0;FLOAT;0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.DitheringNode;212;513.7151,-726.3499;Inherit;False;0;False;3;0;FLOAT;0;False;1;SAMPLER2D;;False;2;FLOAT4;0,0,0,0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;216;405.9136,-967.275;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.LerpOp;88;406.5401,-1375.647;Inherit;False;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;241;-1186.587,-2747.326;Inherit;False;2;2;0;FLOAT;0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.LerpOp;87;402.7515,-1621.183;Inherit;False;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.StaticSwitch;218;831.787,-1002.996;Inherit;False;Property;_UseAlphaCutOut;Use Alpha Cut Out;0;0;Create;True;0;0;False;0;False;0;0;0;True;;Toggle;2;Key0;Key1;Create;True;True;9;1;COLOR;0,0,0,0;False;0;COLOR;0,0,0,0;False;2;COLOR;0,0,0,0;False;3;COLOR;0,0,0,0;False;4;COLOR;0,0,0,0;False;5;COLOR;0,0,0,0;False;6;COLOR;0,0,0,0;False;7;COLOR;0,0,0,0;False;8;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.SamplerNode;75;-245.3056,-2467.307;Inherit;True;Property;_Normal;Normal;7;0;Create;True;0;0;False;0;False;-1;None;None;True;0;True;bump;Auto;True;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.LerpOp;128;1227.782,296.8482;Inherit;False;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.SamplerNode;74;-251.6975,-1947.125;Inherit;True;Property;_AO;AO;6;0;Create;True;0;0;False;0;False;-1;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.OneMinusNode;217;742.1119,-728.9263;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;172;1442.579,-1523.725;Float;False;False;-1;2;UnityEditor.Rendering.HighDefinition.HDLitGUI;0;1;New Amplify Shader;53b46d85872c5b24c8f4f0a1c3fe4c87;True;ShadowCaster;0;2;ShadowCaster;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;3;RenderPipeline=HDRenderPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;5;0;False;False;False;False;False;False;False;False;False;True;0;True;-25;True;False;False;False;False;0;False;-1;False;False;False;False;True;1;False;-1;True;3;False;-1;False;True;1;LightMode=ShadowCaster;False;0;;0;0;Standard;0;False;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;175;1442.579,-1523.725;Float;False;False;-1;2;UnityEditor.Rendering.HighDefinition.HDLitGUI;0;1;New Amplify Shader;53b46d85872c5b24c8f4f0a1c3fe4c87;True;Motion Vectors;0;5;Motion Vectors;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;3;RenderPipeline=HDRenderPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;5;0;False;False;False;False;False;False;False;False;False;True;0;True;-25;False;False;False;False;True;True;0;True;-8;255;False;-1;255;True;-9;7;False;-1;3;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;True;1;False;-1;False;False;True;1;LightMode=MotionVectors;False;0;;0;0;Standard;0;False;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;173;1442.579,-1523.725;Float;False;False;-1;2;UnityEditor.Rendering.HighDefinition.HDLitGUI;0;1;New Amplify Shader;53b46d85872c5b24c8f4f0a1c3fe4c87;True;SceneSelectionPass;0;3;SceneSelectionPass;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;3;RenderPipeline=HDRenderPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;5;0;False;False;False;False;False;False;False;False;False;False;True;False;False;False;False;0;False;-1;False;False;False;False;False;False;False;True;1;LightMode=SceneSelectionPass;False;0;;0;0;Standard;0;False;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;178;1442.579,-1523.725;Float;False;False;-1;2;UnityEditor.Rendering.HighDefinition.HDLitGUI;0;1;New Amplify Shader;53b46d85872c5b24c8f4f0a1c3fe4c87;True;TransparentDepthPrepass;0;8;TransparentDepthPrepass;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;3;RenderPipeline=HDRenderPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;5;0;True;1;1;False;-1;0;False;-1;0;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;True;0;True;-25;True;False;False;False;False;0;False;-1;False;False;False;False;True;1;False;-1;False;False;True;1;LightMode=TransparentDepthPrepass;False;0;;0;0;Standard;0;False;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;179;1442.579,-1523.725;Float;False;False;-1;2;UnityEditor.Rendering.HighDefinition.HDLitGUI;0;1;New Amplify Shader;53b46d85872c5b24c8f4f0a1c3fe4c87;True;TransparentDepthPostpass;0;9;TransparentDepthPostpass;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;3;RenderPipeline=HDRenderPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;5;0;True;1;1;False;-1;0;False;-1;0;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;True;0;True;-25;True;False;False;False;False;0;False;-1;False;False;False;False;True;1;False;-1;False;False;True;1;LightMode=TransparentDepthPostpass;False;0;;0;0;Standard;0;False;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;180;1442.579,-1523.725;Float;False;False;-1;2;UnityEditor.Rendering.HighDefinition.HDLitGUI;0;1;New Amplify Shader;53b46d85872c5b24c8f4f0a1c3fe4c87;True;Forward;0;10;Forward;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;3;RenderPipeline=HDRenderPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;5;0;True;1;0;True;-19;0;True;-20;1;0;True;-21;0;True;-22;False;False;False;False;False;False;False;False;True;0;True;-28;False;True;True;True;True;True;0;True;-44;False;False;True;True;0;True;-4;255;False;-1;255;True;-5;7;False;-1;3;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;True;0;True;-23;True;0;True;-30;False;True;1;LightMode=Forward;False;0;;0;0;Standard;0;False;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;171;1442.579,-1523.725;Float;False;False;-1;2;UnityEditor.Rendering.HighDefinition.HDLitGUI;0;1;New Amplify Shader;53b46d85872c5b24c8f4f0a1c3fe4c87;True;META;0;1;META;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;3;RenderPipeline=HDRenderPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;5;0;False;False;False;False;False;False;False;False;False;True;2;False;-1;False;False;False;False;False;False;False;False;True;1;LightMode=Meta;False;0;;0;0;Standard;0;False;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;174;1442.579,-1523.725;Float;False;False;-1;2;UnityEditor.Rendering.HighDefinition.HDLitGUI;0;1;New Amplify Shader;53b46d85872c5b24c8f4f0a1c3fe4c87;True;DepthOnly;0;4;DepthOnly;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;3;RenderPipeline=HDRenderPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;5;0;False;False;False;False;False;False;False;False;False;True;0;True;-25;False;False;False;False;True;True;0;True;-6;255;False;-1;255;True;-7;7;False;-1;3;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;True;1;False;-1;False;False;True;1;LightMode=DepthOnly;False;0;;0;0;Standard;0;False;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;176;1442.579,-1523.725;Float;False;False;-1;2;UnityEditor.Rendering.HighDefinition.HDLitGUI;0;1;New Amplify Shader;53b46d85872c5b24c8f4f0a1c3fe4c87;True;Distortion;0;6;Distortion;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;3;RenderPipeline=HDRenderPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;5;0;True;4;1;False;-1;1;False;-1;4;1;False;-1;1;False;-1;True;1;False;-1;1;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;True;True;0;True;-10;255;False;-1;255;True;-11;7;False;-1;3;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;True;2;False;-1;True;3;False;-1;False;True;1;LightMode=DistortionVectors;False;0;;0;0;Standard;0;False;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;177;1442.579,-1523.725;Float;False;False;-1;2;UnityEditor.Rendering.HighDefinition.HDLitGUI;0;1;New Amplify Shader;53b46d85872c5b24c8f4f0a1c3fe4c87;True;TransparentBackface;0;7;TransparentBackface;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;3;RenderPipeline=HDRenderPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;5;0;True;1;0;True;-19;0;True;-20;1;0;True;-21;0;True;-22;False;False;False;False;False;False;False;False;True;1;False;-1;False;True;True;True;True;True;0;True;-44;False;False;False;True;0;True;-23;True;0;True;-31;False;True;1;LightMode=TransparentBackface;False;0;;0;0;Standard;0;False;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;170;1442.579,-1523.725;Float;False;True;-1;2;UnityEditor.Rendering.HighDefinition.HDLitGUI;0;2;DawnShaderHDRP/ClothingShaderHDRP;53b46d85872c5b24c8f4f0a1c3fe4c87;True;GBuffer;0;0;GBuffer;35;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;3;RenderPipeline=HDRenderPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;5;0;False;False;False;False;False;False;False;False;False;True;0;True;-25;False;False;False;False;True;True;0;True;-13;255;False;-1;255;True;-12;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;True;0;True;-14;False;True;1;LightMode=GBuffer;False;0;;0;0;Standard;41;Surface Type;0; Rendering Pass;1; Refraction Model;0; Blending Mode;0; Blend Preserves Specular;1; Receive Fog;1; Back Then Front Rendering;0; Transparent Depth Prepass;0; Transparent Depth Postpass;0; Transparent Writes Motion Vector;0; Distortion;0; Distortion Mode;0; Distortion Depth Test;1; ZWrite;0; Z Test;4;Double-Sided;0;Alpha Clipping;1; Use Shadow Threshold;0;Material Type,InvertActionOnDeselection;0; Energy Conserving Specular;1; Transmission;1;Receive Decals;1;Receives SSR;1;Motion Vectors;1; Add Precomputed Velocity;0;Specular AA;0;Specular Occlusion Mode;1;Override Baked GI;0;Depth Offset;0;DOTS Instancing;0;LOD CrossFade;0;Tessellation;0; Phong;0; Strength;0.5,False,-1; Type;0; Tess;16,False,-1; Min;10,False,-1; Max;25,False,-1; Edge Length;16,False,-1; Max Displacement;25,False,-1;Vertex Position;1;0;11;True;True;True;True;True;True;False;False;False;False;True;False;;False;0 WireConnection;57;1;50;0 WireConnection;57;2;2;3 WireConnection;56;1;43;0 WireConnection;56;2;2;2 WireConnection;58;1;54;0 WireConnection;58;2;2;4 WireConnection;55;1;39;0 WireConnection;55;2;2;1 WireConnection;223;0;221;0 WireConnection;63;1;1;0 WireConnection;63;0;58;0 WireConnection;62;1;1;0 WireConnection;62;0;57;0 WireConnection;60;1;1;0 WireConnection;60;0;55;0 WireConnection;61;1;1;0 WireConnection;61;0;56;0 WireConnection;224;0;223;0 WireConnection;224;2;222;0 WireConnection;224;1;220;2 WireConnection;201;0;196;0 WireConnection;201;1;2;1 WireConnection;112;0;91;0 WireConnection;112;1;2;2 WireConnection;114;0;95;0 WireConnection;114;1;2;4 WireConnection;111;0;79;0 WireConnection;111;1;2;1 WireConnection;31;1;15;0 WireConnection;31;2;2;4 WireConnection;64;0;60;0 WireConnection;64;1;2;1 WireConnection;28;1;8;0 WireConnection;28;2;2;1 WireConnection;113;0;93;0 WireConnection;113;1;2;3 WireConnection;29;1;10;0 WireConnection;29;2;2;2 WireConnection;199;0;194;0 WireConnection;199;1;2;4 WireConnection;200;0;197;0 WireConnection;200;1;2;3 WireConnection;67;0;63;0 WireConnection;67;1;2;4 WireConnection;66;0;62;0 WireConnection;66;1;2;3 WireConnection;198;0;195;0 WireConnection;198;1;2;2 WireConnection;30;1;13;0 WireConnection;30;2;2;3 WireConnection;65;0;61;0 WireConnection;65;1;2;2 WireConnection;118;0;111;0 WireConnection;118;1;112;0 WireConnection;118;2;113;0 WireConnection;118;3;114;0 WireConnection;228;1;224;0 WireConnection;123;0;107;0 WireConnection;123;1;2;4 WireConnection;27;0;2;1 WireConnection;27;1;2;2 WireConnection;27;2;2;3 WireConnection;27;3;2;4 WireConnection;121;0;102;0 WireConnection;121;1;2;2 WireConnection;181;0;28;0 WireConnection;181;1;29;0 WireConnection;181;2;30;0 WireConnection;181;3;31;0 WireConnection;122;0;104;0 WireConnection;122;1;2;3 WireConnection;70;0;64;0 WireConnection;70;1;65;0 WireConnection;70;2;66;0 WireConnection;70;3;67;0 WireConnection;202;0;201;0 WireConnection;202;1;198;0 WireConnection;202;2;200;0 WireConnection;202;3;199;0 WireConnection;120;0;101;0 WireConnection;120;1;2;1 WireConnection;148;0;77;0 WireConnection;236;0;231;2 WireConnection;236;1;228;0 WireConnection;236;2;227;0 WireConnection;236;3;233;0 WireConnection;237;0;231;4 WireConnection;237;1;228;0 WireConnection;237;2;229;0 WireConnection;237;3;234;0 WireConnection;238;0;231;3 WireConnection;238;1;228;0 WireConnection;238;2;232;0 WireConnection;238;3;226;0 WireConnection;127;0;120;0 WireConnection;127;1;121;0 WireConnection;127;2;122;0 WireConnection;127;3;123;0 WireConnection;132;0;1;0 WireConnection;132;1;181;0 WireConnection;132;2;202;0 WireConnection;71;0;1;0 WireConnection;71;1;70;0 WireConnection;71;2;27;0 WireConnection;117;0;118;0 WireConnection;117;1;148;0 WireConnection;235;0;231;1 WireConnection;235;1;228;0 WireConnection;235;2;225;0 WireConnection;235;3;230;0 WireConnection;213;0;1;4 WireConnection;213;1;214;0 WireConnection;84;0;80;0 WireConnection;84;1;86;0 WireConnection;119;0;148;0 WireConnection;119;1;117;0 WireConnection;119;2;27;0 WireConnection;82;0;149;0 WireConnection;82;1;86;0 WireConnection;83;0;86;0 WireConnection;83;1;80;4 WireConnection;81;0;86;0 WireConnection;81;1;80;4 WireConnection;239;0;235;0 WireConnection;239;1;236;0 WireConnection;239;2;238;0 WireConnection;239;3;237;0 WireConnection;72;1;132;0 WireConnection;72;0;71;0 WireConnection;126;0;127;0 WireConnection;126;1;76;0 WireConnection;212;0;213;0 WireConnection;216;0;1;4 WireConnection;216;1;215;0 WireConnection;88;0;119;0 WireConnection;88;1;82;0 WireConnection;88;2;81;0 WireConnection;241;0;240;0 WireConnection;241;1;239;0 WireConnection;87;0;72;0 WireConnection;87;1;84;0 WireConnection;87;2;83;0 WireConnection;218;1;219;0 WireConnection;218;0;216;0 WireConnection;128;0;76;0 WireConnection;128;1;126;0 WireConnection;128;2;27;0 WireConnection;217;0;212;0 WireConnection;170;0;87;0 WireConnection;170;1;75;0 WireConnection;170;4;128;0 WireConnection;170;6;241;0 WireConnection;170;7;88;0 WireConnection;170;8;74;0 WireConnection;170;9;218;0 WireConnection;170;10;217;0 ASEEND*/ //CHKSM=696A3F382C0BB971B0D824824903152286914598