[unity] Every Spine URP shader now has an Outline option to switch to the respective Outline shader variant. Closes #1824.

This commit is contained in:
Harald Csaszar 2026-02-05 20:25:23 +01:00
parent 0b6dda9072
commit fef6658917
22 changed files with 754 additions and 14 deletions

View File

@ -44,6 +44,10 @@ public class SpineSpriteShaderGUI : SpineShaderWithOutlineGUI {
static readonly string kShaderLitLW = "Lightweight Render Pipeline/Spine/Sprite";
static readonly string kShaderLitURP = "Universal Render Pipeline/Spine/Sprite";
static readonly string kShaderLitURP2D = "Universal Render Pipeline/2D/Spine/Sprite";
static readonly string kShaderLitURPOutline = "Universal Render Pipeline/Spine/Outline/Sprite";
static readonly string kShaderLitURP2DOutline = "Universal Render Pipeline/2D/Spine/Outline/Sprite";
static readonly int kSolidQueue = 2000;
static readonly int kAlphaTestQueue = 2450;
static readonly int kTransparentQueue = 3000;
@ -217,8 +221,8 @@ public class SpineSpriteShaderGUI : SpineShaderWithOutlineGUI {
if (oldShader.name != kShaderVertexLit && oldShader.name != kShaderPixelLit && oldShader.name != kShaderUnlit &&
oldShader.name != kShaderVertexLitOutline && oldShader.name != kShaderPixelLitOutline && oldShader.name != kShaderUnlitOutline &&
oldShader.name != kShaderLitLW &&
oldShader.name != kShaderLitURP &&
oldShader.name != kShaderLitURP2D) {
oldShader.name != kShaderLitURP && oldShader.name != kShaderLitURPOutline &&
oldShader.name != kShaderLitURP2D && oldShader.name != kShaderLitURP2DOutline) {
SetDefaultSpriteKeywords(material, newShader);
}
@ -362,15 +366,15 @@ public class SpineSpriteShaderGUI : SpineShaderWithOutlineGUI {
foreach (Material material in _materialEditor.targets) {
switch (lightMode) {
case eLightMode.VertexLit:
if (material.shader.name != kShaderVertexLit)
if (material.shader.name != kShaderVertexLit && material.shader.name != kShaderVertexLitOutline)
_materialEditor.SetShader(Shader.Find(kShaderVertexLit), false);
break;
case eLightMode.PixelLit:
if (material.shader.name != kShaderPixelLit)
if (material.shader.name != kShaderPixelLit && material.shader.name != kShaderPixelLitOutline)
_materialEditor.SetShader(Shader.Find(kShaderPixelLit), false);
break;
case eLightMode.Unlit:
if (material.shader.name != kShaderUnlit)
if (material.shader.name != kShaderUnlit && material.shader.name != kShaderUnlitOutline)
_materialEditor.SetShader(Shader.Find(kShaderUnlit), false);
break;
case eLightMode.LitLightweight:
@ -378,11 +382,11 @@ public class SpineSpriteShaderGUI : SpineShaderWithOutlineGUI {
_materialEditor.SetShader(Shader.Find(kShaderLitLW), false);
break;
case eLightMode.LitUniversal:
if (material.shader.name != kShaderLitURP)
if (material.shader.name != kShaderLitURP && material.shader.name != kShaderLitURPOutline)
_materialEditor.SetShader(Shader.Find(kShaderLitURP), false);
break;
case eLightMode.LitUniversal2D:
if (material.shader.name != kShaderLitURP2D)
if (material.shader.name != kShaderLitURP2D && material.shader.name != kShaderLitURP2DOutline)
_materialEditor.SetShader(Shader.Find(kShaderLitURP2D), false);
break;
}
@ -1003,11 +1007,13 @@ public class SpineSpriteShaderGUI : SpineShaderWithOutlineGUI {
}
static bool IsURP3DShader (MaterialEditor editor, out bool mixedValue) {
return IsShaderType(kShaderLitURP, editor, out mixedValue);
return IsShaderType(kShaderLitURP, editor, out mixedValue) ||
IsShaderType(kShaderLitURPOutline, editor, out mixedValue);
}
static bool IsURP2DShader (MaterialEditor editor, out bool mixedValue) {
return IsShaderType(kShaderLitURP2D, editor, out mixedValue);
return IsShaderType(kShaderLitURP2D, editor, out mixedValue) ||
IsShaderType(kShaderLitURP2DOutline, editor, out mixedValue);
}
static bool IsShaderType (string shaderType, MaterialEditor editor, out bool mixedValue) {
@ -1047,9 +1053,11 @@ public class SpineSpriteShaderGUI : SpineShaderWithOutlineGUI {
return eLightMode.Unlit;
} else if (material.shader.name == kShaderLitLW) {
return eLightMode.LitLightweight;
} else if (material.shader.name == kShaderLitURP) {
} else if (material.shader.name == kShaderLitURP ||
material.shader.name == kShaderLitURPOutline) {
return eLightMode.LitUniversal;
} else if (material.shader.name == kShaderLitURP2D) {
} else if (material.shader.name == kShaderLitURP2D ||
material.shader.name == kShaderLitURP2DOutline) {
return eLightMode.LitUniversal2D;
} else { // if (material.shader.name == kShaderVertexLit || kShaderVertexLitOutline)
return eLightMode.VertexLit;

View File

@ -2,7 +2,7 @@
"name": "com.esotericsoftware.spine.spine-unity",
"displayName": "spine-unity Runtime",
"description": "This plugin provides the spine-unity runtime core and examples. Spine Examples can be installed via the Samples tab.",
"version": "4.3.43",
"version": "4.3.44",
"unity": "2018.3",
"author": {
"name": "Esoteric Software",

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0af30802537ded04e8572b42120249b5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,80 @@
Shader "Universal Render Pipeline/2D/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
[MaterialToggle(_TINT_BLACK_ON)] _TintBlack("Tint Black", Float) = 0
_Color(" Light Color", Color) = (1,1,1,1)
_Black(" Dark Color", Color) = (0,0,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][MaterialToggle(_USE_SCREENSPACE_OUTLINE_WIDTH)] _UseScreenSpaceOutlineWidth("Width in Screen Space", Float) = 0
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
[HideInInspector][MaterialToggle(_OUTLINE_FILL_INSIDE)]_Fill("Fill", Float) = 0
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
}
SubShader {
// Universal Pipeline tag is required. If Universal render pipeline is not set in the graphics settings
// this Subshader will fail.
Tags { "RenderPipeline" = "UniversalPipeline" "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
LOD 100
Cull Off
ZWrite Off
Blend One OneMinusSrcAlpha
Stencil {
Ref[_StencilRef]
Comp[_StencilComp]
Pass Keep
}
Pass {
Cull Off
ZWrite Off
Blend One OneMinusSrcAlpha
Name "Outline"
Tags { "LightMode" = "SRPDefaultUnlit" "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
HLSLPROGRAM
// Required to compile gles 2.0 with standard srp library
#pragma prefer_hlslcc gles
#pragma exclude_renderers d3d11_9x
//--------------------------------------
// GPU Instancing
#pragma multi_compile_instancing
#pragma vertex vertOutline
#pragma fragment fragOutline
#pragma shader_feature _ _USE8NEIGHBOURHOOD_ON
#pragma shader_feature _ _USE_SCREENSPACE_OUTLINE_WIDTH
#pragma shader_feature _ _OUTLINE_FILL_INSIDE
#pragma fragmentoption ARB_precision_hint_fastest
#pragma multi_compile_local _ PIXELSNAP_ON
#define USE_URP
#define fixed4 half4
#define fixed3 half3
#define fixed half
#define NO_CUTOFF_PARAM
#include "../../Include/Spine-Input-Outline-URP.hlsl"
#include "../../Include/Spine-Outline-Pass-URP.hlsl"
ENDHLSL
}
UsePass "Universal Render Pipeline/2D/Spine/Skeleton/UNIVERSAL2D"
}
FallBack "Universal Render Pipeline/2D/Sprite-Unlit-Default"
CustomEditor "SpineShaderWithOutlineGUI"
}

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 50bfc4df5fd4cf442b1015e5ad01bdc9
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,86 @@
Shader "Universal Render Pipeline/2D/Spine/Outline/Skeleton Lit" {
Properties {
[NoScaleOffset] _MainTex ("Main Texture", 2D) = "black" {}
[NoScaleOffset] _MaskTex("Mask", 2D) = "white" {}
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
[MaterialToggle(_LIGHT_AFFECTS_ADDITIVE)] _LightAffectsAdditive("Light Affects Additive", Float) = 0
[MaterialToggle(_TINT_BLACK_ON)] _TintBlack("Tint Black", Float) = 0
_Color(" Light Color", Color) = (1,1,1,1)
_Black(" Dark Color", Color) = (0,0,0,0)
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Compare", Float) = 8 // Set to Always as default
// Outline properties are drawn via custom editor.
[HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
[HideInInspector][MaterialToggle(_USE_SCREENSPACE_OUTLINE_WIDTH)] _UseScreenSpaceOutlineWidth("Width in Screen Space", Float) = 0
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
[HideInInspector][MaterialToggle(_OUTLINE_FILL_INSIDE)]_Fill("Fill", Float) = 0
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
}
HLSLINCLUDE
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
ENDHLSL
SubShader {
// UniversalPipeline tag is required. If Universal render pipeline is not set in the graphics settings
// this Subshader will fail.
Tags {"Queue" = "Transparent" "RenderType" = "Transparent" "RenderPipeline" = "UniversalPipeline" "IgnoreProjector" = "True" }
Cull Off
ZWrite Off
Stencil {
Ref[_StencilRef]
Comp[_StencilComp]
Pass Keep
}
Pass {
ZWrite Off
Cull Off
Blend One OneMinusSrcAlpha
Name "Outline"
Tags { "LightMode" = "SRPDefaultUnlit" "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
HLSLPROGRAM
// Required to compile gles 2.0 with standard srp library
#pragma prefer_hlslcc gles
#pragma exclude_renderers d3d11_9x
//--------------------------------------
// GPU Instancing
#pragma multi_compile_instancing
#pragma vertex vertOutline
#pragma fragment fragOutline
#pragma shader_feature _ _USE8NEIGHBOURHOOD_ON
#pragma shader_feature _ _USE_SCREENSPACE_OUTLINE_WIDTH
#pragma shader_feature _ _OUTLINE_FILL_INSIDE
#pragma fragmentoption ARB_precision_hint_fastest
#pragma multi_compile_local _ PIXELSNAP_ON
#define USE_URP
#define fixed4 half4
#define fixed3 half3
#define fixed half
#define NO_CUTOFF_PARAM
#include "../../Include/Spine-Input-Outline-URP.hlsl"
#include "../../Include/Spine-Outline-Pass-URP.hlsl"
ENDHLSL
}
UsePass "Universal Render Pipeline/2D/Spine/Skeleton Lit/UNIVERSAL2D"
UsePass "Universal Render Pipeline/2D/Spine/Skeleton Lit/NORMALS"
UsePass "Universal Render Pipeline/2D/Spine/Skeleton Lit/UNLIT"
}
FallBack "Universal Render Pipeline/2D/Spine/Skeleton"
CustomEditor "SpineShaderWithOutlineGUI"
}

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: debb879e3f89c5f41ac0ab285486e162
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,119 @@
Shader "Universal Render Pipeline/2D/Spine/Outline/Sprite"
{
Properties
{
_MainTex("Main Texture", 2D) = "white" {}
_MaskTex("Mask", 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
_EmissionColor("Color", Color) = (0,0,0,0)
_EmissionMap("Emission", 2D) = "white" {}
_EmissionPower("Emission Power", Float) = 2.0
_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
[MaterialToggle(_LIGHT_AFFECTS_ADDITIVE)] _LightAffectsAdditive("Light Affects Additive", Float) = 0
[MaterialToggle(_TINT_BLACK_ON)] _TintBlack("Tint Black", Float) = 0
_Black("Dark Color", Color) = (0,0,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 Compare", Float) = 8 // Set to Always as default
// Outline properties are drawn via custom editor.
[HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
[HideInInspector][MaterialToggle(_USE_SCREENSPACE_OUTLINE_WIDTH)] _UseScreenSpaceOutlineWidth("Width in Screen Space", Float) = 0
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
[HideInInspector][MaterialToggle(_OUTLINE_FILL_INSIDE)]_Fill("Fill", Float) = 0
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
}
HLSLINCLUDE
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
ENDHLSL
SubShader
{
// UniversalPipeline tag is required. If Universal render pipeline is not set in the graphics settings
// this Subshader will fail.
Tags {"Queue" = "Transparent" "RenderType" = "Sprite" "RenderPipeline" = "UniversalPipeline" "IgnoreProjector" = "True" "AlphaDepth" = "False" "CanUseSpriteAtlas" = "True" }
Stencil {
Ref[_StencilRef]
Comp[_StencilComp]
Pass Keep
}
Blend One OneMinusSrcAlpha
ZWrite[_ZWrite]
Cull[_Cull]
Pass {
Name "Outline"
Tags { "LightMode" = "SRPDefaultUnlit" "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
HLSLPROGRAM
// Required to compile gles 2.0 with standard srp library
#pragma prefer_hlslcc gles
#pragma exclude_renderers d3d11_9x
//--------------------------------------
// GPU Instancing
#pragma multi_compile_instancing
#pragma vertex vertOutline
#pragma fragment fragOutline
#pragma shader_feature _ _USE8NEIGHBOURHOOD_ON
#pragma shader_feature _ _USE_SCREENSPACE_OUTLINE_WIDTH
#pragma shader_feature _ _OUTLINE_FILL_INSIDE
#pragma fragmentoption ARB_precision_hint_fastest
#pragma multi_compile_local _ PIXELSNAP_ON
#define USE_URP
#define fixed4 half4
#define fixed3 half3
#define fixed half
#define NO_CUTOFF_PARAM
#include "../../Include/Spine-Input-Outline-URP.hlsl"
#include "../../Include/Spine-Outline-Pass-URP.hlsl"
ENDHLSL
}
UsePass "Universal Render Pipeline/2D/Spine/Sprite/UNIVERSAL2D"
UsePass "Universal Render Pipeline/2D/Spine/Sprite/NORMALS"
UsePass "Universal Render Pipeline/2D/Spine/Sprite/UNLIT"
}
FallBack "Universal Render Pipeline/2D/Spine/Skeleton Lit"
CustomEditor "SpineSpriteShaderGUI"
}

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: d8278e30a6ef40244a03e6b6227ba490
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -8,6 +8,18 @@ Shader "Universal Render Pipeline/2D/Spine/Skeleton" {
_Black(" Dark Color", Color) = (0,0,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][MaterialToggle(_USE_SCREENSPACE_OUTLINE_WIDTH)] _UseScreenSpaceOutlineWidth("Width in Screen Space", Float) = 0
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
[HideInInspector][MaterialToggle(_OUTLINE_FILL_INSIDE)]_Fill("Fill", Float) = 0
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
}
SubShader {
@ -26,6 +38,7 @@ Shader "Universal Render Pipeline/2D/Spine/Skeleton" {
}
Pass {
Name "Universal2D"
Tags { "LightMode" = "Universal2D" }
ZWrite Off
@ -65,4 +78,5 @@ Shader "Universal Render Pipeline/2D/Spine/Skeleton" {
}
FallBack "Universal Render Pipeline/2D/Sprite-Unlit-Default"
CustomEditor "SpineShaderWithOutlineGUI"
}

View File

@ -9,6 +9,18 @@ Shader "Universal Render Pipeline/2D/Spine/Skeleton Lit" {
_Black(" Dark Color", Color) = (0,0,0,0)
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Compare", Float) = 8 // Set to Always as default
// Outline properties are drawn via custom editor.
[HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
[HideInInspector][MaterialToggle(_USE_SCREENSPACE_OUTLINE_WIDTH)] _UseScreenSpaceOutlineWidth("Width in Screen Space", Float) = 0
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
[HideInInspector][MaterialToggle(_OUTLINE_FILL_INSIDE)]_Fill("Fill", Float) = 0
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
}
HLSLINCLUDE
@ -29,6 +41,7 @@ Shader "Universal Render Pipeline/2D/Spine/Skeleton Lit" {
}
Pass {
Name "Universal2D"
Tags { "LightMode" = "Universal2D" }
ZWrite Off
@ -183,6 +196,7 @@ Shader "Universal Render Pipeline/2D/Spine/Skeleton Lit" {
Pass
{
Name "Normals"
Tags { "LightMode" = "NormalsRendering"}
Blend SrcAlpha OneMinusSrcAlpha
@ -255,4 +269,6 @@ Shader "Universal Render Pipeline/2D/Spine/Skeleton Lit" {
}
}
FallBack "Universal Render Pipeline/2D/Spine/Skeleton"
CustomEditor "SpineShaderWithOutlineGUI"
}

View File

@ -42,6 +42,18 @@ Shader "Universal Render Pipeline/2D/Spine/Sprite"
[HideInInspector] _Cull("__cull", Float) = 0.0
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Compare", Float) = 8 // Set to Always as default
// Outline properties are drawn via custom editor.
[HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
[HideInInspector][MaterialToggle(_USE_SCREENSPACE_OUTLINE_WIDTH)] _UseScreenSpaceOutlineWidth("Width in Screen Space", Float) = 0
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
[HideInInspector][MaterialToggle(_OUTLINE_FILL_INSIDE)]_Fill("Fill", Float) = 0
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
}
HLSLINCLUDE
@ -62,6 +74,7 @@ Shader "Universal Render Pipeline/2D/Spine/Sprite"
Pass
{
Name "Universal2D"
Tags { "LightMode" = "Universal2D" }
Blend[_SrcBlend][_DstBlend]
ZWrite[_ZWrite]
@ -123,6 +136,7 @@ Shader "Universal Render Pipeline/2D/Spine/Sprite"
Pass
{
Name "Normals"
Tags { "LightMode" = "NormalsRendering"}
Blend SrcAlpha OneMinusSrcAlpha

View File

@ -0,0 +1,85 @@
Shader "Universal Render Pipeline/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
[Toggle(_ZWRITE)] _ZWrite("Depth Write", Float) = 0.0
[MaterialToggle(_TINT_BLACK_ON)] _TintBlack("Tint Black", Float) = 0
_Color(" Light Color", Color) = (1,1,1,1)
_Black(" Dark Color", Color) = (0,0,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][MaterialToggle(_USE_SCREENSPACE_OUTLINE_WIDTH)] _UseScreenSpaceOutlineWidth("Width in Screen Space", Float) = 0
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
[HideInInspector][MaterialToggle(_OUTLINE_FILL_INSIDE)]_Fill("Fill", Float) = 0
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
}
SubShader {
// Universal Pipeline tag is required. If Universal render pipeline is not set in the graphics settings
// this Subshader will fail.
Tags { "RenderPipeline" = "UniversalPipeline" "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
LOD 100
Cull Off
ZWrite Off
Blend One OneMinusSrcAlpha
Stencil {
Ref[_StencilRef]
Comp[_StencilComp]
Pass Keep
}
Pass {
Blend One OneMinusSrcAlpha
ZWrite Off
Cull Off
Name "Outline"
Tags { "LightMode" = "SRPDefaultUnlit" "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
HLSLPROGRAM
// Required to compile gles 2.0 with standard srp library
#pragma prefer_hlslcc gles
#pragma exclude_renderers d3d11_9x
//--------------------------------------
// GPU Instancing
#pragma multi_compile_instancing
#pragma vertex vertOutline
#pragma fragment fragOutline
#pragma shader_feature _ _USE8NEIGHBOURHOOD_ON
#pragma shader_feature _ _USE_SCREENSPACE_OUTLINE_WIDTH
#pragma shader_feature _ _OUTLINE_FILL_INSIDE
#pragma fragmentoption ARB_precision_hint_fastest
#pragma multi_compile_local _ PIXELSNAP_ON
#define USE_URP
#define fixed4 half4
#define fixed3 half3
#define fixed half
#define NO_CUTOFF_PARAM
#include "../Include/Spine-Input-Outline-URP.hlsl"
#include "../Include/Spine-Outline-Pass-URP.hlsl"
ENDHLSL
}
UsePass "Universal Render Pipeline/Spine/Skeleton/FORWARD"
UsePass "Universal Render Pipeline/Spine/Skeleton/SHADOWCASTER"
UsePass "Universal Render Pipeline/Spine/Skeleton/DEPTHONLY"
}
FallBack "Universal Render Pipeline/Unlit"
CustomEditor "SpineShaderWithOutlineGUI"
}

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 7277b883ca9a76041bbdd07e8b40567a
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,92 @@
Shader "Universal Render Pipeline/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
[Toggle(_ZWRITE)] _ZWrite("Depth Write", Float) = 0.0
[Toggle(_RECEIVE_SHADOWS)] _ReceiveShadows("Receive Shadows", Int) = 0
[Toggle(_DOUBLE_SIDED_LIGHTING)] _DoubleSidedLighting("Double-Sided Lighting", Int) = 0
[MaterialToggle(_LIGHT_AFFECTS_ADDITIVE)] _LightAffectsAdditive("Light Affects Additive", Float) = 0
[MaterialToggle(_TINT_BLACK_ON)] _TintBlack("Tint Black", Float) = 0
_Color(" Light Color", Color) = (1,1,1,1)
_Black(" Dark Color", Color) = (0,0,0,0)
[MaterialToggle(_ADAPTIVE_PROBE_VOLUMES_PER_PIXEL)] _AdaptiveProbeVolumesPerPixel("APV per Pixel", Float) = 1
[MaterialToggle(_FOG)] _Fog("Fog", Float) = 0
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Compare", Float) = 8 // Set to Always as default
// Outline properties are drawn via custom editor.
[HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
[HideInInspector][MaterialToggle(_USE_SCREENSPACE_OUTLINE_WIDTH)] _UseScreenSpaceOutlineWidth("Width in Screen Space", Float) = 0
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
[HideInInspector][MaterialToggle(_OUTLINE_FILL_INSIDE)]_Fill("Fill", Float) = 0
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
}
SubShader {
// Lightweight Pipeline tag is required. If Lightweight render pipeline is not set in the graphics settings
// this Subshader will fail.
Tags { "RenderPipeline" = "UniversalPipeline" "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
LOD 100
Cull Off
ZWrite[_ZWrite]
Blend One OneMinusSrcAlpha
Stencil {
Ref[_StencilRef]
Comp[_StencilComp]
Pass Keep
}
Pass {
Blend One OneMinusSrcAlpha
ZWrite Off
Cull Off
Name "Outline"
Tags { "LightMode" = "SRPDefaultUnlit" "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
HLSLPROGRAM
// Required to compile gles 2.0 with standard srp library
#pragma prefer_hlslcc gles
#pragma exclude_renderers d3d11_9x
//--------------------------------------
// GPU Instancing
#pragma multi_compile_instancing
#pragma vertex vertOutline
#pragma fragment fragOutline
#pragma shader_feature _ _USE8NEIGHBOURHOOD_ON
#pragma shader_feature _ _USE_SCREENSPACE_OUTLINE_WIDTH
#pragma shader_feature _ _OUTLINE_FILL_INSIDE
#pragma fragmentoption ARB_precision_hint_fastest
#pragma multi_compile_local _ PIXELSNAP_ON
#define USE_URP
#define fixed4 half4
#define fixed3 half3
#define fixed half
#define NO_CUTOFF_PARAM
#include "../Include/Spine-Input-Outline-URP.hlsl"
#include "../Include/Spine-Outline-Pass-URP.hlsl"
ENDHLSL
}
UsePass "Universal Render Pipeline/Spine/Skeleton Lit/FORWARDLIT"
UsePass "Universal Render Pipeline/Spine/Skeleton Lit/SHADOWCASTER"
UsePass "Universal Render Pipeline/Spine/Skeleton Lit/DEPTHONLY"
UsePass "Universal Render Pipeline/Spine/Skeleton Lit/DEPTHNORMALS"
}
FallBack "Universal Render Pipeline/Spine/Skeleton"
CustomEditor "SpineShaderWithOutlineGUI"
}

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 18a9b010095aa104ab9b6e46d52458a0
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,126 @@
Shader "Universal Render Pipeline/Spine/Outline/Sprite"
{
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
_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
[MaterialToggle(_LIGHT_AFFECTS_ADDITIVE)] _LightAffectsAdditive("Light Affects Additive", Float) = 0
[MaterialToggle(_TINT_BLACK_ON)] _TintBlack("Tint Black", Float) = 0
_Black("Dark Color", Color) = (0,0,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 Compare", Float) = 8 // Set to Always as default
// Outline properties are drawn via custom editor.
[HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
[HideInInspector][MaterialToggle(_USE_SCREENSPACE_OUTLINE_WIDTH)] _UseScreenSpaceOutlineWidth("Width in Screen Space", Float) = 0
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
[HideInInspector][MaterialToggle(_OUTLINE_FILL_INSIDE)]_Fill("Fill", Float) = 0
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
}
SubShader
{
// Universal Pipeline tag is required. If Universal render pipeline is not set in the graphics settings
// this Subshader will fail.
Tags { "RenderPipeline"="UniversalPipeline" "Queue"="Transparent" "RenderType"="Sprite" "AlphaDepth"="False" "CanUseSpriteAtlas"="True" "IgnoreProjector"="True" }
LOD 150
Stencil {
Ref[_StencilRef]
Comp[_StencilComp]
Pass Keep
}
Blend One OneMinusSrcAlpha
ZWrite[_ZWrite]
Cull[_Cull]
Pass {
Name "Outline"
Tags { "LightMode" = "SRPDefaultUnlit" "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
HLSLPROGRAM
// Required to compile gles 2.0 with standard srp library
#pragma prefer_hlslcc gles
#pragma exclude_renderers d3d11_9x
//--------------------------------------
// GPU Instancing
#pragma multi_compile_instancing
#pragma vertex vertOutline
#pragma fragment fragOutline
#pragma shader_feature _ _USE8NEIGHBOURHOOD_ON
#pragma shader_feature _ _USE_SCREENSPACE_OUTLINE_WIDTH
#pragma shader_feature _ _OUTLINE_FILL_INSIDE
#pragma fragmentoption ARB_precision_hint_fastest
#pragma multi_compile_local _ PIXELSNAP_ON
#define USE_URP
#define fixed4 half4
#define fixed3 half3
#define fixed half
#define NO_CUTOFF_PARAM
#include "../Include/Spine-Input-Outline-URP.hlsl"
#include "../Include/Spine-Outline-Pass-URP.hlsl"
ENDHLSL
}
UsePass "Universal Render Pipeline/Spine/Sprite/FORWARDLIT"
UsePass "Universal Render Pipeline/Spine/Sprite/SHADOWCASTER"
UsePass "Universal Render Pipeline/Spine/Sprite/DEPTHONLY"
UsePass "Universal Render Pipeline/Spine/Sprite/DEPTHNORMALS"
UsePass "Universal Render Pipeline/Spine/Sprite/UNLIT"
}
FallBack "Universal Render Pipeline/Spine/Skeleton"
CustomEditor "SpineSpriteShaderGUI"
}

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 5f0e279006e63be4cabec163b48d0ed7
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -9,6 +9,18 @@ Shader "Universal Render Pipeline/Spine/Skeleton" {
_Black(" Dark Color", Color) = (0,0,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][MaterialToggle(_USE_SCREENSPACE_OUTLINE_WIDTH)] _UseScreenSpaceOutlineWidth("Width in Screen Space", Float) = 0
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
[HideInInspector][MaterialToggle(_OUTLINE_FILL_INSIDE)]_Fill("Fill", Float) = 0
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
}
SubShader {
@ -141,4 +153,5 @@ Shader "Universal Render Pipeline/Spine/Skeleton" {
}
FallBack "Universal Render Pipeline/Unlit"
CustomEditor "SpineShaderWithOutlineGUI"
}

View File

@ -14,6 +14,18 @@ Shader "Universal Render Pipeline/Spine/Skeleton Lit" {
[MaterialToggle(_FOG)] _Fog("Fog", Float) = 0
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Compare", Float) = 8 // Set to Always as default
// Outline properties are drawn via custom editor.
[HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
[HideInInspector][MaterialToggle(_USE_SCREENSPACE_OUTLINE_WIDTH)] _UseScreenSpaceOutlineWidth("Width in Screen Space", Float) = 0
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
[HideInInspector][MaterialToggle(_OUTLINE_FILL_INSIDE)]_Fill("Fill", Float) = 0
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
}
SubShader {
@ -202,4 +214,5 @@ Shader "Universal Render Pipeline/Spine/Skeleton Lit" {
}
FallBack "Universal Render Pipeline/Spine/Skeleton"
CustomEditor "SpineShaderWithOutlineGUI"
}

View File

@ -48,6 +48,18 @@ Shader "Universal Render Pipeline/Spine/Sprite"
[HideInInspector] _Cull("__cull", Float) = 0.0
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Compare", Float) = 8 // Set to Always as default
// Outline properties are drawn via custom editor.
[HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
[HideInInspector][MaterialToggle(_USE_SCREENSPACE_OUTLINE_WIDTH)] _UseScreenSpaceOutlineWidth("Width in Screen Space", Float) = 0
[HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
[HideInInspector][MaterialToggle(_OUTLINE_FILL_INSIDE)]_Fill("Fill", Float) = 0
[HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
}
SubShader

View File

@ -1,8 +1,8 @@
{
"name": "com.esotericsoftware.spine.urp-shaders",
"displayName": "Spine Universal RP Shaders",
"description": "This plugin provides universal render pipeline (URP) shaders for the spine-unity runtime.\n\nPrerequisites:\nIt requires a working installation of the spine-unity runtime, version 4.3.20 or newer.\n(See http://esotericsoftware.com/git/spine-runtimes/spine-unity)",
"version": "4.3.24",
"description": "This plugin provides universal render pipeline (URP) shaders for the spine-unity runtime.\n\nPrerequisites:\nIt requires a working installation of the spine-unity runtime, version 4.3.44 or newer.\n(See http://esotericsoftware.com/git/spine-runtimes/spine-unity)",
"version": "4.3.25",
"unity": "2019.3",
"author": {
"name": "Esoteric Software",