Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shader "Unlit/SkinUI"
- {
- Properties
- {
- [PerRendererData] _MainTex("Sprite Texture", 2D) = "white" {}
- _SkinColour("SkinColour", Color) = (0.6313726, 0.2941177, 0.2117647, 1)
- _EyeColour("EyeColour", Color) = (0.03208439, 0.1915721, 0.9716981, 0)
- [HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {}
- [HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {}
- [HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {}
- _StencilComp("Stencil Comparison", Float) = 8
- _Stencil("Stencil ID", Float) = 0
- _StencilOp("Stencil Operation", Float) = 0
- _StencilWriteMask("Stencil Write Mask", Float) = 255
- _StencilReadMask("Stencil Read Mask", Float) = 255
- _ColorMask("Color Mask", Float) = 15
- [Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip("Use Alpha Clip", Float) = 0
- }
- SubShader
- {
- Tags
- {
- "RenderPipeline" = "UniversalPipeline"
- "RenderType" = "Transparent"
- "UniversalMaterialType" = "Unlit"
- "Queue" = "Transparent"
- // DisableBatching: <None>
- "ShaderGraphShader" = "true"
- "ShaderGraphTargetId" = "UniversalSpriteUnlitSubTarget"
- "IgnoreProjector" = "True"
- "PreviewType" = "Plane"
- "CanUseSpriteAtlas" = "True"
- }
- Stencil
- {
- Ref[_Stencil]
- Comp[_StencilComp]
- Pass[_StencilOp]
- ReadMask[_StencilReadMask]
- WriteMask[_StencilWriteMask]
- }
- Cull Off
- Lighting Off
- ZWrite Off
- ZTest[unity_GUIZTestMode]
- Blend SrcAlpha OneMinusSrcAlpha
- ColorMask[_ColorMask]
- Pass
- {
- Name "Sprite Unlit"
- Tags
- {
- "LightMode" = "Universal2D"
- }
- HLSLPROGRAM
- // Pragmas
- #pragma target 2.0
- #pragma exclude_renderers d3d11_9x
- #pragma vertex vert
- #pragma fragment frag
- // Keywords
- #pragma multi_compile_fragment _ DEBUG_DISPLAY
- // GraphKeywords: <None>
- // Defines
- #define ATTRIBUTES_NEED_NORMAL
- #define ATTRIBUTES_NEED_TANGENT
- #define ATTRIBUTES_NEED_TEXCOORD0
- #define ATTRIBUTES_NEED_COLOR
- #define VARYINGS_NEED_POSITION_WS
- #define VARYINGS_NEED_TEXCOORD0
- #define VARYINGS_NEED_COLOR
- #define FEATURES_GRAPH_VERTEX
- /* WARNING: $splice Could not find named fragment 'PassInstancing' */
- #define SHADERPASS SHADERPASS_SPRITEUNLIT
- #define ALPHA_CLIP_THRESHOLD 1
- /* WARNING: $splice Could not find named fragment 'DotsInstancingVars' */
- // custom interpolator pre-include
- /* WARNING: $splice Could not find named fragment 'sgci_CustomInterpolatorPreInclude' */
- // Includes
- #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
- #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
- #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
- // --------------------------------------------------
- // Structs and Packing
- // custom interpolators pre packing
- /* WARNING: $splice Could not find named fragment 'CustomInterpolatorPrePacking' */
- struct Attributes
- {
- float3 positionOS : POSITION;
- float3 normalOS : NORMAL;
- float4 tangentOS : TANGENT;
- float4 uv0 : TEXCOORD0;
- float4 color : COLOR;
- #if UNITY_ANY_INSTANCING_ENABLED
- uint instanceID : INSTANCEID_SEMANTIC;
- #endif
- };
- struct Varyings
- {
- float4 positionCS : SV_POSITION;
- float3 positionWS;
- float4 texCoord0;
- float4 color;
- #if UNITY_ANY_INSTANCING_ENABLED
- uint instanceID : CUSTOM_INSTANCE_ID;
- #endif
- #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
- uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0;
- #endif
- #if (defined(UNITY_STEREO_INSTANCING_ENABLED))
- uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex;
- #endif
- #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
- FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC;
- #endif
- };
- struct SurfaceDescriptionInputs
- {
- float4 uv0;
- };
- struct VertexDescriptionInputs
- {
- float3 ObjectSpaceNormal;
- float3 ObjectSpaceTangent;
- float3 ObjectSpacePosition;
- };
- struct PackedVaryings
- {
- float4 positionCS : SV_POSITION;
- float4 texCoord0 : INTERP0;
- float4 color : INTERP1;
- float3 positionWS : INTERP2;
- #if UNITY_ANY_INSTANCING_ENABLED
- uint instanceID : CUSTOM_INSTANCE_ID;
- #endif
- #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
- uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0;
- #endif
- #if (defined(UNITY_STEREO_INSTANCING_ENABLED))
- uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex;
- #endif
- #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
- FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC;
- #endif
- };
- PackedVaryings PackVaryings(Varyings input)
- {
- PackedVaryings output;
- ZERO_INITIALIZE(PackedVaryings, output);
- output.positionCS = input.positionCS;
- output.texCoord0.xyzw = input.texCoord0;
- output.color.xyzw = input.color;
- output.positionWS.xyz = input.positionWS;
- #if UNITY_ANY_INSTANCING_ENABLED
- output.instanceID = input.instanceID;
- #endif
- #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
- output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0;
- #endif
- #if (defined(UNITY_STEREO_INSTANCING_ENABLED))
- output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx;
- #endif
- #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
- output.cullFace = input.cullFace;
- #endif
- return output;
- }
- Varyings UnpackVaryings(PackedVaryings input)
- {
- Varyings output;
- output.positionCS = input.positionCS;
- output.texCoord0 = input.texCoord0.xyzw;
- output.color = input.color.xyzw;
- output.positionWS = input.positionWS.xyz;
- #if UNITY_ANY_INSTANCING_ENABLED
- output.instanceID = input.instanceID;
- #endif
- #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
- output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0;
- #endif
- #if (defined(UNITY_STEREO_INSTANCING_ENABLED))
- output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx;
- #endif
- #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
- output.cullFace = input.cullFace;
- #endif
- return output;
- }
- // --------------------------------------------------
- // Graph
- // Graph Properties
- CBUFFER_START(UnityPerMaterial)
- float4 _MainTex_TexelSize;
- float4 _SkinColour;
- float4 _EyeColour;
- CBUFFER_END
- // Object and Global properties
- SAMPLER(SamplerState_Linear_Repeat);
- TEXTURE2D(_MainTex);
- SAMPLER(sampler_MainTex);
- // Graph Includes
- // GraphIncludes: <None>
- // -- Property used by ScenePickingPass
- #ifdef SCENEPICKINGPASS
- float4 _SelectionID;
- #endif
- // -- Properties used by SceneSelectionPass
- #ifdef SCENESELECTIONPASS
- int _ObjectId;
- int _PassValue;
- #endif
- // Graph Functions
- void Unity_OneMinus_float(float In, out float Out)
- {
- Out = 1 - In;
- }
- void Unity_Subtract_float4(float4 A, float4 B, out float4 Out)
- {
- Out = A - B;
- }
- void Unity_ReplaceColor_float(float3 In, float3 From, float3 To, float Range, out float3 Out, float Fuzziness)
- {
- float Distance = distance(From, In);
- Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 1e-5f)));
- }
- void Unity_Multiply_float3_float3(float3 A, float3 B, out float3 Out)
- {
- Out = A * B;
- }
- void Unity_Multiply_float4_float4(float4 A, float4 B, out float4 Out)
- {
- Out = A * B;
- }
- // Custom interpolators pre vertex
- /* WARNING: $splice Could not find named fragment 'CustomInterpolatorPreVertex' */
- // Graph Vertex
- struct VertexDescription
- {
- float3 Position;
- float3 Normal;
- float3 Tangent;
- };
- VertexDescription VertexDescriptionFunction(VertexDescriptionInputs IN)
- {
- VertexDescription description = (VertexDescription)0;
- description.Position = IN.ObjectSpacePosition;
- description.Normal = IN.ObjectSpaceNormal;
- description.Tangent = IN.ObjectSpaceTangent;
- return description;
- }
- // Custom interpolators, pre surface
- #ifdef FEATURES_GRAPH_VERTEX
- Varyings CustomInterpolatorPassThroughFunc(inout Varyings output, VertexDescription input)
- {
- return output;
- }
- #define CUSTOMINTERPOLATOR_VARYPASSTHROUGH_FUNC
- #endif
- // Graph Pixel
- struct SurfaceDescription
- {
- float3 BaseColor;
- float Alpha;
- float AlphaClipThreshold;
- };
- SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN)
- {
- SurfaceDescription surface = (SurfaceDescription)0;
- UnityTexture2D _Property_3a6bdbffcef94e7eb854e4c25aff3b13_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex);
- #if defined(SHADER_API_GLES) && (SHADER_TARGET < 30)
- float4 _SampleTexture2DLOD_574e6c6726fb49cc9de61c0ea37bd527_RGBA_0 = float4(0.0f, 0.0f, 0.0f, 1.0f);
- #else
- float4 _SampleTexture2DLOD_574e6c6726fb49cc9de61c0ea37bd527_RGBA_0 = SAMPLE_TEXTURE2D_LOD(_Property_3a6bdbffcef94e7eb854e4c25aff3b13_Out_0.tex, _Property_3a6bdbffcef94e7eb854e4c25aff3b13_Out_0.samplerstate, _Property_3a6bdbffcef94e7eb854e4c25aff3b13_Out_0.GetTransformedUV(IN.uv0.xy), 0);
- #endif
- float _SampleTexture2DLOD_574e6c6726fb49cc9de61c0ea37bd527_R_5 = _SampleTexture2DLOD_574e6c6726fb49cc9de61c0ea37bd527_RGBA_0.r;
- float _SampleTexture2DLOD_574e6c6726fb49cc9de61c0ea37bd527_G_6 = _SampleTexture2DLOD_574e6c6726fb49cc9de61c0ea37bd527_RGBA_0.g;
- float _SampleTexture2DLOD_574e6c6726fb49cc9de61c0ea37bd527_B_7 = _SampleTexture2DLOD_574e6c6726fb49cc9de61c0ea37bd527_RGBA_0.b;
- float _SampleTexture2DLOD_574e6c6726fb49cc9de61c0ea37bd527_A_8 = _SampleTexture2DLOD_574e6c6726fb49cc9de61c0ea37bd527_RGBA_0.a;
- float _OneMinus_6f5dac1c4b8349aa893b8e5e82cfa9be_Out_1;
- Unity_OneMinus_float(_SampleTexture2DLOD_574e6c6726fb49cc9de61c0ea37bd527_A_8, _OneMinus_6f5dac1c4b8349aa893b8e5e82cfa9be_Out_1);
- float4 _Subtract_78292052830e440e8144fc0481fc9559_Out_2;
- Unity_Subtract_float4(_SampleTexture2DLOD_574e6c6726fb49cc9de61c0ea37bd527_RGBA_0, (_OneMinus_6f5dac1c4b8349aa893b8e5e82cfa9be_Out_1.xxxx), _Subtract_78292052830e440e8144fc0481fc9559_Out_2);
- float4 _Property_1e0901a5de6c457faaf171dd3f25c868_Out_0 = _SkinColour;
- float3 _ReplaceColor_c28c1da842e6495b83b511e4ea52263a_Out_4;
- Unity_ReplaceColor_float((_Subtract_78292052830e440e8144fc0481fc9559_Out_2.xyz), IsGammaSpace() ? float3(0.9529412, 0.7882354, 0.7294118) : SRGBToLinear(float3(0.9529412, 0.7882354, 0.7294118)), (_Property_1e0901a5de6c457faaf171dd3f25c868_Out_0.xyz), 0, _ReplaceColor_c28c1da842e6495b83b511e4ea52263a_Out_4, 0);
- float3 _Vector3_ef3f7f9ad0c841a9b4ab635621737b4d_Out_0 = float3(0.9, 0.85, 0.85);
- float3 _Multiply_ff964691807b4b7f89144537ba2c88fc_Out_2;
- Unity_Multiply_float3_float3((_Property_1e0901a5de6c457faaf171dd3f25c868_Out_0.xyz), _Vector3_ef3f7f9ad0c841a9b4ab635621737b4d_Out_0, _Multiply_ff964691807b4b7f89144537ba2c88fc_Out_2);
- float3 _ReplaceColor_884f1e49ce584423a7342b0bc596146d_Out_4;
- Unity_ReplaceColor_float(_ReplaceColor_c28c1da842e6495b83b511e4ea52263a_Out_4, IsGammaSpace() ? float3(0.9333334, 0.7176471, 0.6470588) : SRGBToLinear(float3(0.9333334, 0.7176471, 0.6470588)), _Multiply_ff964691807b4b7f89144537ba2c88fc_Out_2, 0, _ReplaceColor_884f1e49ce584423a7342b0bc596146d_Out_4, 0);
- float3 _Multiply_5a0d6c55f9de43a68c1dedcff22e904a_Out_2;
- Unity_Multiply_float3_float3(_Multiply_ff964691807b4b7f89144537ba2c88fc_Out_2, _Vector3_ef3f7f9ad0c841a9b4ab635621737b4d_Out_0, _Multiply_5a0d6c55f9de43a68c1dedcff22e904a_Out_2);
- float3 _ReplaceColor_9df44c2cf3874279b677710f36911a6b_Out_4;
- Unity_ReplaceColor_float(_ReplaceColor_884f1e49ce584423a7342b0bc596146d_Out_4, IsGammaSpace() ? float3(0.8941177, 0.6431373, 0.572549) : SRGBToLinear(float3(0.8941177, 0.6431373, 0.572549)), _Multiply_5a0d6c55f9de43a68c1dedcff22e904a_Out_2, 0, _ReplaceColor_9df44c2cf3874279b677710f36911a6b_Out_4, 0);
- float3 _Multiply_be46dac033bc41a0a8aa256c22086c2e_Out_2;
- Unity_Multiply_float3_float3(_Multiply_5a0d6c55f9de43a68c1dedcff22e904a_Out_2, _Vector3_ef3f7f9ad0c841a9b4ab635621737b4d_Out_0, _Multiply_be46dac033bc41a0a8aa256c22086c2e_Out_2);
- float3 _ReplaceColor_9b1a36d99df541cc812c4bcd987f7fbc_Out_4;
- Unity_ReplaceColor_float(_ReplaceColor_9df44c2cf3874279b677710f36911a6b_Out_4, IsGammaSpace() ? float3(0.7764707, 0.5137255, 0.4588236) : SRGBToLinear(float3(0.7764707, 0.5137255, 0.4588236)), _Multiply_be46dac033bc41a0a8aa256c22086c2e_Out_2, 0, _ReplaceColor_9b1a36d99df541cc812c4bcd987f7fbc_Out_4, 0);
- float3 _Multiply_76ddf994c2a24f01ab989a0d301a72fd_Out_2;
- Unity_Multiply_float3_float3(_Multiply_5a0d6c55f9de43a68c1dedcff22e904a_Out_2, float3(0.8, 0.65, 0.65), _Multiply_76ddf994c2a24f01ab989a0d301a72fd_Out_2);
- float3 _ReplaceColor_f3726021dff946a39d609bedff1177c6_Out_4;
- Unity_ReplaceColor_float(_ReplaceColor_9b1a36d99df541cc812c4bcd987f7fbc_Out_4, IsGammaSpace() ? float3(0.6, 0.3372549, 0.3019608) : SRGBToLinear(float3(0.6, 0.3372549, 0.3019608)), _Multiply_76ddf994c2a24f01ab989a0d301a72fd_Out_2, 0, _ReplaceColor_f3726021dff946a39d609bedff1177c6_Out_4, 0);
- float4 _Property_f1671f2332004839b93ed8315fdc8581_Out_0 = _EyeColour;
- float3 _ReplaceColor_fabe8afe95444bbf953883ea16797882_Out_4;
- Unity_ReplaceColor_float(_ReplaceColor_f3726021dff946a39d609bedff1177c6_Out_4, IsGammaSpace() ? float3(0.2, 0.5490196, 0.1254902) : SRGBToLinear(float3(0.2, 0.5490196, 0.1254902)), (_Property_f1671f2332004839b93ed8315fdc8581_Out_0.xyz), 0, _ReplaceColor_fabe8afe95444bbf953883ea16797882_Out_4, 0);
- float4 _Multiply_db96c6f5ce3d468db550f3bb1667efe6_Out_2;
- Unity_Multiply_float4_float4(_Property_f1671f2332004839b93ed8315fdc8581_Out_0, float4(0.8, 0.8, 0.8, 2), _Multiply_db96c6f5ce3d468db550f3bb1667efe6_Out_2);
- float3 _ReplaceColor_89b4caca5e7e4088ac570cafe9534a58_Out_4;
- Unity_ReplaceColor_float(_ReplaceColor_fabe8afe95444bbf953883ea16797882_Out_4, IsGammaSpace() ? float3(0.1882353, 0.5254902, 0.1176471) : SRGBToLinear(float3(0.1882353, 0.5254902, 0.1176471)), (_Multiply_db96c6f5ce3d468db550f3bb1667efe6_Out_2.xyz), 0, _ReplaceColor_89b4caca5e7e4088ac570cafe9534a58_Out_4, 0);
- surface.BaseColor = _ReplaceColor_89b4caca5e7e4088ac570cafe9534a58_Out_4;
- surface.Alpha = _SampleTexture2DLOD_574e6c6726fb49cc9de61c0ea37bd527_A_8;
- surface.AlphaClipThreshold = 0.5;
- return surface;
- }
- // --------------------------------------------------
- // Build Graph Inputs
- #ifdef HAVE_VFX_MODIFICATION
- #define VFX_SRP_ATTRIBUTES Attributes
- #define VFX_SRP_VARYINGS Varyings
- #define VFX_SRP_SURFACE_INPUTS SurfaceDescriptionInputs
- #endif
- VertexDescriptionInputs BuildVertexDescriptionInputs(Attributes input)
- {
- VertexDescriptionInputs output;
- ZERO_INITIALIZE(VertexDescriptionInputs, output);
- output.ObjectSpaceNormal = input.normalOS;
- output.ObjectSpaceTangent = input.tangentOS.xyz;
- output.ObjectSpacePosition = input.positionOS;
- return output;
- }
- SurfaceDescriptionInputs BuildSurfaceDescriptionInputs(Varyings input)
- {
- SurfaceDescriptionInputs output;
- ZERO_INITIALIZE(SurfaceDescriptionInputs, output);
- #ifdef HAVE_VFX_MODIFICATION
- #if VFX_USE_GRAPH_VALUES
- uint instanceActiveIndex = asuint(UNITY_ACCESS_INSTANCED_PROP(PerInstance, _InstanceActiveIndex));
- /* WARNING: $splice Could not find named fragment 'VFXLoadGraphValues' */
- #endif
- /* WARNING: $splice Could not find named fragment 'VFXSetFragInputs' */
- #endif
- #if UNITY_UV_STARTS_AT_TOP
- #else
- #endif
- output.uv0 = input.texCoord0;
- #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
- #define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN output.FaceSign = IS_FRONT_VFACE(input.cullFace, true, false);
- #else
- #define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
- #endif
- #undef BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
- return output;
- }
- // --------------------------------------------------
- // Main
- #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/Varyings.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Includes/SpriteUnlitPass.hlsl"
- // --------------------------------------------------
- // Visual Effect Vertex Invocations
- #ifdef HAVE_VFX_MODIFICATION
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/VisualEffectVertex.hlsl"
- #endif
- ENDHLSL
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement