// Made with Amplify Shader Editor // Available at the Unity Asset Store - http://u3d.as/y3X Shader "DawnShaderHDRP/SkinShaderHDRP" { Properties { [HideInInspector] _EmissionColor("Emission Color", Color) = (1,1,1,1) [HideInInspector] _AlphaCutoff("Alpha Cutoff ", Range(0, 1)) = 0.5 [ASEBegin]_Dirt("Dirt", 2D) = "white" {} _DirtBoots("Dirt Boots", Range( 0 , 1)) = 0 _DirtRoughness_Power("DirtRoughness_Power", Float) = 0 _LipsNailRoughnessBoost("Lips/Nail Roughness Boost", Range( 0 , 1)) = 0.75 _AO("AO", 2D) = "white" {} _SkinPore("Skin Pore", 2D) = "bump" {} _SkinPore_Tilling("SkinPore_Tilling", Float) = 35 _SkinPore_Power("SkinPore_Power", Range( 0 , 1)) = 0.25 _SkinNormal("Skin Normal", 2D) = "bump" {} _Mask("Mask", 2D) = "white" {} _SSSMask("SSS Mask", 2D) = "white" {} _SSSonoff("SSS on/off", Range( 0 , 4)) = 1.2 [HideInInspector]_DiffusionProfileAsset("Profile", Vector) = ( -140543700173518390000000000000000, 0.000000000000000000000000020030988757709214, 0.000000063132063132798066, -0.0000000000000000044045647082774613 ) [HideInInspector]_DiffusionProfileHash("Profile", Float) = 2.7317202091217041 _SkinRoughness("Skin Roughness", 2D) = "white" {} _RoughnessMod_R("RoughnessMod_R", 2D) = "white" {} _SkinRounghnessBoots("Skin Rounghness Boots", Range( 0 , 1)) = 0 _SkinColor("Skin Color", 2D) = "white" {} _BaseColorMul("BaseColorMul", Color) = (1,1,1,0) _ColorPow("Color Pow", Range( 0 , 10)) = 0 _LipNailColor("Lip/Nail Color", Color) = (1,1,1,0) _LipNailColorPower("Lip/Nail Color Power", Range( 0 , 1)) = 0 _FreaklesColor("Freakles Color", Color) = (1,1,1,0) _FreaklesColorPower("Freakles Color Power", Range( 0 , 20)) = 0 _HairCapShortColor("HairCap Short Color", Color) = (1,1,1,0) _HairCapShortColorPower("HairCap Short Color Power", Range( 0 , 5)) = 0 _HairCapLongColor("HairCap Long Color", Color) = (1,1,1,0) _HairCapLongColorPower("HairCap Long Color Power", Range( 0 , 5)) = 0 _HairCapRoughness("HairCap Roughness", Range( 0 , 1)) = 0.6 _EmissiveMask("Emissive Mask", 2D) = "white" {} _Emissivepowerboost("Emissive power boost", Float) = 100 _EmissiveColor1("Emissive Color 1", Color) = (0,0,0,0) _EmissivePower1("Emissive Power 1", Range( 0 , 2000)) = 0 _EmissiveColor2("Emissive Color 2", Color) = (0,0,0,0) _EmissivePower2("Emissive Power 2", Range( 0 , 2000)) = 248.8943 _EmissiveColor3("Emissive Color 3", Color) = (0,0,0,0) _EmissivePower3("Emissive Power 3", Range( 0 , 2000)) = 0 _EmissiveColor4("Emissive Color 4", Color) = (0,0,0,0) _EmissivePower4("Emissive Power 4", Range( 0 , 2000)) = 0 _EmissivePannerMap("Emissive Panner Map", 2D) = "white" {} _EmissivePannerTilling("Emissive Panner Tilling", Float) = 1 [ASEEnd]_PannerProperty("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) = 1 [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) = 0 [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 _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 #define _SPECULAR_OCCLUSION_FROM_AO 1 #define _MATERIAL_FEATURE_TRANSMISSION 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" #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; 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 _BaseColorMul; float4 _EmissiveMask_ST; float4 _EmissiveColor4; float4 _EmissiveColor1; float4 _SkinRoughness_ST; float4 _SkinNormal_ST; float4 _RoughnessMod_R_ST; float4 _EmissiveColor2; float4 _Dirt_ST; float4 _HairCapLongColor; float4 _HairCapShortColor; float4 _FreaklesColor; float4 _Mask_ST; float4 _LipNailColor; float4 _SkinColor_ST; float4 _SSSMask_ST; float4 _AO_ST; float4 _EmissiveColor3; float2 _PannerProperty; float _LipsNailRoughnessBoost; float _HairCapRoughness; float _DirtRoughness_Power; float _SkinRounghnessBoots; float _EmissivePower4; float _EmissivePower3; float _EmissivePower1; float _EmissivePannerTilling; float _SSSonoff; float _Emissivepowerboost; float _SkinPore_Power; float _SkinPore_Tilling; float _DirtBoots; float _HairCapLongColorPower; float _HairCapShortColorPower; float _FreaklesColorPower; float _LipNailColorPower; float _ColorPow; float _EmissivePower2; float _DiffusionProfileHash; 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 _SkinColor; sampler2D _Mask; SAMPLER(sampler_Mask); sampler2D _Dirt; SAMPLER(sampler_Dirt); sampler2D _SkinNormal; sampler2D _SkinPore; sampler2D _EmissiveMask; SAMPLER(sampler_EmissiveMask); sampler2D _EmissivePannerMap; sampler2D _SkinRoughness; sampler2D _RoughnessMod_R; SAMPLER(sampler_RoughnessMod_R); sampler2D _AO; sampler2D _SSSMask; SAMPLER(sampler_SSSMask); 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 ); 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; float4 saferPower136 = max( _BaseColorMul , 0.0001 ); float4 temp_cast_0 = (_ColorPow).xxxx; float2 uv_SkinColor = packedInput.ase_texcoord5.xy * _SkinColor_ST.xy + _SkinColor_ST.zw; float2 uv_Mask = packedInput.ase_texcoord5.xy * _Mask_ST.xy + _Mask_ST.zw; float4 tex2DNode11 = tex2D( _Mask, uv_Mask ); float4 lerpResult124 = lerp( float4( 0,0,0,0 ) , _LipNailColor , tex2DNode11.r); float4 lerpResult125 = lerp( float4( 0,0,0,0 ) , _FreaklesColor , tex2DNode11.g); float4 lerpResult126 = lerp( float4( 0,0,0,0 ) , _HairCapShortColor , tex2DNode11.b); float4 lerpResult127 = lerp( float4( 0,0,0,0 ) , _HairCapLongColor , tex2DNode11.a); float clampResult165 = clamp( ( ( _LipNailColorPower * tex2DNode11.r ) + ( _FreaklesColorPower * tex2DNode11.g ) + ( _HairCapShortColorPower * tex2DNode11.b ) + ( _HairCapLongColorPower * tex2DNode11.a ) ) , 0.0 , 1.0 ); float4 lerpResult140 = lerp( ( pow( saferPower136 , temp_cast_0 ) * tex2D( _SkinColor, uv_SkinColor ) ) , ( lerpResult124 + lerpResult125 + lerpResult126 + lerpResult127 ) , clampResult165); float2 uv_Dirt = packedInput.ase_texcoord5.xy * _Dirt_ST.xy + _Dirt_ST.zw; float4 tex2DNode63 = tex2D( _Dirt, uv_Dirt ); float4 lerpResult70 = lerp( lerpResult140 , ( tex2DNode63 * _DirtBoots ) , ( _DirtBoots * tex2DNode63.a )); float2 uv_SkinNormal = packedInput.ase_texcoord5.xy * _SkinNormal_ST.xy + _SkinNormal_ST.zw; float2 temp_cast_2 = (_SkinPore_Tilling).xx; float2 texCoord94 = packedInput.interp03.xy * temp_cast_2 + float2( 0,0 ); float3 unpack93 = UnpackNormalScale( tex2D( _SkinPore, texCoord94 ), _SkinPore_Power ); unpack93.z = lerp( 1, unpack93.z, saturate(_SkinPore_Power) ); float2 uv_EmissiveMask = packedInput.ase_texcoord5.xy * _EmissiveMask_ST.xy + _EmissiveMask_ST.zw; float4 tex2DNode163 = tex2D( _EmissiveMask, uv_EmissiveMask ); float2 temp_cast_3 = (_EmissivePannerTilling).xx; float2 texCoord142 = packedInput.ase_texcoord5.xy * temp_cast_3 + float2( 0,0 ); float2 panner145 = ( ( _TimeParameters.x ) * _PannerProperty + texCoord142); float4 tex2DNode153 = tex2D( _EmissivePannerMap, panner145 ); float2 uv_SkinRoughness = packedInput.ase_texcoord5.xy * _SkinRoughness_ST.xy + _SkinRoughness_ST.zw; float2 uv_RoughnessMod_R = packedInput.ase_texcoord5.xy * _RoughnessMod_R_ST.xy + _RoughnessMod_R_ST.zw; float4 temp_cast_5 = (( _DirtRoughness_Power * _DirtBoots )).xxxx; float4 lerpResult71 = lerp( ( ( 1.0 - tex2D( _SkinRoughness, uv_SkinRoughness ) ) * ( _SkinRounghnessBoots * tex2D( _RoughnessMod_R, uv_RoughnessMod_R ).a ) ) , temp_cast_5 , ( _DirtBoots * tex2DNode63.a )); float4 temp_cast_6 = (_HairCapRoughness).xxxx; float4 lerpResult180 = lerp( lerpResult71 , temp_cast_6 , ( tex2DNode11.a + tex2DNode11.b )); float4 temp_cast_7 = (_LipsNailRoughnessBoost).xxxx; float4 lerpResult141 = lerp( lerpResult180 , temp_cast_7 , tex2DNode11.r); float4 temp_cast_8 = (0.0).xxxx; float4 temp_cast_9 = (1.0).xxxx; float4 clampResult171 = clamp( lerpResult141 , temp_cast_8 , temp_cast_9 ); float2 uv_AO = packedInput.ase_texcoord5.xy * _AO_ST.xy + _AO_ST.zw; float2 uv_SSSMask = packedInput.ase_texcoord5.xy * _SSSMask_ST.xy + _SSSMask_ST.zw; surfaceDescription.Albedo = lerpResult70.rgb; surfaceDescription.Normal = BlendNormal( UnpackNormalScale( tex2D( _SkinNormal, uv_SkinNormal ), 1.0f ) , unpack93 ); surfaceDescription.BentNormal = float3( 0, 0, 1 ); surfaceDescription.CoatMask = 0; surfaceDescription.Metallic = 0; #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR surfaceDescription.Specular = 0; #endif surfaceDescription.Emission = ( _Emissivepowerboost * ( ( _EmissiveColor1 * _EmissivePower1 * tex2DNode163.r * tex2DNode153 ) + ( _EmissiveColor2 * _EmissivePower2 * tex2DNode163.g * tex2DNode153 ) + ( _EmissiveColor3 * _EmissivePower3 * tex2DNode163.b * tex2DNode153 ) + ( _EmissiveColor4 * _EmissivePower4 * tex2DNode163.a * tex2DNode153 ) ) ).rgb; surfaceDescription.Smoothness = clampResult171.r; surfaceDescription.Occlusion = tex2D( _AO, uv_AO ).r; surfaceDescription.Alpha = 1; #ifdef _ALPHATEST_ON surfaceDescription.AlphaClipThreshold = _AlphaCutoff; #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.0 - tex2D( _SSSMask, uv_SSSMask ).r ); #endif #ifdef _HAS_REFRACTION surfaceDescription.RefractionIndex = 1; surfaceDescription.RefractionColor = float3( 1, 1, 1 ); surfaceDescription.RefractionDistance = 0; #endif #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING surfaceDescription.SubsurfaceMask = _SSSonoff; #endif #if defined( _MATERIAL_FEATURE_SUBSURFACE_SCATTERING ) || defined( _MATERIAL_FEATURE_TRANSMISSION ) surfaceDescription.DiffusionProfile = _DiffusionProfileHash; #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 _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 #define _SPECULAR_OCCLUSION_FROM_AO 1 #define _MATERIAL_FEATURE_TRANSMISSION 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" #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; 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 _BaseColorMul; float4 _EmissiveMask_ST; float4 _EmissiveColor4; float4 _EmissiveColor1; float4 _SkinRoughness_ST; float4 _SkinNormal_ST; float4 _RoughnessMod_R_ST; float4 _EmissiveColor2; float4 _Dirt_ST; float4 _HairCapLongColor; float4 _HairCapShortColor; float4 _FreaklesColor; float4 _Mask_ST; float4 _LipNailColor; float4 _SkinColor_ST; float4 _SSSMask_ST; float4 _AO_ST; float4 _EmissiveColor3; float2 _PannerProperty; float _LipsNailRoughnessBoost; float _HairCapRoughness; float _DirtRoughness_Power; float _SkinRounghnessBoots; float _EmissivePower4; float _EmissivePower3; float _EmissivePower1; float _EmissivePannerTilling; float _SSSonoff; float _Emissivepowerboost; float _SkinPore_Power; float _SkinPore_Tilling; float _DirtBoots; float _HairCapLongColorPower; float _HairCapShortColorPower; float _FreaklesColorPower; float _LipNailColorPower; float _ColorPow; float _EmissivePower2; float _DiffusionProfileHash; 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 _SkinColor; sampler2D _Mask; SAMPLER(sampler_Mask); sampler2D _Dirt; SAMPLER(sampler_Dirt); sampler2D _SkinNormal; sampler2D _SkinPore; sampler2D _EmissiveMask; SAMPLER(sampler_EmissiveMask); sampler2D _EmissivePannerMap; sampler2D _SkinRoughness; sampler2D _RoughnessMod_R; SAMPLER(sampler_RoughnessMod_R); sampler2D _AO; sampler2D _SSSMask; SAMPLER(sampler_SSSMask); 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); outputPackedVaryingsMeshToPS.ase_texcoord.xy = inputMesh.uv0.xy; outputPackedVaryingsMeshToPS.ase_texcoord.zw = inputMesh.uv1.xy; #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; float4 saferPower136 = max( _BaseColorMul , 0.0001 ); float4 temp_cast_0 = (_ColorPow).xxxx; float2 uv_SkinColor = packedInput.ase_texcoord.xy * _SkinColor_ST.xy + _SkinColor_ST.zw; float2 uv_Mask = packedInput.ase_texcoord.xy * _Mask_ST.xy + _Mask_ST.zw; float4 tex2DNode11 = tex2D( _Mask, uv_Mask ); float4 lerpResult124 = lerp( float4( 0,0,0,0 ) , _LipNailColor , tex2DNode11.r); float4 lerpResult125 = lerp( float4( 0,0,0,0 ) , _FreaklesColor , tex2DNode11.g); float4 lerpResult126 = lerp( float4( 0,0,0,0 ) , _HairCapShortColor , tex2DNode11.b); float4 lerpResult127 = lerp( float4( 0,0,0,0 ) , _HairCapLongColor , tex2DNode11.a); float clampResult165 = clamp( ( ( _LipNailColorPower * tex2DNode11.r ) + ( _FreaklesColorPower * tex2DNode11.g ) + ( _HairCapShortColorPower * tex2DNode11.b ) + ( _HairCapLongColorPower * tex2DNode11.a ) ) , 0.0 , 1.0 ); float4 lerpResult140 = lerp( ( pow( saferPower136 , temp_cast_0 ) * tex2D( _SkinColor, uv_SkinColor ) ) , ( lerpResult124 + lerpResult125 + lerpResult126 + lerpResult127 ) , clampResult165); float2 uv_Dirt = packedInput.ase_texcoord.xy * _Dirt_ST.xy + _Dirt_ST.zw; float4 tex2DNode63 = tex2D( _Dirt, uv_Dirt ); float4 lerpResult70 = lerp( lerpResult140 , ( tex2DNode63 * _DirtBoots ) , ( _DirtBoots * tex2DNode63.a )); float2 uv_SkinNormal = packedInput.ase_texcoord.xy * _SkinNormal_ST.xy + _SkinNormal_ST.zw; float2 temp_cast_2 = (_SkinPore_Tilling).xx; float2 texCoord94 = packedInput.ase_texcoord.zw * temp_cast_2 + float2( 0,0 ); float3 unpack93 = UnpackNormalScale( tex2D( _SkinPore, texCoord94 ), _SkinPore_Power ); unpack93.z = lerp( 1, unpack93.z, saturate(_SkinPore_Power) ); float2 uv_EmissiveMask = packedInput.ase_texcoord.xy * _EmissiveMask_ST.xy + _EmissiveMask_ST.zw; float4 tex2DNode163 = tex2D( _EmissiveMask, uv_EmissiveMask ); float2 temp_cast_3 = (_EmissivePannerTilling).xx; float2 texCoord142 = packedInput.ase_texcoord.xy * temp_cast_3 + float2( 0,0 ); float2 panner145 = ( ( _TimeParameters.x ) * _PannerProperty + texCoord142); float4 tex2DNode153 = tex2D( _EmissivePannerMap, panner145 ); float2 uv_SkinRoughness = packedInput.ase_texcoord.xy * _SkinRoughness_ST.xy + _SkinRoughness_ST.zw; float2 uv_RoughnessMod_R = packedInput.ase_texcoord.xy * _RoughnessMod_R_ST.xy + _RoughnessMod_R_ST.zw; float4 temp_cast_5 = (( _DirtRoughness_Power * _DirtBoots )).xxxx; float4 lerpResult71 = lerp( ( ( 1.0 - tex2D( _SkinRoughness, uv_SkinRoughness ) ) * ( _SkinRounghnessBoots * tex2D( _RoughnessMod_R, uv_RoughnessMod_R ).a ) ) , temp_cast_5 , ( _DirtBoots * tex2DNode63.a )); float4 temp_cast_6 = (_HairCapRoughness).xxxx; float4 lerpResult180 = lerp( lerpResult71 , temp_cast_6 , ( tex2DNode11.a + tex2DNode11.b )); float4 temp_cast_7 = (_LipsNailRoughnessBoost).xxxx; float4 lerpResult141 = lerp( lerpResult180 , temp_cast_7 , tex2DNode11.r); float4 temp_cast_8 = (0.0).xxxx; float4 temp_cast_9 = (1.0).xxxx; float4 clampResult171 = clamp( lerpResult141 , temp_cast_8 , temp_cast_9 ); float2 uv_AO = packedInput.ase_texcoord.xy * _AO_ST.xy + _AO_ST.zw; float2 uv_SSSMask = packedInput.ase_texcoord.xy * _SSSMask_ST.xy + _SSSMask_ST.zw; surfaceDescription.Albedo = lerpResult70.rgb; surfaceDescription.Normal = BlendNormal( UnpackNormalScale( tex2D( _SkinNormal, uv_SkinNormal ), 1.0f ) , unpack93 ); surfaceDescription.BentNormal = float3( 0, 0, 1 ); surfaceDescription.CoatMask = 0; surfaceDescription.Metallic = 0; #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR surfaceDescription.Specular = 0; #endif surfaceDescription.Emission = ( _Emissivepowerboost * ( ( _EmissiveColor1 * _EmissivePower1 * tex2DNode163.r * tex2DNode153 ) + ( _EmissiveColor2 * _EmissivePower2 * tex2DNode163.g * tex2DNode153 ) + ( _EmissiveColor3 * _EmissivePower3 * tex2DNode163.b * tex2DNode153 ) + ( _EmissiveColor4 * _EmissivePower4 * tex2DNode163.a * tex2DNode153 ) ) ).rgb; surfaceDescription.Smoothness = clampResult171.r; surfaceDescription.Occlusion = tex2D( _AO, uv_AO ).r; surfaceDescription.Alpha = 1; #ifdef _ALPHATEST_ON surfaceDescription.AlphaClipThreshold = _AlphaCutoff; #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.0 - tex2D( _SSSMask, uv_SSSMask ).r ); #endif #ifdef _HAS_REFRACTION surfaceDescription.RefractionIndex = 1; surfaceDescription.RefractionColor = float3( 1, 1, 1 ); surfaceDescription.RefractionDistance = 0; #endif #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING surfaceDescription.SubsurfaceMask = _SSSonoff; #endif #if defined( _MATERIAL_FEATURE_SUBSURFACE_SCATTERING ) || defined( _MATERIAL_FEATURE_TRANSMISSION ) surfaceDescription.DiffusionProfile = _DiffusionProfileHash; #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 _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 #define _SPECULAR_OCCLUSION_FROM_AO 1 #define _MATERIAL_FEATURE_TRANSMISSION 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" #if defined(_DOUBLESIDED_ON) && !defined(ASE_NEED_CULLFACE) #define ASE_NEED_CULLFACE 1 #endif struct AttributesMesh { float3 positionOS : POSITION; float3 normalOS : NORMAL; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct PackedVaryingsMeshToPS { float4 positionCS : SV_Position; float3 interp00 : TEXCOORD0; 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 _BaseColorMul; float4 _EmissiveMask_ST; float4 _EmissiveColor4; float4 _EmissiveColor1; float4 _SkinRoughness_ST; float4 _SkinNormal_ST; float4 _RoughnessMod_R_ST; float4 _EmissiveColor2; float4 _Dirt_ST; float4 _HairCapLongColor; float4 _HairCapShortColor; float4 _FreaklesColor; float4 _Mask_ST; float4 _LipNailColor; float4 _SkinColor_ST; float4 _SSSMask_ST; float4 _AO_ST; float4 _EmissiveColor3; float2 _PannerProperty; float _LipsNailRoughnessBoost; float _HairCapRoughness; float _DirtRoughness_Power; float _SkinRounghnessBoots; float _EmissivePower4; float _EmissivePower3; float _EmissivePower1; float _EmissivePannerTilling; float _SSSonoff; float _Emissivepowerboost; float _SkinPore_Power; float _SkinPore_Tilling; float _DirtBoots; float _HairCapLongColorPower; float _HairCapShortColorPower; float _FreaklesColorPower; float _LipNailColorPower; float _ColorPow; float _EmissivePower2; float _DiffusionProfileHash; 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 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 ); #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; 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; 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; #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; surfaceDescription.Alpha = 1; #ifdef _ALPHATEST_ON surfaceDescription.AlphaClipThreshold = _AlphaCutoff; #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 _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 #define _SPECULAR_OCCLUSION_FROM_AO 1 #define _MATERIAL_FEATURE_TRANSMISSION 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" #if defined(_DOUBLESIDED_ON) && !defined(ASE_NEED_CULLFACE) #define ASE_NEED_CULLFACE 1 #endif struct AttributesMesh { float3 positionOS : POSITION; float3 normalOS : NORMAL; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct PackedVaryingsMeshToPS { float4 positionCS : SV_Position; float3 interp00 : TEXCOORD0; 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 _BaseColorMul; float4 _EmissiveMask_ST; float4 _EmissiveColor4; float4 _EmissiveColor1; float4 _SkinRoughness_ST; float4 _SkinNormal_ST; float4 _RoughnessMod_R_ST; float4 _EmissiveColor2; float4 _Dirt_ST; float4 _HairCapLongColor; float4 _HairCapShortColor; float4 _FreaklesColor; float4 _Mask_ST; float4 _LipNailColor; float4 _SkinColor_ST; float4 _SSSMask_ST; float4 _AO_ST; float4 _EmissiveColor3; float2 _PannerProperty; float _LipsNailRoughnessBoost; float _HairCapRoughness; float _DirtRoughness_Power; float _SkinRounghnessBoots; float _EmissivePower4; float _EmissivePower3; float _EmissivePower1; float _EmissivePannerTilling; float _SSSonoff; float _Emissivepowerboost; float _SkinPore_Power; float _SkinPore_Tilling; float _DirtBoots; float _HairCapLongColorPower; float _HairCapShortColorPower; float _FreaklesColorPower; float _LipNailColorPower; float _ColorPow; float _EmissivePower2; float _DiffusionProfileHash; 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 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 ); #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; 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; 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; #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; surfaceDescription.Alpha = 1; #ifdef _ALPHATEST_ON surfaceDescription.AlphaClipThreshold = _AlphaCutoff; #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 _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 #define _SPECULAR_OCCLUSION_FROM_AO 1 #define _MATERIAL_FEATURE_TRANSMISSION 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" #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; float4 ase_texcoord1 : TEXCOORD1; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct PackedVaryingsMeshToPS { float4 positionCS : SV_Position; float3 interp00 : TEXCOORD0; float3 interp01 : TEXCOORD1; float4 interp02 : TEXCOORD2; float4 ase_texcoord3 : TEXCOORD3; 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 _BaseColorMul; float4 _EmissiveMask_ST; float4 _EmissiveColor4; float4 _EmissiveColor1; float4 _SkinRoughness_ST; float4 _SkinNormal_ST; float4 _RoughnessMod_R_ST; float4 _EmissiveColor2; float4 _Dirt_ST; float4 _HairCapLongColor; float4 _HairCapShortColor; float4 _FreaklesColor; float4 _Mask_ST; float4 _LipNailColor; float4 _SkinColor_ST; float4 _SSSMask_ST; float4 _AO_ST; float4 _EmissiveColor3; float2 _PannerProperty; float _LipsNailRoughnessBoost; float _HairCapRoughness; float _DirtRoughness_Power; float _SkinRounghnessBoots; float _EmissivePower4; float _EmissivePower3; float _EmissivePower1; float _EmissivePannerTilling; float _SSSonoff; float _Emissivepowerboost; float _SkinPore_Power; float _SkinPore_Tilling; float _DirtBoots; float _HairCapLongColorPower; float _HairCapShortColorPower; float _FreaklesColorPower; float _LipNailColorPower; float _ColorPow; float _EmissivePower2; float _DiffusionProfileHash; 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 _SkinNormal; sampler2D _SkinPore; sampler2D _SkinRoughness; sampler2D _RoughnessMod_R; SAMPLER(sampler_RoughnessMod_R); sampler2D _Dirt; SAMPLER(sampler_Dirt); sampler2D _Mask; SAMPLER(sampler_Mask); 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 ); outputPackedVaryingsMeshToPS.ase_texcoord3.xy = inputMesh.ase_texcoord.xy; outputPackedVaryingsMeshToPS.ase_texcoord3.zw = inputMesh.ase_texcoord1.xy; #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; float4 ase_texcoord1 : TEXCOORD1; 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; o.ase_texcoord1 = v.ase_texcoord1; return o; } TessellationFactors TessellationFunction (InputPatch v) { TessellationFactors o; float4 tf = 1; float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; #if (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; o.ase_texcoord1 = patch[0].ase_texcoord1 * bary.x + patch[1].ase_texcoord1 * bary.y + patch[2].ase_texcoord1 * 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_SkinNormal = packedInput.ase_texcoord3.xy * _SkinNormal_ST.xy + _SkinNormal_ST.zw; float2 temp_cast_0 = (_SkinPore_Tilling).xx; float2 texCoord94 = packedInput.ase_texcoord3.zw * temp_cast_0 + float2( 0,0 ); float3 unpack93 = UnpackNormalScale( tex2D( _SkinPore, texCoord94 ), _SkinPore_Power ); unpack93.z = lerp( 1, unpack93.z, saturate(_SkinPore_Power) ); float2 uv_SkinRoughness = packedInput.ase_texcoord3.xy * _SkinRoughness_ST.xy + _SkinRoughness_ST.zw; float2 uv_RoughnessMod_R = packedInput.ase_texcoord3.xy * _RoughnessMod_R_ST.xy + _RoughnessMod_R_ST.zw; float4 temp_cast_1 = (( _DirtRoughness_Power * _DirtBoots )).xxxx; float2 uv_Dirt = packedInput.ase_texcoord3.xy * _Dirt_ST.xy + _Dirt_ST.zw; float4 tex2DNode63 = tex2D( _Dirt, uv_Dirt ); float4 lerpResult71 = lerp( ( ( 1.0 - tex2D( _SkinRoughness, uv_SkinRoughness ) ) * ( _SkinRounghnessBoots * tex2D( _RoughnessMod_R, uv_RoughnessMod_R ).a ) ) , temp_cast_1 , ( _DirtBoots * tex2DNode63.a )); float4 temp_cast_2 = (_HairCapRoughness).xxxx; float2 uv_Mask = packedInput.ase_texcoord3.xy * _Mask_ST.xy + _Mask_ST.zw; float4 tex2DNode11 = tex2D( _Mask, uv_Mask ); float4 lerpResult180 = lerp( lerpResult71 , temp_cast_2 , ( tex2DNode11.a + tex2DNode11.b )); float4 temp_cast_3 = (_LipsNailRoughnessBoost).xxxx; float4 lerpResult141 = lerp( lerpResult180 , temp_cast_3 , tex2DNode11.r); float4 temp_cast_4 = (0.0).xxxx; float4 temp_cast_5 = (1.0).xxxx; float4 clampResult171 = clamp( lerpResult141 , temp_cast_4 , temp_cast_5 ); surfaceDescription.Normal = BlendNormal( UnpackNormalScale( tex2D( _SkinNormal, uv_SkinNormal ), 1.0f ) , unpack93 ); surfaceDescription.Smoothness = clampResult171.r; surfaceDescription.Alpha = 1; #ifdef _ALPHATEST_ON surfaceDescription.AlphaClipThreshold = _AlphaCutoff; #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 _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 #define _SPECULAR_OCCLUSION_FROM_AO 1 #define _MATERIAL_FEATURE_TRANSMISSION 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" #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; float4 ase_texcoord1 : TEXCOORD1; 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; 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 _BaseColorMul; float4 _EmissiveMask_ST; float4 _EmissiveColor4; float4 _EmissiveColor1; float4 _SkinRoughness_ST; float4 _SkinNormal_ST; float4 _RoughnessMod_R_ST; float4 _EmissiveColor2; float4 _Dirt_ST; float4 _HairCapLongColor; float4 _HairCapShortColor; float4 _FreaklesColor; float4 _Mask_ST; float4 _LipNailColor; float4 _SkinColor_ST; float4 _SSSMask_ST; float4 _AO_ST; float4 _EmissiveColor3; float2 _PannerProperty; float _LipsNailRoughnessBoost; float _HairCapRoughness; float _DirtRoughness_Power; float _SkinRounghnessBoots; float _EmissivePower4; float _EmissivePower3; float _EmissivePower1; float _EmissivePannerTilling; float _SSSonoff; float _Emissivepowerboost; float _SkinPore_Power; float _SkinPore_Tilling; float _DirtBoots; float _HairCapLongColorPower; float _HairCapShortColorPower; float _FreaklesColorPower; float _LipNailColorPower; float _ColorPow; float _EmissivePower2; float _DiffusionProfileHash; 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 _SkinNormal; sampler2D _SkinPore; sampler2D _SkinRoughness; sampler2D _RoughnessMod_R; SAMPLER(sampler_RoughnessMod_R); sampler2D _Dirt; SAMPLER(sampler_Dirt); sampler2D _Mask; SAMPLER(sampler_Mask); 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; outputPackedVaryingsMeshToPS.ase_texcoord3.xy = inputMesh.ase_texcoord.xy; outputPackedVaryingsMeshToPS.ase_texcoord3.zw = inputMesh.ase_texcoord1.xy; #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; float4 ase_texcoord1 : TEXCOORD1; 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; o.ase_texcoord1 = v.ase_texcoord1; return o; } TessellationFactors TessellationFunction (InputPatch v) { TessellationFactors o; float4 tf = 1; float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax; float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp; #if (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; o.ase_texcoord1 = patch[0].ase_texcoord1 * bary.x + patch[1].ase_texcoord1 * bary.y + patch[2].ase_texcoord1 * 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_SkinNormal = packedInput.ase_texcoord3.xy * _SkinNormal_ST.xy + _SkinNormal_ST.zw; float2 temp_cast_0 = (_SkinPore_Tilling).xx; float2 texCoord94 = packedInput.ase_texcoord3.zw * temp_cast_0 + float2( 0,0 ); float3 unpack93 = UnpackNormalScale( tex2D( _SkinPore, texCoord94 ), _SkinPore_Power ); unpack93.z = lerp( 1, unpack93.z, saturate(_SkinPore_Power) ); float2 uv_SkinRoughness = packedInput.ase_texcoord3.xy * _SkinRoughness_ST.xy + _SkinRoughness_ST.zw; float2 uv_RoughnessMod_R = packedInput.ase_texcoord3.xy * _RoughnessMod_R_ST.xy + _RoughnessMod_R_ST.zw; float4 temp_cast_1 = (( _DirtRoughness_Power * _DirtBoots )).xxxx; float2 uv_Dirt = packedInput.ase_texcoord3.xy * _Dirt_ST.xy + _Dirt_ST.zw; float4 tex2DNode63 = tex2D( _Dirt, uv_Dirt ); float4 lerpResult71 = lerp( ( ( 1.0 - tex2D( _SkinRoughness, uv_SkinRoughness ) ) * ( _SkinRounghnessBoots * tex2D( _RoughnessMod_R, uv_RoughnessMod_R ).a ) ) , temp_cast_1 , ( _DirtBoots * tex2DNode63.a )); float4 temp_cast_2 = (_HairCapRoughness).xxxx; float2 uv_Mask = packedInput.ase_texcoord3.xy * _Mask_ST.xy + _Mask_ST.zw; float4 tex2DNode11 = tex2D( _Mask, uv_Mask ); float4 lerpResult180 = lerp( lerpResult71 , temp_cast_2 , ( tex2DNode11.a + tex2DNode11.b )); float4 temp_cast_3 = (_LipsNailRoughnessBoost).xxxx; float4 lerpResult141 = lerp( lerpResult180 , temp_cast_3 , tex2DNode11.r); float4 temp_cast_4 = (0.0).xxxx; float4 temp_cast_5 = (1.0).xxxx; float4 clampResult171 = clamp( lerpResult141 , temp_cast_4 , temp_cast_5 ); surfaceDescription.Normal = BlendNormal( UnpackNormalScale( tex2D( _SkinNormal, uv_SkinNormal ), 1.0f ) , unpack93 ); surfaceDescription.Smoothness = clampResult171.r; surfaceDescription.Alpha = 1; #ifdef _ALPHATEST_ON surfaceDescription.AlphaClipThreshold = _AlphaCutoff; #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 RGBA 1 HLSLPROGRAM #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 #define _SPECULAR_OCCLUSION_FROM_AO 1 #define _MATERIAL_FEATURE_TRANSMISSION 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" #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; 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 _BaseColorMul; float4 _EmissiveMask_ST; float4 _EmissiveColor4; float4 _EmissiveColor1; float4 _SkinRoughness_ST; float4 _SkinNormal_ST; float4 _RoughnessMod_R_ST; float4 _EmissiveColor2; float4 _Dirt_ST; float4 _HairCapLongColor; float4 _HairCapShortColor; float4 _FreaklesColor; float4 _Mask_ST; float4 _LipNailColor; float4 _SkinColor_ST; float4 _SSSMask_ST; float4 _AO_ST; float4 _EmissiveColor3; float2 _PannerProperty; float _LipsNailRoughnessBoost; float _HairCapRoughness; float _DirtRoughness_Power; float _SkinRounghnessBoots; float _EmissivePower4; float _EmissivePower3; float _EmissivePower1; float _EmissivePannerTilling; float _SSSonoff; float _Emissivepowerboost; float _SkinPore_Power; float _SkinPore_Tilling; float _DirtBoots; float _HairCapLongColorPower; float _HairCapShortColorPower; float _FreaklesColorPower; float _LipNailColorPower; float _ColorPow; float _EmissivePower2; float _DiffusionProfileHash; 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 _SkinColor; sampler2D _Mask; SAMPLER(sampler_Mask); sampler2D _Dirt; SAMPLER(sampler_Dirt); sampler2D _SkinNormal; sampler2D _SkinPore; sampler2D _EmissiveMask; SAMPLER(sampler_EmissiveMask); sampler2D _EmissivePannerMap; sampler2D _SkinRoughness; sampler2D _RoughnessMod_R; SAMPLER(sampler_RoughnessMod_R); sampler2D _AO; sampler2D _SSSMask; SAMPLER(sampler_SSSMask); 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; 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; float4 saferPower136 = max( _BaseColorMul , 0.0001 ); float4 temp_cast_0 = (_ColorPow).xxxx; float2 uv_SkinColor = packedInput.ase_texcoord7.xy * _SkinColor_ST.xy + _SkinColor_ST.zw; float2 uv_Mask = packedInput.ase_texcoord7.xy * _Mask_ST.xy + _Mask_ST.zw; float4 tex2DNode11 = tex2D( _Mask, uv_Mask ); float4 lerpResult124 = lerp( float4( 0,0,0,0 ) , _LipNailColor , tex2DNode11.r); float4 lerpResult125 = lerp( float4( 0,0,0,0 ) , _FreaklesColor , tex2DNode11.g); float4 lerpResult126 = lerp( float4( 0,0,0,0 ) , _HairCapShortColor , tex2DNode11.b); float4 lerpResult127 = lerp( float4( 0,0,0,0 ) , _HairCapLongColor , tex2DNode11.a); float clampResult165 = clamp( ( ( _LipNailColorPower * tex2DNode11.r ) + ( _FreaklesColorPower * tex2DNode11.g ) + ( _HairCapShortColorPower * tex2DNode11.b ) + ( _HairCapLongColorPower * tex2DNode11.a ) ) , 0.0 , 1.0 ); float4 lerpResult140 = lerp( ( pow( saferPower136 , temp_cast_0 ) * tex2D( _SkinColor, uv_SkinColor ) ) , ( lerpResult124 + lerpResult125 + lerpResult126 + lerpResult127 ) , clampResult165); float2 uv_Dirt = packedInput.ase_texcoord7.xy * _Dirt_ST.xy + _Dirt_ST.zw; float4 tex2DNode63 = tex2D( _Dirt, uv_Dirt ); float4 lerpResult70 = lerp( lerpResult140 , ( tex2DNode63 * _DirtBoots ) , ( _DirtBoots * tex2DNode63.a )); float2 uv_SkinNormal = packedInput.ase_texcoord7.xy * _SkinNormal_ST.xy + _SkinNormal_ST.zw; float2 temp_cast_2 = (_SkinPore_Tilling).xx; float2 texCoord94 = packedInput.interp03.xy * temp_cast_2 + float2( 0,0 ); float3 unpack93 = UnpackNormalScale( tex2D( _SkinPore, texCoord94 ), _SkinPore_Power ); unpack93.z = lerp( 1, unpack93.z, saturate(_SkinPore_Power) ); float2 uv_EmissiveMask = packedInput.ase_texcoord7.xy * _EmissiveMask_ST.xy + _EmissiveMask_ST.zw; float4 tex2DNode163 = tex2D( _EmissiveMask, uv_EmissiveMask ); float2 temp_cast_3 = (_EmissivePannerTilling).xx; float2 texCoord142 = packedInput.ase_texcoord7.xy * temp_cast_3 + float2( 0,0 ); float2 panner145 = ( ( _TimeParameters.x ) * _PannerProperty + texCoord142); float4 tex2DNode153 = tex2D( _EmissivePannerMap, panner145 ); float2 uv_SkinRoughness = packedInput.ase_texcoord7.xy * _SkinRoughness_ST.xy + _SkinRoughness_ST.zw; float2 uv_RoughnessMod_R = packedInput.ase_texcoord7.xy * _RoughnessMod_R_ST.xy + _RoughnessMod_R_ST.zw; float4 temp_cast_5 = (( _DirtRoughness_Power * _DirtBoots )).xxxx; float4 lerpResult71 = lerp( ( ( 1.0 - tex2D( _SkinRoughness, uv_SkinRoughness ) ) * ( _SkinRounghnessBoots * tex2D( _RoughnessMod_R, uv_RoughnessMod_R ).a ) ) , temp_cast_5 , ( _DirtBoots * tex2DNode63.a )); float4 temp_cast_6 = (_HairCapRoughness).xxxx; float4 lerpResult180 = lerp( lerpResult71 , temp_cast_6 , ( tex2DNode11.a + tex2DNode11.b )); float4 temp_cast_7 = (_LipsNailRoughnessBoost).xxxx; float4 lerpResult141 = lerp( lerpResult180 , temp_cast_7 , tex2DNode11.r); float4 temp_cast_8 = (0.0).xxxx; float4 temp_cast_9 = (1.0).xxxx; float4 clampResult171 = clamp( lerpResult141 , temp_cast_8 , temp_cast_9 ); float2 uv_AO = packedInput.ase_texcoord7.xy * _AO_ST.xy + _AO_ST.zw; float2 uv_SSSMask = packedInput.ase_texcoord7.xy * _SSSMask_ST.xy + _SSSMask_ST.zw; surfaceDescription.Albedo = lerpResult70.rgb; surfaceDescription.Normal = BlendNormal( UnpackNormalScale( tex2D( _SkinNormal, uv_SkinNormal ), 1.0f ) , unpack93 ); surfaceDescription.BentNormal = float3( 0, 0, 1 ); surfaceDescription.CoatMask = 0; surfaceDescription.Metallic = 0; #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR surfaceDescription.Specular = 0; #endif surfaceDescription.Emission = ( _Emissivepowerboost * ( ( _EmissiveColor1 * _EmissivePower1 * tex2DNode163.r * tex2DNode153 ) + ( _EmissiveColor2 * _EmissivePower2 * tex2DNode163.g * tex2DNode153 ) + ( _EmissiveColor3 * _EmissivePower3 * tex2DNode163.b * tex2DNode153 ) + ( _EmissiveColor4 * _EmissivePower4 * tex2DNode163.a * tex2DNode153 ) ) ).rgb; surfaceDescription.Smoothness = clampResult171.r; surfaceDescription.Occlusion = tex2D( _AO, uv_AO ).r; surfaceDescription.Alpha = 1; #ifdef _ALPHATEST_ON surfaceDescription.AlphaClipThreshold = _AlphaCutoff; #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.0 - tex2D( _SSSMask, uv_SSSMask ).r ); #endif #ifdef _HAS_REFRACTION surfaceDescription.RefractionIndex = 1; surfaceDescription.RefractionColor = float3( 1, 1, 1 ); surfaceDescription.RefractionDistance = 0; #endif #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING surfaceDescription.SubsurfaceMask = _SSSonoff; #endif #if defined( _MATERIAL_FEATURE_SUBSURFACE_SCATTERING ) || defined( _MATERIAL_FEATURE_TRANSMISSION ) surfaceDescription.DiffusionProfile = _DiffusionProfileHash; #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;1407.97;1939.473;1;True;False Node;AmplifyShaderEditor.RangedFloatNode;162;-4191.182,-571.95;Inherit;False;Property;_EmissivePannerTilling;Emissive Panner Tilling;39;0;Create;True;0;0;False;0;False;1;0;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.SamplerNode;25;-1427.203,43.70723;Inherit;True;Property;_SkinRoughness;Skin Roughness;13;0;Create;True;0;0;False;0;False;-1;None;42a270dfbfc1e1c4c99e6e67f4d7d138;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;26;-1403.547,-63.60631;Float;False;Property;_SkinRounghnessBoots;Skin Rounghness Boots;15;0;Create;True;0;0;False;0;False;0;0;0;1;0;1;FLOAT;0 Node;AmplifyShaderEditor.SamplerNode;3;-1420.305,247.2969;Inherit;True;Property;_RoughnessMod_R;RoughnessMod_R;14;0;Create;True;0;0;False;0;False;-1;c0b7b18616e3d4c4d9f007d6681e9331;c0b7b18616e3d4c4d9f007d6681e9331;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.TimeNode;144;-3905.697,-282.8923;Inherit;False;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.RangedFloatNode;115;-1946.72,-534.3867;Inherit;False;Property;_HairCapShortColorPower;HairCap Short Color Power;24;0;Create;True;0;0;False;0;False;0;0;0;5;0;1;FLOAT;0 Node;AmplifyShaderEditor.TextureCoordinatesNode;142;-3921.697,-570.8915;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;65;-1256.622,-1791.901;Float;False;Property;_DirtBoots;Dirt Boots;1;0;Create;True;0;0;False;0;False;0;0;0;1;0;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode;116;-1951.928,-817.153;Inherit;False;Property;_LipNailColorPower;Lip/Nail Color Power;20;0;Create;True;0;0;False;0;False;0;0;0;1;0;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode;97;-1232.994,-1483.387;Float;False;Property;_DirtRoughness_Power;DirtRoughness_Power;2;0;Create;True;0;0;False;0;False;0;0;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.SamplerNode;63;-1276.916,-1681.338;Inherit;True;Property;_Dirt;Dirt;0;0;Create;True;0;0;False;0;False;-1;None;a616c81f9edd3ea41ab09b5f4cf1f617;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;114;-1124.205,69.95795;Inherit;False;1;0;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.RangedFloatNode;117;-1951.748,-684.711;Inherit;False;Property;_FreaklesColorPower;Freakles Color Power;22;0;Create;True;0;0;False;0;False;0;0;0;20;0;1;FLOAT;0 Node;AmplifyShaderEditor.Vector2Node;143;-3889.697,-442.8915;Float;False;Property;_PannerProperty;Panner Property;40;0;Create;True;0;0;False;0;False;0,0;0.1,0.1;0;3;FLOAT2;0;FLOAT;1;FLOAT;2 Node;AmplifyShaderEditor.SamplerNode;11;-1439.844,-932.1219;Inherit;True;Property;_Mask;Mask;9;0;Create;True;0;0;False;0;False;-1;a1de06d259b22324380c30be888ea28c;b007a8f721b09eb4a8a8c865704cec11;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;118;-1951.998,-371.2241;Inherit;False;Property;_HairCapLongColorPower;HairCap Long Color Power;26;0;Create;True;0;0;False;0;False;0;0;0;5;0;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;44;-1101.422,-69.58938;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;119;-1657.896,-922.996;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.ColorNode;21;-663.8802,-1247.952;Float;False;Property;_HairCapShortColor;HairCap Short Color;23;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;22;-410.8227,-1255.299;Float;False;Property;_HairCapLongColor;HairCap Long Color;25;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.SimpleMultiplyOpNode;66;-864.1537,-1413.515;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;122;-1641.745,-374.5211;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;43;-973.1713,55.39404;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;69;-864.1537,-1542.7;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;120;-1616.038,-674.923;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.PannerNode;145;-3601.696,-410.8915;Inherit;False;3;0;FLOAT2;0,0;False;2;FLOAT2;0,0;False;1;FLOAT;1;False;1;FLOAT2;0 Node;AmplifyShaderEditor.ColorNode;12;-1342.003,-1245.533;Float;False;Property;_LipNailColor;Lip/Nail Color;19;0;Create;True;0;0;False;0;False;1,1,1,0;0.5566037,0.107645,0.107645,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.ColorNode;7;-1391.19,-623.9757;Float;False;Property;_BaseColorMul;BaseColorMul;17;0;Create;True;0;0;False;0;False;1,1,1,0;0.372549,0.4821379,0.6509804,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.RangedFloatNode;9;-1410.582,-202.3145;Float;False;Property;_ColorPow;Color Pow;18;0;Create;True;0;0;False;0;False;0;1;0;10;0;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;121;-1637.466,-536.3641;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.ColorNode;20;-940.8261,-1256.057;Float;False;Property;_FreaklesColor;Freakles Color;21;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;151;-2853.01,300.7601;Float;False;Property;_EmissiveColor4;Emissive Color 4;36;0;Create;True;0;0;False;0;False;0,0,0,0;1,1,1,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.RangedFloatNode;146;-2926.115,474.9807;Float;False;Property;_EmissivePower4;Emissive Power 4;37;0;Create;True;0;0;False;0;False;0;0;0;2000;0;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleAddOpNode;176;-166.9698,-1466.473;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.LerpOp;71;-462.5221,-1564.355;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;149;-2919.855,-39.55336;Float;False;Property;_EmissivePower2;Emissive Power 2;33;0;Create;True;0;0;False;0;False;248.8943;0;0;2000;0;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode;147;-2922.544,-300.5449;Float;False;Property;_EmissivePower1;Emissive Power 1;31;0;Create;True;0;0;False;0;False;0;0;0;2000;0;1;FLOAT;0 Node;AmplifyShaderEditor.PowerNode;136;-1058.79,-307.5454;Inherit;False;True;2;0;COLOR;2,0,0,0;False;1;FLOAT;1;False;1;COLOR;0 Node;AmplifyShaderEditor.RangedFloatNode;150;-2924.894,216.7375;Float;False;Property;_EmissivePower3;Emissive Power 3;35;0;Create;True;0;0;False;0;False;0;0;0;2000;0;1;FLOAT;0 Node;AmplifyShaderEditor.SamplerNode;4;-1431.925,-404.8359;Inherit;True;Property;_SkinColor;Skin Color;16;0;Create;True;0;0;False;0;False;-1;eb3a384bc2bb00d4fb3f5e04fe82e67b;ab501b46a9c96b647b753ea05c59b400;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;124;-1056.878,-1033.162;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.ColorNode;148;-2852.855,-212.5536;Float;False;Property;_EmissiveColor2;Emissive Color 2;32;0;Create;True;0;0;False;0;False;0,0,0,0;1,1,1,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.RangedFloatNode;95;-1907.972,854.9802;Inherit;False;Property;_SkinPore_Tilling;SkinPore_Tilling;6;0;Create;True;0;0;False;0;False;35;35;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.ColorNode;154;-2856.544,-472.545;Float;False;Property;_EmissiveColor1;Emissive Color 1;30;0;Create;True;0;0;False;0;False;0,0,0,0;1,1,1,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.LerpOp;125;-826.8776,-1033.162;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;126;-620.8776,-1036.162;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.SimpleAddOpNode;123;-986.5225,-784.5419;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.SamplerNode;163;-3304.605,-876.3577;Inherit;True;Property;_EmissiveMask;Emissive Mask;28;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;169;-298.2703,-1652.385;Inherit;False;Property;_HairCapRoughness;HairCap Roughness;27;0;Create;True;0;0;False;0;False;0.6;0;0;1;0;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode;167;-872.2632,-488.2551;Inherit;False;Constant;_max;max;40;0;Create;True;0;0;False;0;False;1;0;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.SamplerNode;153;-3329.696,-410.8915;Inherit;True;Property;_EmissivePannerMap;Emissive Panner Map;38;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.LerpOp;127;-432.8776,-1031.162;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;166;-876.2632,-561.2551;Inherit;False;Constant;_min;min;40;0;Create;True;0;0;False;0;False;0;0;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.ColorNode;152;-2853.01,42.5166;Float;False;Property;_EmissiveColor3;Emissive Color 3;34;0;Create;True;0;0;False;0;False;0,0,0,0;1,1,1,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;158;-2251.683,51.29242;Inherit;False;4;4;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.SimpleAddOpNode;57;-650.0494,-819.539;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.ClampOpNode;165;-705.032,-586.2251;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;1;False;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode;96;-1970.994,945.6127;Inherit;False;Property;_SkinPore_Power;SkinPore_Power;7;0;Create;True;0;0;False;0;False;0.25;0.25;0;1;0;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;156;-2250.205,317.4468;Inherit;False;4;4;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;137;-868.0598,-418.015;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;157;-2255.959,-220.9686;Inherit;False;4;4;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.RangedFloatNode;128;-176.1403,-1744.974;Inherit;False;Property;_LipsNailRoughnessBoost;Lips/Nail Roughness Boost;3;0;Create;True;0;0;False;0;False;0.75;0;0;1;0;1;FLOAT;0 Node;AmplifyShaderEditor.LerpOp;180;100.0302,-1560.473;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;94;-1701.967,852.9305;Inherit;False;1;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;155;-2269.648,-493.9601;Inherit;False;4;4;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.SamplerNode;38;-1405.436,652.8618;Inherit;True;Property;_SkinNormal;Skin Normal;8;0;Create;True;0;0;False;0;False;-1;None;9a03bd58d1b7f1b4bb52d1e2d01ff4d7;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;141;357.8163,-1611.319;Inherit;True;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.LerpOp;140;-485.7545,-523.3894;Inherit;True;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.SamplerNode;93;-1403.721,858.0552;Inherit;True;Property;_SkinPore;Skin Pore;5;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.SamplerNode;88;-131.4933,-866.7759;Inherit;True;Property;_SSSMask;SSS Mask;10;0;Create;True;0;0;False;0;False;-1;None;37c12d328f3245e42ad09f8113322615;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;160;-2075.068,289.3349;Inherit;False;Property;_Emissivepowerboost;Emissive power boost;29;0;Create;True;0;0;False;0;False;100;100;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;68;-864.1538,-1793.193;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;67;-867.3045,-1667.159;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleAddOpNode;159;-2039.662,-169.42;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.BlendNormalsNode;92;-1060.379,651.025;Inherit;False;0;3;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;1;FLOAT3;0 Node;AmplifyShaderEditor.DiffusionProfileNode;112;151.6976,-552.234;Float;False;Property;_Profile;Profile;12;0;Create;True;0;0;False;0;False;26bdddf49760c61438938733f07fa2a2;26bdddf49760c61438938733f07fa2a2;True;0;1;FLOAT;0 Node;AmplifyShaderEditor.OneMinusNode;113;203.6976,-833.234;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode;90;150.1029,-636.65;Inherit;False;Property;_SSSonoff;SSS on/off;11;0;Create;True;0;0;False;0;False;1.2;1.2;0;4;0;1;FLOAT;0 Node;AmplifyShaderEditor.ClampOpNode;171;606.1423,-1255.04;Inherit;False;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;COLOR;1,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;161;-1861.381,150.4048;Inherit;False;2;2;0;FLOAT;0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.SamplerNode;37;94.07001,-335.0983;Inherit;True;Property;_AO;AO;4;0;Create;True;0;0;False;0;False;-1;None;f3536d2dc34fc3449baefebdab6e0631;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;70;-475.3391,-1760.756;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.TemplateMultiPassMasterNode;107;76.37568,-40.6022;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;106;76.37568,-40.6022;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;False;-1;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;104;76.37568,-40.6022;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;108;76.37568,-40.6022;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;103;76.37568,-40.6022;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;101;76.37568,-40.6022;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;102;76.37568,-40.6022;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;99;790.2903,-848.5927;Float;False;True;-1;2;UnityEditor.Rendering.HighDefinition.HDLitGUI;0;2;DawnShaderHDRP/SkinShaderHDRP;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;0; Use Shadow Threshold;0;Material Type,InvertActionOnDeselection;1; 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 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;100;76.37568,-40.6022;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;109;76.37568,-40.6022;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;False;-1;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;105;76.37568,-40.6022;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 WireConnection;142;0;162;0 WireConnection;114;0;25;0 WireConnection;44;0;26;0 WireConnection;44;1;3;4 WireConnection;119;0;116;0 WireConnection;119;1;11;1 WireConnection;66;0;65;0 WireConnection;66;1;63;4 WireConnection;122;0;118;0 WireConnection;122;1;11;4 WireConnection;43;0;114;0 WireConnection;43;1;44;0 WireConnection;69;0;97;0 WireConnection;69;1;65;0 WireConnection;120;0;117;0 WireConnection;120;1;11;2 WireConnection;145;0;142;0 WireConnection;145;2;143;0 WireConnection;145;1;144;2 WireConnection;121;0;115;0 WireConnection;121;1;11;3 WireConnection;176;0;11;4 WireConnection;176;1;11;3 WireConnection;71;0;43;0 WireConnection;71;1;69;0 WireConnection;71;2;66;0 WireConnection;136;0;7;0 WireConnection;136;1;9;0 WireConnection;124;1;12;0 WireConnection;124;2;11;1 WireConnection;125;1;20;0 WireConnection;125;2;11;2 WireConnection;126;1;21;0 WireConnection;126;2;11;3 WireConnection;123;0;119;0 WireConnection;123;1;120;0 WireConnection;123;2;121;0 WireConnection;123;3;122;0 WireConnection;153;1;145;0 WireConnection;127;1;22;0 WireConnection;127;2;11;4 WireConnection;158;0;152;0 WireConnection;158;1;150;0 WireConnection;158;2;163;3 WireConnection;158;3;153;0 WireConnection;57;0;124;0 WireConnection;57;1;125;0 WireConnection;57;2;126;0 WireConnection;57;3;127;0 WireConnection;165;0;123;0 WireConnection;165;1;166;0 WireConnection;165;2;167;0 WireConnection;156;0;151;0 WireConnection;156;1;146;0 WireConnection;156;2;163;4 WireConnection;156;3;153;0 WireConnection;137;0;136;0 WireConnection;137;1;4;0 WireConnection;157;0;148;0 WireConnection;157;1;149;0 WireConnection;157;2;163;2 WireConnection;157;3;153;0 WireConnection;180;0;71;0 WireConnection;180;1;169;0 WireConnection;180;2;176;0 WireConnection;94;0;95;0 WireConnection;155;0;154;0 WireConnection;155;1;147;0 WireConnection;155;2;163;1 WireConnection;155;3;153;0 WireConnection;141;0;180;0 WireConnection;141;1;128;0 WireConnection;141;2;11;1 WireConnection;140;0;137;0 WireConnection;140;1;57;0 WireConnection;140;2;165;0 WireConnection;93;1;94;0 WireConnection;93;5;96;0 WireConnection;68;0;63;0 WireConnection;68;1;65;0 WireConnection;67;0;65;0 WireConnection;67;1;63;4 WireConnection;159;0;155;0 WireConnection;159;1;157;0 WireConnection;159;2;158;0 WireConnection;159;3;156;0 WireConnection;92;0;38;0 WireConnection;92;1;93;0 WireConnection;113;0;88;1 WireConnection;171;0;141;0 WireConnection;171;1;166;0 WireConnection;171;2;167;0 WireConnection;161;0;160;0 WireConnection;161;1;159;0 WireConnection;70;0;140;0 WireConnection;70;1;68;0 WireConnection;70;2;67;0 WireConnection;99;0;70;0 WireConnection;99;1;92;0 WireConnection;99;6;161;0 WireConnection;99;7;171;0 WireConnection;99;8;37;0 WireConnection;99;16;113;0 WireConnection;99;20;90;0 WireConnection;99;21;112;0 ASEEND*/ //CHKSM=D3109166EAA4AB3EEB90A9971D4274D8B23EF0D5