diff --git a/CHANGELOG.md b/CHANGELOG.md index 106e27089..708627cee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -195,6 +195,8 @@ * **Additional Timeline features.** SpineAnimationStateClip now provides a `Speed Multiplier`, a start time offset parameter `Clip In`, support for blending successive animations by overlapping tracks. An additional `Use Blend Duration` parameter *(defaults to true)* allows for automatic synchronisation of MixDuration with the current overlap blend duration. An additional Spine preferences parameter `Use Blend Duration` has been added which can be disabled to default to the previous behaviour before this update. * Additional `SpriteMask and RectMask2D` example scene added for demonstration of mask setup and interaction. * `Real physics hinge chains` for both 2D and 3D physics. The [SkeletonUtilityBone](http://esotericsoftware.com/spine-unity#SkeletonUtilityBone) Inspector provides an interface to create 2D and 3D hinge chains. Previously created chains have only been respecting gravity, but not momentum of the skeleton or parent bones. The new physics rig created when pressing `Create 3D Hinge Chain` and `Create 2D Hinge Chain` creates a more complex setup that also works when flipping the skeleton. Note that the chain root node is no longer parented to bones of the skeleton. This is a requirement in Unity to have momentum applied properly - do not reparent the chain root to bones of your skeleton, or you will loose any momentum applied by the skeleton's movement. + * `Outline rendering functionality for all shaders.` Every shader now provides an additional set of `Outline` parameters to enable custom outline rendering. When outline rendering is enabled via the `Material` inspector, it automatically switches the shader to the respective `Spine/Outline` shader variant. Outlines are generated by sampling neighbour pixels, so be sure to add enough transparent padding when exporting your atlas textures to fit the desired outline width. In order to enable outline rendering at a skeleton, it is recommended to first prepare an additional outline material copy and then switch the material of the target skeleton to this material. This prevents unnecessary additional runtime material copies and drawcalls. Material switching can be prepared via a [SkeletonRendererCustomMaterials](http://esotericsoftware.com/spine-unity#SkeletonRendererCustomMaterials) component and then enabled or disabled at runtime. Alternatively, you can also directly modify the `SkeletonRenderer.CustomMaterialOverride` property. + Outline rendering is fully supported on `SkeletonGraphic` shaders as well. * **Changes of default values** * `SkeletonMecanim`'s `Layer Mix Mode` now defaults to `MixMode.MixNext` instead of `MixMode.MixAlways`. diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Shaders/SpineShaderWithOutlineGUI.cs b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Shaders/SpineShaderWithOutlineGUI.cs new file mode 100644 index 000000000..880e4fbc3 --- /dev/null +++ b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Shaders/SpineShaderWithOutlineGUI.cs @@ -0,0 +1,169 @@ +/****************************************************************************** + * Spine Runtimes License Agreement + * Last updated May 1, 2019. Replaces all prior versions. + * + * Copyright (c) 2013-2019, Esoteric Software LLC + * + * Integration of the Spine Runtimes into software or otherwise creating + * derivative works of the Spine Runtimes is permitted under the terms and + * conditions of Section 2 of the Spine Editor License Agreement: + * http://esotericsoftware.com/spine-editor-license + * + * Otherwise, it is permitted to integrate the Spine Runtimes into software + * or otherwise create derivative works of the Spine Runtimes (collectively, + * "Products"), provided that each user of the Products must obtain their own + * Spine Editor license and redistribution of the Products in any form must + * include this license and copyright notice. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN + * NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS + * INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +using UnityEngine; +using UnityEditor; +using Spine.Unity; + +using SpineInspectorUtility = Spine.Unity.Editor.SpineInspectorUtility; + +public class SpineShaderWithOutlineGUI : ShaderGUI { + + protected MaterialEditor _materialEditor; + bool _showAdvancedOutlineSettings = false; + + MaterialProperty _OutlineWidth = null; + MaterialProperty _OutlineColor = null; + MaterialProperty _OutlineReferenceTexWidth = null; + MaterialProperty _ThresholdEnd = null; + MaterialProperty _OutlineSmoothness = null; + MaterialProperty _Use8Neighbourhood = null; + MaterialProperty _OutlineMipLevel = null; + + static GUIContent _EnableOutlineText = new GUIContent("Outline", "Enable outline rendering. Draws an outline by sampling 4 or 8 neighbourhood pixels at a given distance specified via 'Outline Width'."); + static GUIContent _OutlineWidthText = new GUIContent("Outline Width", ""); + static GUIContent _OutlineColorText = new GUIContent("Outline Color", ""); + static GUIContent _OutlineReferenceTexWidthText = new GUIContent("Reference Texture Width", ""); + static GUIContent _ThresholdEndText = new GUIContent("Outline Threshold", ""); + static GUIContent _OutlineSmoothnessText = new GUIContent("Outline Smoothness", ""); + static GUIContent _Use8NeighbourhoodText = new GUIContent("Sample 8 Neighbours", ""); + static GUIContent _OutlineMipLevelText = new GUIContent("Outline Mip Level", ""); + + static GUIContent _OutlineAdvancedText = new GUIContent("Advanced", ""); + + protected const string ShaderOutlineNamePrefix = "Spine/Outline/"; + protected const string ShaderNormalNamePrefix = "Spine/"; + + #region ShaderGUI + + public override void OnGUI (MaterialEditor materialEditor, MaterialProperty[] properties) { + FindProperties(properties); // MaterialProperties can be animated so we do not cache them but fetch them every event to ensure animated values are updated correctly + _materialEditor = materialEditor; + + base.OnGUI(materialEditor, properties); + EditorGUILayout.Space(); + RenderOutlineProperties(); + } + + #endregion + + #region Virtual Interface + + protected virtual void FindProperties (MaterialProperty[] props) { + _OutlineWidth = FindProperty("_OutlineWidth", props); + _OutlineReferenceTexWidth = FindProperty("_OutlineReferenceTexWidth", props); + _OutlineColor = FindProperty("_OutlineColor", props); + _ThresholdEnd = FindProperty("_ThresholdEnd", props); + _OutlineSmoothness = FindProperty("_OutlineSmoothness", props); + _Use8Neighbourhood = FindProperty("_Use8Neighbourhood", props); + _OutlineMipLevel = FindProperty("_OutlineMipLevel", props); + } + + protected virtual void RenderOutlineProperties () { + + // Use default labelWidth + EditorGUIUtility.labelWidth = 0f; + + bool mixedValue; + bool isOutlineEnabled = IsOutlineEnabled(_materialEditor, out mixedValue); + EditorGUI.showMixedValue = mixedValue; + EditorGUI.BeginChangeCheck(); + + var origFontStyle = EditorStyles.label.fontStyle; + EditorStyles.label.fontStyle = FontStyle.Bold; + isOutlineEnabled = EditorGUILayout.Toggle(_EnableOutlineText, isOutlineEnabled); + EditorStyles.label.fontStyle = origFontStyle; + EditorGUI.showMixedValue = false; + if (EditorGUI.EndChangeCheck()) { + foreach (Material material in _materialEditor.targets) { + SwitchShaderToOutlineSettings(material, isOutlineEnabled); + } + } + + if (isOutlineEnabled) { + _materialEditor.ShaderProperty(_OutlineWidth, _OutlineWidthText); + _materialEditor.ShaderProperty(_OutlineColor, _OutlineColorText); + + _showAdvancedOutlineSettings = EditorGUILayout.Foldout(_showAdvancedOutlineSettings, _OutlineAdvancedText); + if (_showAdvancedOutlineSettings) { + using (new SpineInspectorUtility.IndentScope()) { + _materialEditor.ShaderProperty(_OutlineReferenceTexWidth, _OutlineReferenceTexWidthText); + _materialEditor.ShaderProperty(_ThresholdEnd, _ThresholdEndText); + _materialEditor.ShaderProperty(_OutlineSmoothness, _OutlineSmoothnessText); + _materialEditor.ShaderProperty(_Use8Neighbourhood, _Use8NeighbourhoodText); + _materialEditor.ShaderProperty(_OutlineMipLevel, _OutlineMipLevelText); + } + } + } + } + + #endregion + + #region Private Functions + + void SwitchShaderToOutlineSettings (Material material, bool enableOutline) { + + var shaderName = material.shader.name; + bool isSetToOutlineShader = shaderName.StartsWith(ShaderOutlineNamePrefix); + if (isSetToOutlineShader && !enableOutline) { + shaderName = shaderName.Replace(ShaderOutlineNamePrefix, ShaderNormalNamePrefix); + _materialEditor.SetShader(Shader.Find(shaderName), false); + return; + } + else if (!isSetToOutlineShader && enableOutline) { + shaderName = shaderName.Replace(ShaderNormalNamePrefix, ShaderOutlineNamePrefix); + _materialEditor.SetShader(Shader.Find(shaderName), false); + return; + } + } + + static bool IsOutlineEnabled (MaterialEditor editor, out bool mixedValue) { + mixedValue = false; + bool isAnyEnabled = false; + foreach (Material material in editor.targets) { + if (material.shader.name.StartsWith(ShaderOutlineNamePrefix)) { + isAnyEnabled = true; + } + else if (isAnyEnabled) { + mixedValue = true; + } + } + return isAnyEnabled; + } + + static bool BoldToggleField (GUIContent label, bool value) { + FontStyle origFontStyle = EditorStyles.label.fontStyle; + EditorStyles.label.fontStyle = FontStyle.Bold; + value = EditorGUILayout.Toggle(label, value, EditorStyles.toggle); + EditorStyles.label.fontStyle = origFontStyle; + return value; + } + + #endregion +} diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Shaders/SpineShaderWithOutlineGUI.cs.meta b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Shaders/SpineShaderWithOutlineGUI.cs.meta new file mode 100644 index 000000000..394bd693e --- /dev/null +++ b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Shaders/SpineShaderWithOutlineGUI.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: efbbf90926e217c40831926fce374905 +timeCreated: 1573666328 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Shaders/SpineSpriteShaderGUI.cs b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Shaders/SpineSpriteShaderGUI.cs index 281d0f3de..5a7ea0627 100644 --- a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Shaders/SpineSpriteShaderGUI.cs +++ b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Shaders/SpineSpriteShaderGUI.cs @@ -33,10 +33,15 @@ using Spine.Unity; using SpineInspectorUtility = Spine.Unity.Editor.SpineInspectorUtility; -public class SpineSpriteShaderGUI : ShaderGUI { +public class SpineSpriteShaderGUI : SpineShaderWithOutlineGUI { static readonly string kShaderVertexLit = "Spine/Sprite/Vertex Lit"; static readonly string kShaderPixelLit = "Spine/Sprite/Pixel Lit"; static readonly string kShaderUnlit = "Spine/Sprite/Unlit"; + + static readonly string kShaderVertexLitOutline = "Spine/Outline/Sprite/Vertex Lit"; + static readonly string kShaderPixelLitOutline = "Spine/Outline/Sprite/Pixel Lit"; + static readonly string kShaderUnlitOutline = "Spine/Outline/Sprite/Unlit"; + static readonly string kShaderLitLW = "Lightweight Render Pipeline/Spine/Sprite"; static readonly int kSolidQueue = 2000; static readonly int kAlphaTestQueue = 2450; @@ -71,8 +76,6 @@ public class SpineSpriteShaderGUI : ShaderGUI { FixedNormalsModelSpace = 1, }; - MaterialEditor _materialEditor; - MaterialProperty _mainTexture = null; MaterialProperty _color = null; @@ -184,6 +187,7 @@ public class SpineSpriteShaderGUI : ShaderGUI { //If not originally a sprite shader set default keywords if (oldShader.name != kShaderVertexLit && oldShader.name != kShaderPixelLit && oldShader.name != kShaderUnlit && + oldShader.name != kShaderVertexLitOutline && oldShader.name != kShaderPixelLitOutline && oldShader.name != kShaderUnlitOutline && oldShader.name != kShaderLitLW) { SetDefaultSpriteKeywords(material, newShader); } @@ -195,7 +199,9 @@ public class SpineSpriteShaderGUI : ShaderGUI { #region Virtual Interface - protected virtual void FindProperties (MaterialProperty[] props) { + protected override void FindProperties (MaterialProperty[] props) { + base.FindProperties(props); + _mainTexture = FindProperty("_MainTex", props); _color = FindProperty("_Color", props); @@ -293,6 +299,11 @@ public class SpineSpriteShaderGUI : ShaderGUI { dataChanged |= RenderRimLightingProperties(); } + { + EditorGUILayout.Space(); + RenderOutlineProperties(); + } + if (dataChanged) { MaterialChanged(_materialEditor); } @@ -911,16 +922,18 @@ public class SpineSpriteShaderGUI : ShaderGUI { } static eLightMode GetMaterialLightMode (Material material) { - if (material.shader.name == kShaderPixelLit) { + if (material.shader.name == kShaderPixelLit || + material.shader.name == kShaderPixelLitOutline) { return eLightMode.PixelLit; } - else if (material.shader.name == kShaderUnlit) { + else if (material.shader.name == kShaderUnlit || + material.shader.name == kShaderUnlitOutline) { return eLightMode.Unlit; } else if (material.shader.name == kShaderLitLW) { return eLightMode.LitLightweight; } - else { // if (material.shader.name == kShaderVertexLit) + else { // if (material.shader.name == kShaderVertexLit || kShaderVertexLitOutline) return eLightMode.VertexLit; } } diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Materials/SkeletonGraphicDefaultOutline.mat b/spine-unity/Assets/Spine/Runtime/spine-unity/Materials/SkeletonGraphicDefaultOutline.mat new file mode 100644 index 000000000..7082bbf64 --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Materials/SkeletonGraphicDefaultOutline.mat @@ -0,0 +1,95 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: SkeletonGraphicDefaultOutline + m_Shader: {fileID: 4800000, guid: 8f5d14d2a7fedb84998c50eb96c8b748, type: 3} + m_ShaderKeywords: _USE8NEIGHBOURHOOD_ON + m_LightmapFlags: 5 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _AlphaTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - PixelSnap: 0 + - _BumpScale: 1 + - _ColorMask: 15 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _EnableExternalAlpha: 0 + - _Glossiness: 0.5 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _OutlineMipLevel: 0 + - _OutlineReferenceTexWidth: 1024 + - _OutlineSmoothness: 1 + - _OutlineWidth: 3 + - _Parallax: 0.02 + - _SrcBlend: 1 + - _Stencil: 0 + - _StencilComp: 8 + - _StencilOp: 0 + - _StencilReadMask: 255 + - _StencilWriteMask: 255 + - _StraightAlphaInput: 0 + - _ThresholdEnd: 0.25 + - _UVSec: 0 + - _Use8Neighbourhood: 1 + - _UseUIAlphaClip: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _Flip: {r: 1, g: 1, b: 1, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 0, a: 1} + - _RendererColor: {r: 1, g: 1, b: 1, a: 1} diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Materials/SkeletonGraphicDefaultOutline.mat.meta b/spine-unity/Assets/Spine/Runtime/spine-unity/Materials/SkeletonGraphicDefaultOutline.mat.meta new file mode 100644 index 000000000..beaf12d1c --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Materials/SkeletonGraphicDefaultOutline.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c4ee0f8f4be17434aa3df5774a03b366 +timeCreated: 1455140322 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Materials/SkeletonGraphicTintBlackOutline.mat b/spine-unity/Assets/Spine/Runtime/spine-unity/Materials/SkeletonGraphicTintBlackOutline.mat new file mode 100644 index 000000000..30d42c7f6 --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Materials/SkeletonGraphicTintBlackOutline.mat @@ -0,0 +1,88 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: SkeletonGraphicTintBlackOutline + m_Shader: {fileID: 4800000, guid: d55d64dd09c46af40a319933a62fa1b2, type: 3} + m_ShaderKeywords: _USE8NEIGHBOURHOOD_ON + m_LightmapFlags: 5 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _BumpScale: 1 + - _ColorMask: 15 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _Glossiness: 0.5 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _OutlineMipLevel: 0 + - _OutlineReferenceTexWidth: 1024 + - _OutlineSmoothness: 1 + - _OutlineWidth: 3 + - _Parallax: 0.02 + - _SrcBlend: 1 + - _Stencil: 0 + - _StencilComp: 8 + - _StencilOp: 0 + - _StencilReadMask: 255 + - _StencilWriteMask: 255 + - _StraightAlphaInput: 0 + - _ThresholdEnd: 0.25 + - _UVSec: 0 + - _Use8Neighbourhood: 1 + - _UseUIAlphaClip: 0 + - _ZWrite: 1 + m_Colors: + - _Black: {r: 0, g: 0, b: 0, a: 0} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 0, a: 1} diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Materials/SkeletonGraphicTintBlackOutline.mat.meta b/spine-unity/Assets/Spine/Runtime/spine-unity/Materials/SkeletonGraphicTintBlackOutline.mat.meta new file mode 100644 index 000000000..a884c7e35 --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Materials/SkeletonGraphicTintBlackOutline.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 94fe565c79b0aeb418cd05e4f1f8343c +timeCreated: 1455140322 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/BlendModes/Spine-Skeleton-PMA-Additive.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/BlendModes/Spine-Skeleton-PMA-Additive.shader index 62aa8cb3e..a3cd46a2f 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/BlendModes/Spine-Skeleton-PMA-Additive.shader +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/BlendModes/Spine-Skeleton-PMA-Additive.shader @@ -13,6 +13,15 @@ Shader "Spine/Blend Modes/Skeleton PMA Additive" { _Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1 [HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0 [Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default + + // Outline properties are drawn via custom editor. + [HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.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] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 } SubShader { @@ -32,6 +41,8 @@ Shader "Spine/Blend Modes/Skeleton PMA Additive" { } Pass { + Name "Normal" + CGPROGRAM #pragma shader_feature _ _STRAIGHT_ALPHA_INPUT #pragma vertex vert @@ -86,7 +97,7 @@ Shader "Spine/Blend Modes/Skeleton PMA Additive" { #pragma multi_compile_shadowcaster #pragma fragmentoption ARB_precision_hint_fastest #include "UnityCG.cginc" - struct v2f { + struct v2f { V2F_SHADOW_CASTER; float4 uvAndAlpha : TEXCOORD1; }; @@ -113,4 +124,5 @@ Shader "Spine/Blend Modes/Skeleton PMA Additive" { ENDCG } } -} \ No newline at end of file + CustomEditor "SpineShaderWithOutlineGUI" +} diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/BlendModes/Spine-Skeleton-PMA-Multiply.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/BlendModes/Spine-Skeleton-PMA-Multiply.shader index ef05e3e47..7fa6158e2 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/BlendModes/Spine-Skeleton-PMA-Multiply.shader +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/BlendModes/Spine-Skeleton-PMA-Multiply.shader @@ -13,6 +13,15 @@ Shader "Spine/Blend Modes/Skeleton PMA Multiply" { _Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1 [HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0 [Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default + + // Outline properties are drawn via custom editor. + [HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.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] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 } SubShader { @@ -32,6 +41,8 @@ Shader "Spine/Blend Modes/Skeleton PMA Multiply" { } Pass { + Name "Normal" + CGPROGRAM #pragma shader_feature _ _STRAIGHT_ALPHA_INPUT #pragma vertex vert @@ -62,7 +73,7 @@ Shader "Spine/Blend Modes/Skeleton PMA Multiply" { float4 frag (VertexOutput i) : SV_Target { float4 texColor = tex2D(_MainTex, i.uv); - + #if defined(_STRAIGHT_ALPHA_INPUT) texColor.rgb *= texColor.a; #endif @@ -86,7 +97,7 @@ Shader "Spine/Blend Modes/Skeleton PMA Multiply" { #pragma multi_compile_shadowcaster #pragma fragmentoption ARB_precision_hint_fastest #include "UnityCG.cginc" - struct v2f { + struct v2f { V2F_SHADOW_CASTER; float4 uvAndAlpha : TEXCOORD1; }; @@ -113,4 +124,5 @@ Shader "Spine/Blend Modes/Skeleton PMA Multiply" { ENDCG } } -} \ No newline at end of file + CustomEditor "SpineShaderWithOutlineGUI" +} diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/BlendModes/Spine-Skeleton-PMA-Screen.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/BlendModes/Spine-Skeleton-PMA-Screen.shader index f059dcb17..ded881d37 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/BlendModes/Spine-Skeleton-PMA-Screen.shader +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/BlendModes/Spine-Skeleton-PMA-Screen.shader @@ -13,6 +13,15 @@ Shader "Spine/Blend Modes/Skeleton PMA Screen" { _Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1 [HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0 [Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default + + // Outline properties are drawn via custom editor. + [HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.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] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 } SubShader { @@ -32,6 +41,8 @@ Shader "Spine/Blend Modes/Skeleton PMA Screen" { } Pass { + Name "Normal" + CGPROGRAM #pragma shader_feature _ _STRAIGHT_ALPHA_INPUT #pragma vertex vert @@ -86,7 +97,7 @@ Shader "Spine/Blend Modes/Skeleton PMA Screen" { #pragma multi_compile_shadowcaster #pragma fragmentoption ARB_precision_hint_fastest #include "UnityCG.cginc" - struct v2f { + struct v2f { V2F_SHADOW_CASTER; float4 uvAndAlpha : TEXCOORD1; }; @@ -113,4 +124,5 @@ Shader "Spine/Blend Modes/Skeleton PMA Screen" { ENDCG } } -} \ No newline at end of file + CustomEditor "SpineShaderWithOutlineGUI" +} diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline.meta b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline.meta new file mode 100644 index 000000000..a058eebc0 --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: e8c87a44b93daed4383ca2ca5dfb3c43 +folderAsset: yes +timeCreated: 1573827942 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/BlendModes.meta b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/BlendModes.meta new file mode 100644 index 000000000..cf3eaf420 --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/BlendModes.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 6a7bd28c2cf2e41499693d9f8f9e2e1a +folderAsset: yes +timeCreated: 1573829102 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/BlendModes/Spine-Skeleton-PMA-Additive-Outline.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/BlendModes/Spine-Skeleton-PMA-Additive-Outline.shader new file mode 100644 index 000000000..e3a2602f2 --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/BlendModes/Spine-Skeleton-PMA-Additive-Outline.shader @@ -0,0 +1,46 @@ +// Outline shader variant of "Spine/Blend Modes/Skeleton PMA Additive" + +Shader "Spine/Outline/Blend Modes/Skeleton PMA Additive" { + Properties { + _Color ("Tint Color", Color) = (1,1,1,1) + [NoScaleOffset] _MainTex ("MainTex", 2D) = "black" {} + [Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0 + _Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1 + [HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0 + [Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default + + // Outline properties are drawn via custom editor. + [HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.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] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 + } + + SubShader { + Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" } + LOD 100 + + Fog { Mode Off } + Cull Off + ZWrite Off + Blend One One + Lighting Off + + Stencil { + Ref[_StencilRef] + Comp[_StencilComp] + Pass Keep + } + + UsePass "Spine/Outline/Skeleton/OUTLINE" + + UsePass "Spine/Blend Modes/Skeleton PMA Additive/NORMAL" + + UsePass "Spine/Blend Modes/Skeleton PMA Additive/CASTER" + } + FallBack "Spine/Blend Modes/Skeleton PMA Additive" + CustomEditor "SpineShaderWithOutlineGUI" +} diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/BlendModes/Spine-Skeleton-PMA-Additive-Outline.shader.meta b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/BlendModes/Spine-Skeleton-PMA-Additive-Outline.shader.meta new file mode 100644 index 000000000..4e5f97b89 --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/BlendModes/Spine-Skeleton-PMA-Additive-Outline.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 0299ffae826705448b6c80ccc6a53b75 +timeCreated: 1573829476 +licenseType: Free +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/BlendModes/Spine-Skeleton-PMA-Multiply-Outline.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/BlendModes/Spine-Skeleton-PMA-Multiply-Outline.shader new file mode 100644 index 000000000..a4b569590 --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/BlendModes/Spine-Skeleton-PMA-Multiply-Outline.shader @@ -0,0 +1,46 @@ +// Outline shader variant of "Spine/Blend Modes/Skeleton PMA Multiply" + +Shader "Spine/Outline/Blend Modes/Skeleton PMA Multiply" { + Properties { + _Color ("Tint Color", Color) = (1,1,1,1) + [NoScaleOffset] _MainTex ("MainTex", 2D) = "black" {} + [Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0 + _Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1 + [HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0 + [Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default + + // Outline properties are drawn via custom editor. + [HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.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] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 + } + + SubShader { + Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" } + LOD 100 + + Fog { Mode Off } + Cull Off + ZWrite Off + Blend DstColor OneMinusSrcAlpha + Lighting Off + + Stencil { + Ref[_StencilRef] + Comp[_StencilComp] + Pass Keep + } + + UsePass "Spine/Outline/Skeleton/OUTLINE" + + UsePass "Spine/Blend Modes/Skeleton PMA Multiply/NORMAL" + + UsePass "Spine/Blend Modes/Skeleton PMA Multiply/CASTER" + } + FallBack "Spine/Blend Modes/Skeleton PMA Multiply" + CustomEditor "SpineShaderWithOutlineGUI" +} diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/BlendModes/Spine-Skeleton-PMA-Multiply-Outline.shader.meta b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/BlendModes/Spine-Skeleton-PMA-Multiply-Outline.shader.meta new file mode 100644 index 000000000..741a24ebe --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/BlendModes/Spine-Skeleton-PMA-Multiply-Outline.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 4b3566a937643b8498d1ec6df5880b77 +timeCreated: 1573829476 +licenseType: Free +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/BlendModes/Spine-Skeleton-PMA-Screen-Outline.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/BlendModes/Spine-Skeleton-PMA-Screen-Outline.shader new file mode 100644 index 000000000..493ca6cfb --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/BlendModes/Spine-Skeleton-PMA-Screen-Outline.shader @@ -0,0 +1,46 @@ +// Outline shader variant of "Spine/Blend Modes/Skeleton PMA Screen" + +Shader "Spine/Outline/Blend Modes/Skeleton PMA Screen" { + Properties { + _Color ("Tint Color", Color) = (1,1,1,1) + [NoScaleOffset] _MainTex ("MainTex", 2D) = "black" {} + [Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0 + _Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1 + [HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0 + [Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default + + // Outline properties are drawn via custom editor. + [HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.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] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 + } + + SubShader { + Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" } + LOD 100 + + Fog { Mode Off } + Cull Off + ZWrite Off + Blend One OneMinusSrcColor + Lighting Off + + Stencil { + Ref[_StencilRef] + Comp[_StencilComp] + Pass Keep + } + + UsePass "Spine/Outline/Skeleton/OUTLINE" + + UsePass "Spine/Blend Modes/Skeleton PMA Screen/NORMAL" + + UsePass "Spine/Blend Modes/Skeleton PMA Screen/CASTER" + } + FallBack "Spine/Blend Modes/Skeleton PMA Screen" + CustomEditor "SpineShaderWithOutlineGUI" +} diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/BlendModes/Spine-Skeleton-PMA-Screen-Outline.shader.meta b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/BlendModes/Spine-Skeleton-PMA-Screen-Outline.shader.meta new file mode 100644 index 000000000..bfb5ad6c3 --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/BlendModes/Spine-Skeleton-PMA-Screen-Outline.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: e61a8d94e453ff641a7e39c4b11cac95 +timeCreated: 1573829476 +licenseType: Free +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/CGIncludes.meta b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/CGIncludes.meta new file mode 100644 index 000000000..42c978667 --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/CGIncludes.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 329bda94bce571446a1a149b53ccf45c +folderAsset: yes +timeCreated: 1574096529 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/CGIncludes/Spine-Outline-Pass.cginc b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/CGIncludes/Spine-Outline-Pass.cginc new file mode 100644 index 000000000..2cf757ed9 --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/CGIncludes/Spine-Outline-Pass.cginc @@ -0,0 +1,120 @@ +#ifndef SPINE_OUTLINE_PASS_INCLUDED +#define SPINE_OUTLINE_PASS_INCLUDED + +#pragma shader_feature _ _USE8NEIGHBOURHOOD_ON +#include "UnityCG.cginc" + +#ifdef SKELETON_GRAPHIC +#include "UnityUI.cginc" +#endif + +sampler2D _MainTex; + +float _OutlineWidth; +float4 _OutlineColor; +float4 _MainTex_TexelSize; +float _ThresholdEnd; +float _OutlineSmoothness; +float _OutlineMipLevel; +int _OutlineReferenceTexWidth; + +#ifdef SKELETON_GRAPHIC +float4 _ClipRect; +#endif + +struct VertexInput { + float4 vertex : POSITION; + float2 uv : TEXCOORD0; + float4 vertexColor : COLOR; + UNITY_VERTEX_INPUT_INSTANCE_ID +}; + +struct VertexOutput { + float4 pos : SV_POSITION; + float2 uv : TEXCOORD0; + float vertexColorAlpha : COLOR; +#ifdef SKELETON_GRAPHIC + float4 worldPosition : TEXCOORD1; +#endif + UNITY_VERTEX_OUTPUT_STEREO +}; + + +#ifdef SKELETON_GRAPHIC + +VertexOutput vertOutlineGraphic(VertexInput v) { + VertexOutput o; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + o.worldPosition = v.vertex; + o.pos = UnityObjectToClipPos(o.worldPosition); + o.uv = v.uv; + +#ifdef UNITY_HALF_TEXEL_OFFSET + o.pos.xy += (_ScreenParams.zw - 1.0) * float2(-1, 1); +#endif + + o.vertexColorAlpha = v.vertexColor.a; + return o; +} + +#else // !SKELETON_GRAPHIC + +VertexOutput vertOutline(VertexInput v) { + VertexOutput o; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + o.pos = UnityObjectToClipPos(v.vertex); + o.uv = v.uv; + o.vertexColorAlpha = v.vertexColor.a; + return o; +} +#endif + +float4 fragOutline(VertexOutput i) : SV_Target { + + float4 texColor = fixed4(0,0,0,0); + + float outlineWidthCompensated = _OutlineWidth / (_OutlineReferenceTexWidth * _MainTex_TexelSize.x); + float xOffset = _MainTex_TexelSize.x * outlineWidthCompensated; + float yOffset = _MainTex_TexelSize.y * outlineWidthCompensated; + float xOffsetDiagonal = _MainTex_TexelSize.x * outlineWidthCompensated * 0.7; + float yOffsetDiagonal = _MainTex_TexelSize.y * outlineWidthCompensated * 0.7; + + float pixelCenter = tex2D(_MainTex, i.uv).a; + + float4 uvCenterWithLod = float4(i.uv, 0, _OutlineMipLevel); + float pixelTop = tex2Dlod(_MainTex, uvCenterWithLod + float4(0, yOffset, 0, 0)).a; + float pixelBottom = tex2Dlod(_MainTex, uvCenterWithLod + float4(0, -yOffset, 0, 0)).a; + float pixelLeft = tex2Dlod(_MainTex, uvCenterWithLod + float4(-xOffset, 0, 0, 0)).a; + float pixelRight = tex2Dlod(_MainTex, uvCenterWithLod + float4(xOffset, 0, 0, 0)).a; +#if _USE8NEIGHBOURHOOD_ON + float numSamples = 8; + float pixelTopLeft = tex2Dlod(_MainTex, uvCenterWithLod + float4(-xOffsetDiagonal, yOffsetDiagonal, 0, 0)).a; + float pixelTopRight = tex2Dlod(_MainTex, uvCenterWithLod + float4(xOffsetDiagonal, yOffsetDiagonal, 0, 0)).a; + float pixelBottomLeft = tex2Dlod(_MainTex, uvCenterWithLod + float4(-xOffsetDiagonal, -yOffsetDiagonal, 0, 0)).a; + float pixelBottomRight = tex2Dlod(_MainTex, uvCenterWithLod + float4(xOffsetDiagonal, -yOffsetDiagonal, 0, 0)).a; + float average = (pixelTop + pixelBottom + pixelLeft + pixelRight + + pixelTopLeft + pixelTopRight + pixelBottomLeft + pixelBottomRight) + * i.vertexColorAlpha / numSamples; +#else // 4 neighbourhood + float numSamples = 1; + float average = (pixelTop + pixelBottom + pixelLeft + pixelRight) * i.vertexColorAlpha / numSamples; +#endif + + float thresholdStart = _ThresholdEnd * (1.0 - _OutlineSmoothness); + float outlineAlpha = saturate((average - thresholdStart) / (_ThresholdEnd - thresholdStart)) - pixelCenter; + texColor.rgba = lerp(texColor, _OutlineColor, outlineAlpha); + +#ifdef SKELETON_GRAPHIC + texColor *= UnityGet2DClipping(i.worldPosition.xy, _ClipRect); +#endif + + return texColor; +} + +#endif // SPINE_OUTLINE_PASS_INCLUDED diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/CGIncludes/Spine-Outline-Pass.cginc.meta b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/CGIncludes/Spine-Outline-Pass.cginc.meta new file mode 100644 index 000000000..f67e757c0 --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/CGIncludes/Spine-Outline-Pass.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 2ec781e799f97504c8a418e168759f70 +timeCreated: 1574096529 +licenseType: Free +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/SkeletonGraphic.meta b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/SkeletonGraphic.meta new file mode 100644 index 000000000..230f17094 --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/SkeletonGraphic.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 6e8ed065898e65f4d9303492725fb912 +folderAsset: yes +timeCreated: 1573829873 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/SkeletonGraphic/Spine-SkeletonGraphic-Outline.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/SkeletonGraphic/Spine-SkeletonGraphic-Outline.shader new file mode 100644 index 000000000..4d6dc41f3 --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/SkeletonGraphic/Spine-SkeletonGraphic-Outline.shader @@ -0,0 +1,73 @@ +// Outline shader variant of "Spine/SkeletonGraphic" + +Shader "Spine/Outline/SkeletonGraphic" +{ + Properties + { + [PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {} + [Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0 + _Color ("Tint", Color) = (1,1,1,1) + + _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 + + // Outline properties are drawn via custom editor. + [HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.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] _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 "Outline" + CGPROGRAM + #pragma vertex vertOutlineGraphic + #pragma fragment fragOutline + #define SKELETON_GRAPHIC + #include "../CGIncludes/Spine-Outline-Pass.cginc" + ENDCG + } + + UsePass "Spine/SkeletonGraphic/NORMAL" + } + FallBack "Spine/SkeletonGraphic" + CustomEditor "SpineShaderWithOutlineGUI" +} diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/SkeletonGraphic/Spine-SkeletonGraphic-Outline.shader.meta b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/SkeletonGraphic/Spine-SkeletonGraphic-Outline.shader.meta new file mode 100644 index 000000000..2968808eb --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/SkeletonGraphic/Spine-SkeletonGraphic-Outline.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 8f5d14d2a7fedb84998c50eb96c8b748 +timeCreated: 1573829873 +licenseType: Free +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/SkeletonGraphic/Spine-SkeletonGraphic-TintBlack-Outline.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/SkeletonGraphic/Spine-SkeletonGraphic-TintBlack-Outline.shader new file mode 100644 index 000000000..318971939 --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/SkeletonGraphic/Spine-SkeletonGraphic-TintBlack-Outline.shader @@ -0,0 +1,67 @@ +// Outline shader variant of "Spine/SkeletonGraphic Tint Black" + +Shader "Spine/Outline/SkeletonGraphic Tint Black" +{ + Properties + { + [PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {} + [Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0 + + _Color ("Tint", Color) = (1,1,1,1) + _Black ("Black Point", Color) = (0,0,0,0) + + _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 + + // Outline properties are drawn via custom editor. + [HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.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] _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] + + UsePass "Spine/Outline/SkeletonGraphic/OUTLINE" + + UsePass "Spine/SkeletonGraphic Tint Black/NORMAL" + } + FallBack "Spine/SkeletonGraphic Tint Black" + CustomEditor "SpineShaderWithOutlineGUI" +} diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/SkeletonGraphic/Spine-SkeletonGraphic-TintBlack-Outline.shader.meta b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/SkeletonGraphic/Spine-SkeletonGraphic-TintBlack-Outline.shader.meta new file mode 100644 index 000000000..a35c5b2e8 --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/SkeletonGraphic/Spine-SkeletonGraphic-TintBlack-Outline.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: d55d64dd09c46af40a319933a62fa1b2 +timeCreated: 1573830121 +licenseType: Free +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Skeleton-Fill-Outline.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Skeleton-Fill-Outline.shader new file mode 100644 index 000000000..f5e411c09 --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Skeleton-Fill-Outline.shader @@ -0,0 +1,43 @@ +// Outline shader variant of "Spine/Skeleton Fill" + +Shader "Spine/Outline/Skeleton Fill" { + Properties { + _FillColor ("FillColor", Color) = (1,1,1,1) + _FillPhase ("FillPhase", Range(0, 1)) = 0 + [NoScaleOffset] _MainTex ("MainTex", 2D) = "white" {} + _Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1 + [Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0 + [HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0 + [Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default + + // Outline properties are drawn via custom editor. + [HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.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] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 + } + SubShader { + Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" } + Blend One OneMinusSrcAlpha + Cull Off + ZWrite Off + Lighting Off + + Stencil { + Ref[_StencilRef] + Comp[_StencilComp] + Pass Keep + } + + UsePass "Spine/Outline/Skeleton/OUTLINE" + + UsePass "Spine/Skeleton Fill/NORMAL" + + UsePass "Spine/Skeleton Fill/CASTER" + } + FallBack "Spine/Skeleton Fill" + CustomEditor "SpineShaderWithOutlineGUI" +} diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Skeleton-Fill-Outline.shader.meta b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Skeleton-Fill-Outline.shader.meta new file mode 100644 index 000000000..3793896de --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Skeleton-Fill-Outline.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: e158cbe58baa093438feb3d691f3daba +timeCreated: 1573817434 +licenseType: Free +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Skeleton-Lit-Outline.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Skeleton-Lit-Outline.shader new file mode 100644 index 000000000..cf7df2958 --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Skeleton-Lit-Outline.shader @@ -0,0 +1,39 @@ +// Outline shader variant of "Spine/Skeleton Lit" + +Shader "Spine/Outline/Skeleton Lit" { + Properties { + _Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1 + [NoScaleOffset] _MainTex ("Main Texture", 2D) = "black" {} + [Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0 + [HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0 + [HideInInspector] [Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default + + // Outline properties are drawn via custom editor. + [HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.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] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 + } + + SubShader { + Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" } + LOD 100 + + Stencil { + Ref[_StencilRef] + Comp[_StencilComp] + Pass Keep + } + + UsePass "Spine/Outline/Skeleton/OUTLINE" + + UsePass "Spine/Skeleton Lit/NORMAL" + + UsePass "Spine/Skeleton Lit/CASTER" + } + FallBack "Spine/Skeleton Lit" + CustomEditor "SpineShaderWithOutlineGUI" +} diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Skeleton-Lit-Outline.shader.meta b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Skeleton-Lit-Outline.shader.meta new file mode 100644 index 000000000..4dd9501b7 --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Skeleton-Lit-Outline.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 10fab3f69a099be4391fe8a1ad880c65 +timeCreated: 1573828963 +licenseType: Free +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Skeleton-Lit-ZWrite-Outline.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Skeleton-Lit-ZWrite-Outline.shader new file mode 100644 index 000000000..5ce901a75 --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Skeleton-Lit-ZWrite-Outline.shader @@ -0,0 +1,40 @@ +// Outline shader variant of "Spine/Skeleton Lit ZWrite" + +Shader "Spine/Outline/Skeleton Lit ZWrite" { + Properties { + _Cutoff ("Depth alpha cutoff", Range(0,1)) = 0.1 + _ShadowAlphaCutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1 + [NoScaleOffset] _MainTex ("Main Texture", 2D) = "black" {} + [Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0 + [HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0 + [HideInInspector] [HideInInspector, Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default + + // Outline properties are drawn via custom editor. + [HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.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] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 + } + + SubShader { + Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" } + LOD 100 + + Stencil { + Ref[_StencilRef] + Comp[_StencilComp] + Pass Keep + } + + UsePass "Spine/Outline/Skeleton/OUTLINE" + + UsePass "Spine/Skeleton Lit ZWrite/NORMAL" + + UsePass "Spine/Skeleton Lit ZWrite/CASTER" + } + FallBack "Spine/Skeleton Lit ZWrite" + CustomEditor "SpineShaderWithOutlineGUI" +} diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Skeleton-Lit-ZWrite-Outline.shader.meta b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Skeleton-Lit-ZWrite-Outline.shader.meta new file mode 100644 index 000000000..e772ed452 --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Skeleton-Lit-ZWrite-Outline.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 756be4f2f738f6c4583bb1c90e16bf0b +timeCreated: 1573828964 +licenseType: Free +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Skeleton-Outline.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Skeleton-Outline.shader new file mode 100644 index 000000000..124f0726e --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Skeleton-Outline.shader @@ -0,0 +1,51 @@ +// Outline shader variant of "Spine/Skeleton" + +Shader "Spine/Outline/Skeleton" { + Properties { + _Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1 + [NoScaleOffset] _MainTex ("Main Texture", 2D) = "black" {} + [Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0 + [HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0 + [Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default + + // Outline properties are drawn via custom editor. + [HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.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] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 + } + + SubShader { + Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" } + + Fog { Mode Off } + Cull Off + ZWrite Off + Blend One OneMinusSrcAlpha + Lighting Off + + Stencil { + Ref[_StencilRef] + Comp[_StencilComp] + Pass Keep + } + + Pass { + Name "Outline" + CGPROGRAM + #pragma vertex vertOutline + #pragma fragment fragOutline + #include "CGIncludes/Spine-Outline-Pass.cginc" + ENDCG + } + + UsePass "Spine/Skeleton/NORMAL" + + UsePass "Spine/Skeleton/CASTER" + } + FallBack "Spine/Skeleton" + CustomEditor "SpineShaderWithOutlineGUI" +} diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Skeleton-Outline.shader.meta b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Skeleton-Outline.shader.meta new file mode 100644 index 000000000..e7dcd76e9 --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Skeleton-Outline.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 28b5cf4804845fe4b868531fd0bb81d5 +timeCreated: 1573817434 +licenseType: Free +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Skeleton-Tint-Outline.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Skeleton-Tint-Outline.shader new file mode 100644 index 000000000..f6fddc08f --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Skeleton-Tint-Outline.shader @@ -0,0 +1,46 @@ +// Outline shader variant of "Spine/Skeleton Tint" + +Shader "Spine/Outline/Skeleton Tint" { + Properties { + _Color ("Tint Color", Color) = (1,1,1,1) + _Black ("Black Point", Color) = (0,0,0,0) + [NoScaleOffset] _MainTex ("MainTex", 2D) = "black" {} + [Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0 + _Cutoff("Shadow alpha cutoff", Range(0,1)) = 0.1 + [HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0 + [Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default + + // Outline properties are drawn via custom editor. + [HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.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] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 + } + + SubShader { + Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" } + + Fog { Mode Off } + Cull Off + ZWrite Off + Blend One OneMinusSrcAlpha + Lighting Off + + Stencil { + Ref[_StencilRef] + Comp[_StencilComp] + Pass Keep + } + + UsePass "Spine/Outline/Skeleton/OUTLINE" + + UsePass "Spine/Skeleton Tint/NORMAL" + + UsePass "Spine/Skeleton Tint/CASTER" + } + FallBack "Spine/Skeleton Tint" + CustomEditor "SpineShaderWithOutlineGUI" +} diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Skeleton-Tint-Outline.shader.meta b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Skeleton-Tint-Outline.shader.meta new file mode 100644 index 000000000..e5d5456d9 --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Skeleton-Tint-Outline.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 4f1fdc166fed03649835949d3b79cba3 +timeCreated: 1573817434 +licenseType: Free +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Skeleton-TintBlack-Outline.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Skeleton-TintBlack-Outline.shader new file mode 100644 index 000000000..0311b5c36 --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Skeleton-TintBlack-Outline.shader @@ -0,0 +1,47 @@ +// Outline shader variant of "Spine/Skeleton Tint Black" + +Shader "Spine/Outline/Skeleton Tint Black" { + Properties { + _Color ("Tint Color", Color) = (1,1,1,1) + _Black ("Black Point", Color) = (0,0,0,0) + [NoScaleOffset] _MainTex ("MainTex", 2D) = "black" {} + [Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0 + _Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1 + [HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0 + [Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default + + // Outline properties are drawn via custom editor. + [HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.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] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 + } + + SubShader { + Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" } + LOD 100 + + Fog { Mode Off } + Cull Off + ZWrite Off + Blend One OneMinusSrcAlpha + Lighting Off + + Stencil { + Ref[_StencilRef] + Comp[_StencilComp] + Pass Keep + } + + UsePass "Spine/Outline/Skeleton/OUTLINE" + + UsePass "Spine/Skeleton Tint Black/NORMAL" + + UsePass "Spine/Skeleton Tint Black/CASTER" + } + FallBack "Spine/Special/Skeleton Grayscale" + CustomEditor "SpineShaderWithOutlineGUI" +} diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Skeleton-TintBlack-Outline.shader.meta b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Skeleton-TintBlack-Outline.shader.meta new file mode 100644 index 000000000..8bbce16a1 --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Skeleton-TintBlack-Outline.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 49cf725a1e40e7742be92917f83946c3 +timeCreated: 1573828963 +licenseType: Free +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Special-Skeleton-Grayscale-Outline.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Special-Skeleton-Grayscale-Outline.shader new file mode 100644 index 000000000..ca76a0ed7 --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Special-Skeleton-Grayscale-Outline.shader @@ -0,0 +1,43 @@ +// Outline shader variant of "Spine/Special/Skeleton Grayscale" + +Shader "Spine/Outline/Special/Skeleton Grayscale" { + Properties { + _GrayPhase ("Phase", Range(0, 1)) = 1 + [NoScaleOffset] _MainTex ("MainTex", 2D) = "white" {} + _Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1 + [Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0 + [HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0 + [Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default + + // Outline properties are drawn via custom editor. + [HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.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] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 + } + + SubShader { + Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" } + Blend One OneMinusSrcAlpha + Cull Off + ZWrite Off + Lighting Off + + Stencil { + Ref[_StencilRef] + Comp[_StencilComp] + Pass Keep + } + + UsePass "Spine/Outline/Skeleton/OUTLINE" + + UsePass "Spine/Special/Skeleton Grayscale/NORMAL" + + UsePass "Spine/Special/Skeleton Grayscale/CASTER" + } + FallBack "Spine/Special/Skeleton Grayscale" + CustomEditor "SpineShaderWithOutlineGUI" +} diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Special-Skeleton-Grayscale-Outline.shader.meta b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Special-Skeleton-Grayscale-Outline.shader.meta new file mode 100644 index 000000000..5f17b0bbe --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Special-Skeleton-Grayscale-Outline.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 1d3e1518ae643a749b086bc7972893d2 +timeCreated: 1573828963 +licenseType: Free +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Sprite.meta b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Sprite.meta new file mode 100644 index 000000000..fff5fc632 --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Sprite.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 615182d5e489bf3478299e5bbf15dc23 +folderAsset: yes +timeCreated: 1573830740 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Sprite/SpritesPixelLit-Outline.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Sprite/SpritesPixelLit-Outline.shader new file mode 100644 index 000000000..c974fb5b3 --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Sprite/SpritesPixelLit-Outline.shader @@ -0,0 +1,83 @@ +// Outline shader variant of "Spine/Sprite/Pixel Lit" + +Shader "Spine/Outline/Sprite/Pixel Lit" +{ + Properties + { + _MainTex ("Main Texture", 2D) = "white" {} + _Color ("Color", Color) = (1,1,1,1) + + _BumpScale("Scale", Float) = 1.0 + _BumpMap ("Normal Map", 2D) = "bump" {} + + [MaterialToggle] PixelSnap ("Pixel snap", Float) = 0 + [PerRendererData] _AlphaTex ("External Alpha", 2D) = "white" {} + [PerRendererData] _EnableExternalAlpha ("Enable External Alpha", Float) = 0 + + _EmissionColor("Color", Color) = (0,0,0,0) + _EmissionMap("Emission", 2D) = "white" {} + _EmissionPower("Emission Power", Float) = 2.0 + + _Glossiness("Smoothness", Range(0.0, 1.0)) = 0.5 + _GlossMapScale("Smoothness Scale", Range(0.0, 1.0)) = 1.0 + [Gamma] _Metallic("Metallic", Range(0.0, 1.0)) = 0.0 + _MetallicGlossMap("Metallic", 2D) = "white" {} + + _DiffuseRamp ("Diffuse Ramp Texture", 2D) = "gray" {} + + _FixedNormal ("Fixed Normal", Vector) = (0,0,1,1) + _Cutoff ("Depth alpha cutoff", Range(0,1)) = 0.5 + _ShadowAlphaCutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1 + _CustomRenderQueue ("Custom Render Queue", Float) = 0.0 + + _OverlayColor ("Overlay Color", Color) = (0,0,0,0) + _Hue("Hue", Range(-0.5,0.5)) = 0.0 + _Saturation("Saturation", Range(0,2)) = 1.0 + _Brightness("Brightness", Range(0,2)) = 1.0 + + _RimPower("Rim Power", Float) = 2.0 + _RimColor ("Rim Color", Color) = (1,1,1,1) + + _BlendTex ("Blend Texture", 2D) = "white" {} + _BlendAmount ("Blend", Range(0,1)) = 0.0 + + [HideInInspector] _SrcBlend ("__src", Float) = 1.0 + [HideInInspector] _DstBlend ("__dst", Float) = 0.0 + [HideInInspector] _RenderQueue ("__queue", Float) = 0.0 + [HideInInspector] _Cull ("__cull", Float) = 0.0 + [HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0 + [Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default + + // Outline properties are drawn via custom editor. + [HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.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] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 + } + + SubShader + { + Tags { "Queue"="Transparent" "RenderType"="Sprite" "AlphaDepth"="False" "CanUseSpriteAtlas"="True" "IgnoreProjector"="True" } + LOD 200 + + Stencil { + Ref[_StencilRef] + Comp[_StencilComp] + Pass Keep + } + + UsePass "Spine/Outline/Skeleton/OUTLINE" + + UsePass "Spine/Sprite/Pixel Lit/FORWARD" + + UsePass "Spine/Sprite/Pixel Lit/FORWARD_DELTA" + + UsePass "Spine/Sprite/Pixel Lit/SHADOWCASTER" + } + + FallBack "Spine/Sprite/Pixel Lit" + CustomEditor "SpineSpriteShaderGUI" +} diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Sprite/SpritesPixelLit-Outline.shader.meta b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Sprite/SpritesPixelLit-Outline.shader.meta new file mode 100644 index 000000000..963554e07 --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Sprite/SpritesPixelLit-Outline.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: a27d4b27c8ecd9840a03558ccc5ad8a3 +timeCreated: 1573830741 +licenseType: Free +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Sprite/SpritesUnlit-Outline.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Sprite/SpritesUnlit-Outline.shader new file mode 100644 index 000000000..d2f004b52 --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Sprite/SpritesUnlit-Outline.shader @@ -0,0 +1,63 @@ +// Outline shader variant of "Spine/Sprite/Unlit" + +Shader "Spine/Outline/Sprite/Unlit" +{ + Properties + { + _MainTex ("Main Texture", 2D) = "white" {} + _Color ("Color", Color) = (1,1,1,1) + + [MaterialToggle] PixelSnap ("Pixel snap", Float) = 0 + [PerRendererData] _AlphaTex ("External Alpha", 2D) = "white" {} + [PerRendererData] _EnableExternalAlpha ("Enable External Alpha", Float) = 0 + + _ZWrite ("Depth Write", Float) = 0.0 + _Cutoff ("Depth alpha cutoff", Range(0,1)) = 0.0 + _ShadowAlphaCutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1 + _CustomRenderQueue ("Custom Render Queue", Float) = 0.0 + + _OverlayColor ("Overlay Color", Color) = (0,0,0,0) + _Hue("Hue", Range(-0.5,0.5)) = 0.0 + _Saturation("Saturation", Range(0,2)) = 1.0 + _Brightness("Brightness", Range(0,2)) = 1.0 + + _BlendTex ("Blend Texture", 2D) = "white" {} + _BlendAmount ("Blend", Range(0,1)) = 0.0 + + [HideInInspector] _SrcBlend ("__src", Float) = 1.0 + [HideInInspector] _DstBlend ("__dst", Float) = 0.0 + [HideInInspector] _RenderQueue ("__queue", Float) = 0.0 + [HideInInspector] _Cull ("__cull", Float) = 0.0 + [HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0 + [Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default + + // Outline properties are drawn via custom editor. + [HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.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] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 + } + + SubShader + { + Tags { "Queue"="Transparent" "RenderType"="Sprite" "AlphaDepth"="False" "CanUseSpriteAtlas"="True" "IgnoreProjector"="True" } + LOD 100 + + Stencil { + Ref[_StencilRef] + Comp[_StencilComp] + Pass Keep + } + + UsePass "Spine/Outline/Skeleton/OUTLINE" + + UsePass "Spine/Sprite/Unlit/NORMAL" + + UsePass "Spine/Sprite/Unlit/SHADOWCASTER" + } + FallBack "Spine/Sprite/Unlit" + CustomEditor "SpineSpriteShaderGUI" +} diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Sprite/SpritesUnlit-Outline.shader.meta b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Sprite/SpritesUnlit-Outline.shader.meta new file mode 100644 index 000000000..0ab753455 --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Sprite/SpritesUnlit-Outline.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 276c07e3bdd5719458187a5823e9d96a +timeCreated: 1573830740 +licenseType: Free +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Sprite/SpritesVertexLit-Outline.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Sprite/SpritesVertexLit-Outline.shader new file mode 100644 index 000000000..a4fd5bf2d --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Sprite/SpritesVertexLit-Outline.shader @@ -0,0 +1,82 @@ +// Outline shader variant of "Spine/Sprite/Vertex Lit" + +Shader "Spine/Outline/Sprite/Vertex Lit" +{ + Properties + { + _MainTex ("Main Texture", 2D) = "white" {} + _Color ("Color", Color) = (1,1,1,1) + + _BumpScale("Scale", Float) = 1.0 + _BumpMap ("Normal Map", 2D) = "bump" {} + + [MaterialToggle] PixelSnap ("Pixel snap", Float) = 0 + [PerRendererData] _AlphaTex ("External Alpha", 2D) = "white" {} + [PerRendererData] _EnableExternalAlpha ("Enable External Alpha", Float) = 0 + + _EmissionColor("Color", Color) = (0,0,0,0) + _EmissionMap("Emission", 2D) = "white" {} + _EmissionPower("Emission Power", Float) = 2.0 + + _Glossiness("Smoothness", Range(0.0, 1.0)) = 0.5 + _GlossMapScale("Smoothness Scale", Range(0.0, 1.0)) = 1.0 + [Gamma] _Metallic("Metallic", Range(0.0, 1.0)) = 0.0 + _MetallicGlossMap("Metallic", 2D) = "white" {} + + _DiffuseRamp ("Diffuse Ramp Texture", 2D) = "gray" {} + + _FixedNormal ("Fixed Normal", Vector) = (0,0,1,1) + _ZWrite ("Depth Write", Float) = 0.0 + _Cutoff ("Depth alpha cutoff", Range(0,1)) = 0.0 + _ShadowAlphaCutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1 + _CustomRenderQueue ("Custom Render Queue", Float) = 0.0 + + _OverlayColor ("Overlay Color", Color) = (0,0,0,0) + _Hue("Hue", Range(-0.5,0.5)) = 0.0 + _Saturation("Saturation", Range(0,2)) = 1.0 + _Brightness("Brightness", Range(0,2)) = 1.0 + + _RimPower("Rim Power", Float) = 2.0 + _RimColor ("Rim Color", Color) = (1,1,1,1) + + _BlendTex ("Blend Texture", 2D) = "white" {} + _BlendAmount ("Blend", Range(0,1)) = 0.0 + + [HideInInspector] _SrcBlend ("__src", Float) = 1.0 + [HideInInspector] _DstBlend ("__dst", Float) = 0.0 + [HideInInspector] _RenderQueue ("__queue", Float) = 0.0 + [HideInInspector] _Cull ("__cull", Float) = 0.0 + [HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0 + [Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default + + // Outline properties are drawn via custom editor. + [HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.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] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 + } + + SubShader + { + Tags { "Queue"="Transparent" "RenderType"="Sprite" "AlphaDepth"="False" "CanUseSpriteAtlas"="True" "IgnoreProjector"="True" } + LOD 150 + + Stencil { + Ref[_StencilRef] + Comp[_StencilComp] + Pass Keep + } + + UsePass "Spine/Outline/Skeleton/OUTLINE" + + UsePass "Spine/Sprite/Vertex Lit/VERTEX" + + UsePass "Spine/Sprite/Vertex Lit/SHADOWCASTER" + } + + FallBack "Spine/Sprite/Vertex Lit" + CustomEditor "SpineSpriteShaderGUI" +} diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Sprite/SpritesVertexLit-Outline.shader.meta b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Sprite/SpritesVertexLit-Outline.shader.meta new file mode 100644 index 000000000..baa2bcfa8 --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Sprite/SpritesVertexLit-Outline.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 30ef5dd318033004588a6481c092416a +timeCreated: 1573830740 +licenseType: Free +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/SkeletonGraphic/Spine-SkeletonGraphic-TintBlack.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/SkeletonGraphic/Spine-SkeletonGraphic-TintBlack.shader index f31d0a20e..88485d387 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/SkeletonGraphic/Spine-SkeletonGraphic-TintBlack.shader +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/SkeletonGraphic/Spine-SkeletonGraphic-TintBlack.shader @@ -19,24 +19,33 @@ Shader "Spine/SkeletonGraphic Tint Black" _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] _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] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 } SubShader { Tags - { - "Queue"="Transparent" - "IgnoreProjector"="True" - "RenderType"="Transparent" + { + "Queue"="Transparent" + "IgnoreProjector"="True" + "RenderType"="Transparent" "PreviewType"="Plane" "CanUseSpriteAtlas"="True" } - + Stencil { Ref [_Stencil] Comp [_StencilComp] - Pass [_StencilOp] + Pass [_StencilOp] ReadMask [_StencilReadMask] WriteMask [_StencilWriteMask] } @@ -51,6 +60,8 @@ Shader "Spine/SkeletonGraphic Tint Black" Pass { + Name "Normal" + CGPROGRAM #pragma shader_feature _ _STRAIGHT_ALPHA_INPUT #pragma vertex vert @@ -122,4 +133,5 @@ Shader "Spine/SkeletonGraphic Tint Black" ENDCG } } + CustomEditor "SpineShaderWithOutlineGUI" } diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/SkeletonGraphic/Spine-SkeletonGraphic.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/SkeletonGraphic/Spine-SkeletonGraphic.shader index c570c6585..3a8259509 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/SkeletonGraphic/Spine-SkeletonGraphic.shader +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/SkeletonGraphic/Spine-SkeletonGraphic.shader @@ -7,7 +7,7 @@ Shader "Spine/SkeletonGraphic" [PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {} [Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0 _Color ("Tint", Color) = (1,1,1,1) - + _StencilComp ("Stencil Comparison", Float) = 8 _Stencil ("Stencil ID", Float) = 0 _StencilOp ("Stencil Operation", Float) = 0 @@ -17,24 +17,33 @@ Shader "Spine/SkeletonGraphic" _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] _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] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 } SubShader { Tags - { - "Queue"="Transparent" - "IgnoreProjector"="True" - "RenderType"="Transparent" + { + "Queue"="Transparent" + "IgnoreProjector"="True" + "RenderType"="Transparent" "PreviewType"="Plane" "CanUseSpriteAtlas"="True" } - + Stencil { Ref [_Stencil] Comp [_StencilComp] - Pass [_StencilOp] + Pass [_StencilOp] ReadMask [_StencilReadMask] WriteMask [_StencilWriteMask] } @@ -49,6 +58,8 @@ Shader "Spine/SkeletonGraphic" Pass { + Name "Normal" + CGPROGRAM #pragma shader_feature _ _STRAIGHT_ALPHA_INPUT #pragma vertex vert @@ -120,4 +131,5 @@ Shader "Spine/SkeletonGraphic" ENDCG } } -} \ No newline at end of file + CustomEditor "SpineShaderWithOutlineGUI" +} diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-Skeleton-Fill.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-Skeleton-Fill.shader index b5b11bd6e..278a1d007 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-Skeleton-Fill.shader +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-Skeleton-Fill.shader @@ -11,6 +11,15 @@ Shader "Spine/Skeleton Fill" { [Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0 [HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0 [Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default + + // Outline properties are drawn via custom editor. + [HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.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] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 } SubShader { Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" } @@ -26,6 +35,8 @@ Shader "Spine/Skeleton Fill" { } Pass { + Name "Normal" + CGPROGRAM #pragma shader_feature _ _STRAIGHT_ALPHA_INPUT #pragma vertex vert @@ -89,7 +100,7 @@ Shader "Spine/Skeleton Fill" { sampler2D _MainTex; fixed _Cutoff; - struct VertexOutput { + struct VertexOutput { V2F_SHADOW_CASTER; float4 uvAndAlpha : TEXCOORD1; }; @@ -111,4 +122,5 @@ Shader "Spine/Skeleton Fill" { } } FallBack "Diffuse" -} \ No newline at end of file + CustomEditor "SpineShaderWithOutlineGUI" +} diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-Skeleton-Lit-ZWrite.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-Skeleton-Lit-ZWrite.shader index 8f112d5f0..2f17afe12 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-Skeleton-Lit-ZWrite.shader +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-Skeleton-Lit-ZWrite.shader @@ -10,6 +10,15 @@ Shader "Spine/Skeleton Lit ZWrite" { [Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0 [HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0 [HideInInspector] [HideInInspector, Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default + + // Outline properties are drawn via custom editor. + [HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.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] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 } SubShader { @@ -23,6 +32,8 @@ Shader "Spine/Skeleton Lit ZWrite" { } Pass { + Name "Normal" + Tags { "LightMode"="Vertex" "Queue"="Transparent" "IgnoreProjector"="true" "RenderType"="Transparent" } ZWrite On @@ -45,7 +56,7 @@ Shader "Spine/Skeleton Lit ZWrite" { Name "Caster" Tags { "LightMode"="ShadowCaster" } Offset 1, 1 - + Fog { Mode Off } ZWrite On ZTest LEqual @@ -57,11 +68,12 @@ Shader "Spine/Skeleton Lit ZWrite" { #pragma fragment fragShadow #pragma multi_compile_shadowcaster #pragma fragmentoption ARB_precision_hint_fastest - + #define SHADOW_CUTOFF _ShadowAlphaCutoff #include "CGIncludes/Spine-Skeleton-Lit-Common-Shadow.cginc" ENDCG } } -} \ No newline at end of file + CustomEditor "SpineShaderWithOutlineGUI" +} diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-Skeleton-Lit.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-Skeleton-Lit.shader index f9d976235..bfbebd196 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-Skeleton-Lit.shader +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-Skeleton-Lit.shader @@ -9,6 +9,15 @@ Shader "Spine/Skeleton Lit" { [Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0 [HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0 [HideInInspector] [Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default + + // Outline properties are drawn via custom editor. + [HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.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] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 } SubShader { @@ -22,6 +31,8 @@ Shader "Spine/Skeleton Lit" { } Pass { + Name "Normal" + Tags { "LightMode"="Vertex" "Queue"="Transparent" "IgnoreProjector"="true" "RenderType"="Transparent" } ZWrite Off @@ -43,7 +54,7 @@ Shader "Spine/Skeleton Lit" { Name "Caster" Tags { "LightMode"="ShadowCaster" } Offset 1, 1 - + Fog { Mode Off } ZWrite On ZTest LEqual @@ -55,11 +66,12 @@ Shader "Spine/Skeleton Lit" { #pragma fragment fragShadow #pragma multi_compile_shadowcaster #pragma fragmentoption ARB_precision_hint_fastest - + #define SHADOW_CUTOFF _Cutoff #include "CGIncludes/Spine-Skeleton-Lit-Common-Shadow.cginc" ENDCG } } -} \ No newline at end of file + CustomEditor "SpineShaderWithOutlineGUI" +} diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-Skeleton-Tint.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-Skeleton-Tint.shader index c4d012adc..38dda548f 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-Skeleton-Tint.shader +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-Skeleton-Tint.shader @@ -10,9 +10,18 @@ Shader "Spine/Skeleton Tint" { _Black ("Black Point", Color) = (0,0,0,0) [NoScaleOffset] _MainTex ("MainTex", 2D) = "black" {} [Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0 - _Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1 + _Cutoff("Shadow alpha cutoff", Range(0,1)) = 0.1 [HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0 [Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default + + // Outline properties are drawn via custom editor. + [HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.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] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 } SubShader { @@ -31,6 +40,8 @@ Shader "Spine/Skeleton Tint" { } Pass { + Name "Normal" + CGPROGRAM #pragma shader_feature _ _STRAIGHT_ALPHA_INPUT #pragma vertex vert @@ -92,7 +103,7 @@ Shader "Spine/Skeleton Tint" { sampler2D _MainTex; fixed _Cutoff; - struct VertexOutput { + struct VertexOutput { V2F_SHADOW_CASTER; float4 uvAndAlpha : TEXCOORD1; }; @@ -113,4 +124,5 @@ Shader "Spine/Skeleton Tint" { ENDCG } } + CustomEditor "SpineShaderWithOutlineGUI" } diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-Skeleton-TintBlack.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-Skeleton-TintBlack.shader index 9af297ff4..851af0f99 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-Skeleton-TintBlack.shader +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-Skeleton-TintBlack.shader @@ -15,6 +15,15 @@ Shader "Spine/Skeleton Tint Black" { _Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1 [HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0 [Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default + + // Outline properties are drawn via custom editor. + [HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.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] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 } SubShader { @@ -34,6 +43,8 @@ Shader "Spine/Skeleton Tint Black" { } Pass { + Name "Normal" + CGPROGRAM #pragma shader_feature _ _STRAIGHT_ALPHA_INPUT #pragma vertex vert @@ -71,7 +82,7 @@ Shader "Spine/Skeleton Tint Black" { float4 frag (VertexOutput i) : SV_Target { float4 texColor = tex2D(_MainTex, i.uv); - + #if defined(_STRAIGHT_ALPHA_INPUT) texColor.rgb *= texColor.a; #endif @@ -98,7 +109,7 @@ Shader "Spine/Skeleton Tint Black" { sampler2D _MainTex; fixed _Cutoff; - struct v2f { + struct v2f { V2F_SHADOW_CASTER; float4 uvAndAlpha : TEXCOORD1; }; @@ -119,4 +130,5 @@ Shader "Spine/Skeleton Tint Black" { ENDCG } } + CustomEditor "SpineShaderWithOutlineGUI" } diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-Skeleton.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-Skeleton.shader index 62649c969..ee02ee477 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-Skeleton.shader +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-Skeleton.shader @@ -5,6 +5,15 @@ Shader "Spine/Skeleton" { [Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0 [HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0 [Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default + + // Outline properties are drawn via custom editor. + [HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.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] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 } SubShader { @@ -23,6 +32,8 @@ Shader "Spine/Skeleton" { } Pass { + Name "Normal" + CGPROGRAM #pragma shader_feature _ _STRAIGHT_ALPHA_INPUT #pragma vertex vert @@ -82,7 +93,7 @@ Shader "Spine/Skeleton" { sampler2D _MainTex; fixed _Cutoff; - struct VertexOutput { + struct VertexOutput { V2F_SHADOW_CASTER; float4 uvAndAlpha : TEXCOORD1; }; @@ -103,4 +114,5 @@ Shader "Spine/Skeleton" { ENDCG } } + CustomEditor "SpineShaderWithOutlineGUI" } diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-Special-Skeleton-Grayscale.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-Special-Skeleton-Grayscale.shader index 228a79a8e..e46d587fd 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-Special-Skeleton-Grayscale.shader +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-Special-Skeleton-Grayscale.shader @@ -10,7 +10,17 @@ Shader "Spine/Special/Skeleton Grayscale" { [Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0 [HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0 [Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default + + // Outline properties are drawn via custom editor. + [HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.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] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 } + SubShader { Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" } Blend One OneMinusSrcAlpha @@ -25,6 +35,8 @@ Shader "Spine/Special/Skeleton Grayscale" { } Pass { + Name "Normal" + CGPROGRAM #pragma shader_feature _ _STRAIGHT_ALPHA_INPUT #pragma vertex vert @@ -89,7 +101,7 @@ Shader "Spine/Special/Skeleton Grayscale" { sampler2D _MainTex; fixed _Cutoff; - struct VertexOutput { + struct VertexOutput { V2F_SHADOW_CASTER; float4 uvAndAlpha : TEXCOORD1; }; @@ -111,4 +123,5 @@ Shader "Spine/Special/Skeleton Grayscale" { } } FallBack "Diffuse" -} \ No newline at end of file + CustomEditor "SpineShaderWithOutlineGUI" +} diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Sprite/SpritesPixelLit.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Sprite/SpritesPixelLit.shader index 423b987d6..f5f7b6c22 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Sprite/SpritesPixelLit.shader +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Sprite/SpritesPixelLit.shader @@ -4,54 +4,63 @@ Shader "Spine/Sprite/Pixel Lit" { _MainTex ("Main Texture", 2D) = "white" {} _Color ("Color", Color) = (1,1,1,1) - + _BumpScale("Scale", Float) = 1.0 - _BumpMap ("Normal Map", 2D) = "bump" {} - + _BumpMap ("Normal Map", 2D) = "bump" {} + [MaterialToggle] PixelSnap ("Pixel snap", Float) = 0 [PerRendererData] _AlphaTex ("External Alpha", 2D) = "white" {} [PerRendererData] _EnableExternalAlpha ("Enable External Alpha", Float) = 0 - - _EmissionColor("Color", Color) = (0,0,0,0) + + _EmissionColor("Color", Color) = (0,0,0,0) _EmissionMap("Emission", 2D) = "white" {} - _EmissionPower("Emission Power", Float) = 2.0 - + _EmissionPower("Emission Power", Float) = 2.0 + _Glossiness("Smoothness", Range(0.0, 1.0)) = 0.5 _GlossMapScale("Smoothness Scale", Range(0.0, 1.0)) = 1.0 [Gamma] _Metallic("Metallic", Range(0.0, 1.0)) = 0.0 _MetallicGlossMap("Metallic", 2D) = "white" {} - + _DiffuseRamp ("Diffuse Ramp Texture", 2D) = "gray" {} - + _FixedNormal ("Fixed Normal", Vector) = (0,0,1,1) _Cutoff ("Depth alpha cutoff", Range(0,1)) = 0.5 _ShadowAlphaCutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1 _CustomRenderQueue ("Custom Render Queue", Float) = 0.0 - + _OverlayColor ("Overlay Color", Color) = (0,0,0,0) - _Hue("Hue", Range(-0.5,0.5)) = 0.0 - _Saturation("Saturation", Range(0,2)) = 1.0 - _Brightness("Brightness", Range(0,2)) = 1.0 - - _RimPower("Rim Power", Float) = 2.0 + _Hue("Hue", Range(-0.5,0.5)) = 0.0 + _Saturation("Saturation", Range(0,2)) = 1.0 + _Brightness("Brightness", Range(0,2)) = 1.0 + + _RimPower("Rim Power", Float) = 2.0 _RimColor ("Rim Color", Color) = (1,1,1,1) - + _BlendTex ("Blend Texture", 2D) = "white" {} _BlendAmount ("Blend", Range(0,1)) = 0.0 - + [HideInInspector] _SrcBlend ("__src", Float) = 1.0 [HideInInspector] _DstBlend ("__dst", Float) = 0.0 [HideInInspector] _RenderQueue ("__queue", Float) = 0.0 [HideInInspector] _Cull ("__cull", Float) = 0.0 [HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0 [Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default + + // Outline properties are drawn via custom editor. + [HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.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] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 } - + SubShader { Tags { "Queue"="Transparent" "RenderType"="Sprite" "AlphaDepth"="False" "CanUseSpriteAtlas"="True" "IgnoreProjector"="True" } LOD 200 - + Stencil { Ref[_StencilRef] Comp[_StencilComp] @@ -60,17 +69,17 @@ Shader "Spine/Sprite/Pixel Lit" Pass { - Name "FORWARD" + Name "FORWARD" Tags { "LightMode" = "ForwardBase" } Blend [_SrcBlend] [_DstBlend] // Note: ZWrite needs to be enabled for following ForwardAdd pass, otherwise parts will look as if shining through by getting lit. ZWrite On ZTest LEqual Cull [_Cull] - + CGPROGRAM #pragma target 3.0 - + #pragma shader_feature _ _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON _ADDITIVEBLEND _ADDITIVEBLEND_SOFT _MULTIPLYBLEND _MULTIPLYBLEND_X2 #pragma shader_feature _ _FIXED_NORMALS_VIEWSPACE _FIXED_NORMALS_VIEWSPACE_BACKFACE _FIXED_NORMALS_MODELSPACE _FIXED_NORMALS_MODELSPACE_BACKFACE #pragma shader_feature _ _SPECULAR _SPECULAR_GLOSSMAP @@ -83,50 +92,50 @@ Shader "Spine/Sprite/Pixel Lit" #pragma shader_feature _TEXTURE_BLEND #pragma shader_feature _SPHERICAL_HARMONICS #pragma shader_feature _FOG - + #pragma multi_compile_fwdbase #pragma fragmentoption ARB_precision_hint_fastest #pragma multi_compile_fog #pragma multi_compile _ PIXELSNAP_ON #pragma multi_compile _ ETC1_EXTERNAL_ALPHA - + #pragma vertex vert #pragma fragment fragBase - - #include "CGIncludes/SpritePixelLighting.cginc" + + #include "CGIncludes/SpritePixelLighting.cginc" ENDCG } Pass - { + { Name "FORWARD_DELTA" Tags { "LightMode" = "ForwardAdd" } Blend [_SrcBlend] One ZWrite Off ZTest LEqual Cull [_Cull] - + CGPROGRAM #pragma target 3.0 - + #pragma shader_feature _ _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON _ADDITIVEBLEND _ADDITIVEBLEND_SOFT _MULTIPLYBLEND _MULTIPLYBLEND_X2 #pragma shader_feature _ _FIXED_NORMALS_VIEWSPACE _FIXED_NORMALS_VIEWSPACE_BACKFACE _FIXED_NORMALS_MODELSPACE _FIXED_NORMALS_MODELSPACE_BACKFACE #pragma shader_feature _ _SPECULAR _SPECULAR_GLOSSMAP #pragma shader_feature _NORMALMAP - #pragma shader_feature _ALPHA_CLIP + #pragma shader_feature _ALPHA_CLIP #pragma shader_feature _DIFFUSE_RAMP #pragma shader_feature _COLOR_ADJUST #pragma shader_feature _TEXTURE_BLEND #pragma shader_feature _FOG - + #pragma multi_compile_fwdadd_fullshadows #pragma fragmentoption ARB_precision_hint_fastest #pragma multi_compile_fog #pragma multi_compile _ PIXELSNAP_ON #pragma multi_compile _ ETC1_EXTERNAL_ALPHA - + #pragma vertex vert #pragma fragment fragAdd - + #include "CGIncludes/SpritePixelLighting.cginc" ENDCG } @@ -135,27 +144,27 @@ Shader "Spine/Sprite/Pixel Lit" Name "ShadowCaster" Tags { "LightMode"="ShadowCaster" } Offset 1, 1 - + Fog { Mode Off } ZWrite On ZTest LEqual Cull Off Lighting Off - - CGPROGRAM + + CGPROGRAM #pragma fragmentoption ARB_precision_hint_fastest #pragma multi_compile_shadowcaster #pragma multi_compile _ PIXELSNAP_ON #pragma multi_compile _ ETC1_EXTERNAL_ALPHA - + #pragma vertex vert #pragma fragment frag - + #include "CGIncludes/SpriteShadows.cginc" ENDCG } } - + FallBack "Spine/Sprite/Unlit" CustomEditor "SpineSpriteShaderGUI" -} \ No newline at end of file +} diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Sprite/SpritesUnlit.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Sprite/SpritesUnlit.shader index 80250c9c2..5dfd30a75 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Sprite/SpritesUnlit.shader +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Sprite/SpritesUnlit.shader @@ -4,37 +4,46 @@ Shader "Spine/Sprite/Unlit" { _MainTex ("Main Texture", 2D) = "white" {} _Color ("Color", Color) = (1,1,1,1) - + [MaterialToggle] PixelSnap ("Pixel snap", Float) = 0 [PerRendererData] _AlphaTex ("External Alpha", 2D) = "white" {} [PerRendererData] _EnableExternalAlpha ("Enable External Alpha", Float) = 0 - + _ZWrite ("Depth Write", Float) = 0.0 _Cutoff ("Depth alpha cutoff", Range(0,1)) = 0.0 _ShadowAlphaCutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1 _CustomRenderQueue ("Custom Render Queue", Float) = 0.0 - + _OverlayColor ("Overlay Color", Color) = (0,0,0,0) _Hue("Hue", Range(-0.5,0.5)) = 0.0 - _Saturation("Saturation", Range(0,2)) = 1.0 - _Brightness("Brightness", Range(0,2)) = 1.0 - + _Saturation("Saturation", Range(0,2)) = 1.0 + _Brightness("Brightness", Range(0,2)) = 1.0 + _BlendTex ("Blend Texture", 2D) = "white" {} _BlendAmount ("Blend", Range(0,1)) = 0.0 - + [HideInInspector] _SrcBlend ("__src", Float) = 1.0 [HideInInspector] _DstBlend ("__dst", Float) = 0.0 [HideInInspector] _RenderQueue ("__queue", Float) = 0.0 [HideInInspector] _Cull ("__cull", Float) = 0.0 [HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0 [Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default + + // Outline properties are drawn via custom editor. + [HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.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] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 } - + SubShader { Tags { "Queue"="Transparent" "RenderType"="Sprite" "AlphaDepth"="False" "CanUseSpriteAtlas"="True" "IgnoreProjector"="True" } LOD 100 - + Stencil { Ref[_StencilRef] Comp[_StencilComp] @@ -43,28 +52,30 @@ Shader "Spine/Sprite/Unlit" Pass { + Name "Normal" + Blend [_SrcBlend] [_DstBlend] Lighting Off ZWrite [_ZWrite] ZTest LEqual Cull [_Cull] Lighting Off - - CGPROGRAM + + CGPROGRAM #pragma shader_feature _ _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON _ADDITIVEBLEND _ADDITIVEBLEND_SOFT _MULTIPLYBLEND _MULTIPLYBLEND_X2 #pragma shader_feature _ALPHA_CLIP #pragma shader_feature _TEXTURE_BLEND #pragma shader_feature _COLOR_ADJUST #pragma shader_feature _FOG - + #pragma fragmentoption ARB_precision_hint_fastest #pragma multi_compile_fog #pragma multi_compile _ PIXELSNAP_ON #pragma multi_compile _ ETC1_EXTERNAL_ALPHA - + #pragma vertex vert #pragma fragment frag - + #include "CGIncludes/SpriteUnlit.cginc" ENDCG } @@ -73,26 +84,26 @@ Shader "Spine/Sprite/Unlit" Name "ShadowCaster" Tags { "LightMode"="ShadowCaster" } Offset 1, 1 - + Fog { Mode Off } ZWrite On ZTest LEqual Cull Off Lighting Off - + CGPROGRAM #pragma fragmentoption ARB_precision_hint_fastest #pragma multi_compile_shadowcaster #pragma multi_compile _ PIXELSNAP_ON #pragma multi_compile _ ETC1_EXTERNAL_ALPHA - + #pragma vertex vert #pragma fragment frag - + #include "CGIncludes/SpriteShadows.cginc" ENDCG } } - + CustomEditor "SpineSpriteShaderGUI" } diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Sprite/SpritesVertexLit.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Sprite/SpritesVertexLit.shader index 2752efa86..360b1540c 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Sprite/SpritesVertexLit.shader +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Sprite/SpritesVertexLit.shader @@ -4,50 +4,59 @@ Shader "Spine/Sprite/Vertex Lit" { _MainTex ("Main Texture", 2D) = "white" {} _Color ("Color", Color) = (1,1,1,1) - + _BumpScale("Scale", Float) = 1.0 _BumpMap ("Normal Map", 2D) = "bump" {} - + [MaterialToggle] PixelSnap ("Pixel snap", Float) = 0 [PerRendererData] _AlphaTex ("External Alpha", 2D) = "white" {} [PerRendererData] _EnableExternalAlpha ("Enable External Alpha", Float) = 0 - + _EmissionColor("Color", Color) = (0,0,0,0) _EmissionMap("Emission", 2D) = "white" {} - _EmissionPower("Emission Power", Float) = 2.0 - + _EmissionPower("Emission Power", Float) = 2.0 + _Glossiness("Smoothness", Range(0.0, 1.0)) = 0.5 _GlossMapScale("Smoothness Scale", Range(0.0, 1.0)) = 1.0 [Gamma] _Metallic("Metallic", Range(0.0, 1.0)) = 0.0 _MetallicGlossMap("Metallic", 2D) = "white" {} - + _DiffuseRamp ("Diffuse Ramp Texture", 2D) = "gray" {} - + _FixedNormal ("Fixed Normal", Vector) = (0,0,1,1) _ZWrite ("Depth Write", Float) = 0.0 _Cutoff ("Depth alpha cutoff", Range(0,1)) = 0.0 _ShadowAlphaCutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1 _CustomRenderQueue ("Custom Render Queue", Float) = 0.0 - + _OverlayColor ("Overlay Color", Color) = (0,0,0,0) _Hue("Hue", Range(-0.5,0.5)) = 0.0 - _Saturation("Saturation", Range(0,2)) = 1.0 - _Brightness("Brightness", Range(0,2)) = 1.0 - - _RimPower("Rim Power", Float) = 2.0 + _Saturation("Saturation", Range(0,2)) = 1.0 + _Brightness("Brightness", Range(0,2)) = 1.0 + + _RimPower("Rim Power", Float) = 2.0 _RimColor ("Rim Color", Color) = (1,1,1,1) - + _BlendTex ("Blend Texture", 2D) = "white" {} _BlendAmount ("Blend", Range(0,1)) = 0.0 - + [HideInInspector] _SrcBlend ("__src", Float) = 1.0 [HideInInspector] _DstBlend ("__dst", Float) = 0.0 [HideInInspector] _RenderQueue ("__queue", Float) = 0.0 [HideInInspector] _Cull ("__cull", Float) = 0.0 [HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0 [Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default + + // Outline properties are drawn via custom editor. + [HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.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] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 } - + SubShader { Tags { "Queue"="Transparent" "RenderType"="Sprite" "AlphaDepth"="False" "CanUseSpriteAtlas"="True" "IgnoreProjector"="True" } @@ -58,20 +67,20 @@ Shader "Spine/Sprite/Vertex Lit" Comp[_StencilComp] Pass Keep } - + Pass { - Name "Vertex" + Name "Vertex" Tags { "LightMode" = "Vertex" } Blend [_SrcBlend] [_DstBlend] ZWrite [_ZWrite] ZTest LEqual Cull [_Cull] Lighting On - + CGPROGRAM #pragma target 3.0 - + #pragma shader_feature _ _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON _ADDITIVEBLEND _ADDITIVEBLEND_SOFT _MULTIPLYBLEND _MULTIPLYBLEND_X2 #pragma shader_feature _ _FIXED_NORMALS_VIEWSPACE _FIXED_NORMALS_VIEWSPACE_BACKFACE _FIXED_NORMALS_MODELSPACE _FIXED_NORMALS_MODELSPACE_BACKFACE #pragma shader_feature _ _SPECULAR _SPECULAR_GLOSSMAP @@ -84,17 +93,17 @@ Shader "Spine/Sprite/Vertex Lit" #pragma shader_feature _TEXTURE_BLEND #pragma shader_feature _SPHERICAL_HARMONICS #pragma shader_feature _FOG - - + + #pragma fragmentoption ARB_precision_hint_fastest #pragma multi_compile_fog #pragma multi_compile _ PIXELSNAP_ON #pragma multi_compile _ ETC1_EXTERNAL_ALPHA - + #pragma vertex vert #pragma fragment frag - - #include "CGIncludes/SpriteVertexLighting.cginc" + + #include "CGIncludes/SpriteVertexLighting.cginc" ENDCG } Pass @@ -102,27 +111,27 @@ Shader "Spine/Sprite/Vertex Lit" Name "ShadowCaster" Tags { "LightMode"="ShadowCaster" } Offset 1, 1 - + Fog { Mode Off } ZWrite On ZTest LEqual Cull Off Lighting Off - - CGPROGRAM + + CGPROGRAM #pragma fragmentoption ARB_precision_hint_fastest #pragma multi_compile_shadowcaster #pragma multi_compile _ PIXELSNAP_ON #pragma multi_compile _ ETC1_EXTERNAL_ALPHA - + #pragma vertex vert #pragma fragment frag - + #include "CGIncludes/SpriteShadows.cginc" ENDCG } } - + FallBack "Spine/Sprite/Unlit" CustomEditor "SpineSpriteShaderGUI" }