79 lines
2.6 KiB
Plaintext
79 lines
2.6 KiB
Plaintext
|
// This is a premultiply-alpha adaptation of the built-in Unity shader "UI/Default" in Unity 5.6.2 to allow Unity UI stencil masking.
|
||
|
|
||
|
Shader "Spine/SkeletonGraphic"
|
||
|
{
|
||
|
Properties
|
||
|
{
|
||
|
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
|
||
|
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||
|
[Toggle(_CANVAS_GROUP_COMPATIBLE)] _CanvasGroupCompatible("CanvasGroup Compatible", Int) = 1
|
||
|
_Color ("Tint", Color) = (1,1,1,1)
|
||
|
|
||
|
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp ("Stencil Comparison", Float) = 8
|
||
|
[HideInInspector] _Stencil ("Stencil ID", Float) = 0
|
||
|
[HideInInspector][Enum(UnityEngine.Rendering.StencilOp)] _StencilOp ("Stencil Operation", Float) = 0
|
||
|
[HideInInspector] _StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||
|
[HideInInspector] _StencilReadMask ("Stencil Read Mask", Float) = 255
|
||
|
|
||
|
[HideInInspector] _ColorMask ("Color Mask", Float) = 15
|
||
|
|
||
|
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
|
||
|
|
||
|
// Outline properties are drawn via custom editor.
|
||
|
[HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
|
||
|
[HideInInspector][MaterialToggle(_USE_SCREENSPACE_OUTLINE_WIDTH)] _UseScreenSpaceOutlineWidth("Width in Screen Space", Float) = 0
|
||
|
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
|
||
|
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
|
||
|
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
|
||
|
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
|
||
|
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
|
||
|
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
|
||
|
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
|
||
|
}
|
||
|
|
||
|
SubShader
|
||
|
{
|
||
|
Tags
|
||
|
{
|
||
|
"Queue"="Transparent"
|
||
|
"IgnoreProjector"="True"
|
||
|
"RenderType"="Transparent"
|
||
|
"PreviewType"="Plane"
|
||
|
"CanUseSpriteAtlas"="True"
|
||
|
}
|
||
|
|
||
|
Stencil
|
||
|
{
|
||
|
Ref [_Stencil]
|
||
|
Comp [_StencilComp]
|
||
|
Pass [_StencilOp]
|
||
|
ReadMask [_StencilReadMask]
|
||
|
WriteMask [_StencilWriteMask]
|
||
|
}
|
||
|
|
||
|
Cull Off
|
||
|
Lighting Off
|
||
|
ZWrite Off
|
||
|
ZTest [unity_GUIZTestMode]
|
||
|
Fog { Mode Off }
|
||
|
Blend One OneMinusSrcAlpha
|
||
|
ColorMask [_ColorMask]
|
||
|
|
||
|
Pass
|
||
|
{
|
||
|
Name "Normal"
|
||
|
|
||
|
CGPROGRAM
|
||
|
#pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
|
||
|
#pragma shader_feature _ _CANVAS_GROUP_COMPATIBLE
|
||
|
#pragma vertex vert
|
||
|
#pragma fragment frag
|
||
|
#pragma target 2.0
|
||
|
|
||
|
#include "CGIncludes/Spine-SkeletonGraphic-NormalPass.cginc"
|
||
|
ENDCG
|
||
|
}
|
||
|
}
|
||
|
CustomEditor "SpineShaderWithOutlineGUI"
|
||
|
}
|