From 3c386ea2347f90a09dad08cf6e77599ac5171a07 Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Wed, 18 Oct 2023 15:08:28 +0200 Subject: [PATCH 1/5] [haxe] Added note on status of runtime. --- spine-haxe/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spine-haxe/README.md b/spine-haxe/README.md index e3bd01e0d..1d7650d51 100644 --- a/spine-haxe/README.md +++ b/spine-haxe/README.md @@ -1,3 +1,5 @@ +> **Note**: this runtime is a work in progress. Please follow this issue to get alerted once the runtime is deemed complete. https://github.com/EsotericSoftware/spine-runtimes/issues/2249 + # spine-haxe The spine-haxe runtime provides functionality to load, manipulate and render [Spine](http://esotericsoftware.com) skeletal animation data using [Haxe](https://haxe.org/) in combination with [OpenFL](https://www.openfl.org/) and [Lime](https://lime.openfl.org/). From e283fada77cd0d1b048ea7b523ea264fe41aa978 Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Wed, 18 Oct 2023 15:09:17 +0200 Subject: [PATCH 2/5] [pixi] Added note on status of runtime. --- spine-ts/spine-pixi/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spine-ts/spine-pixi/README.md b/spine-ts/spine-pixi/README.md index 20c760dfb..0aa950582 100644 --- a/spine-ts/spine-pixi/README.md +++ b/spine-ts/spine-pixi/README.md @@ -1,3 +1,5 @@ +> **Note**: this runtime is a work in progress. Please follow this issue to get alerted once the runtime is deemed complete. https://github.com/EsotericSoftware/spine-runtimes/issues/2305 + # spine-ts Pixi.js -Please see the top-level [README.md](../README.md) for more information. \ No newline at end of file +Please see the top-level [README.md](../README.md) for more information. From c2425dbddef8b76086c123360872a01507620e34 Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Wed, 18 Oct 2023 17:32:02 +0200 Subject: [PATCH 3/5] [ue] WIP for 5.3 content browser visibility fix. --- .../Source/SpinePlugin/Private/SpineAtlasAsset.cpp | 10 ++++++++++ .../Source/SpinePlugin/Public/SpineAtlasAsset.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineAtlasAsset.cpp b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineAtlasAsset.cpp index bd7f63306..b83e98918 100644 --- a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineAtlasAsset.cpp +++ b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineAtlasAsset.cpp @@ -62,6 +62,16 @@ void USpineAtlasAsset::Serialize(FArchive &Ar) { importData = NewObject(this, TEXT("AssetImportData")); } +FPrimaryAssetId USpineAtlasAsset::GetPrimaryAssetId() const { + return FPrimaryAssetId("spine-atlas", GetFName()); +} + +void USpineAtlasAsset::PostLoadAssetRegistryTags(const FAssetData& InAssetData, + TArray& OutTagsAndValuesToUpdate) const +{ + UObject::PostLoadAssetRegistryTags(InAssetData, OutTagsAndValuesToUpdate); +} + #endif FName USpineAtlasAsset::GetAtlasFileName() const { diff --git a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Public/SpineAtlasAsset.h b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Public/SpineAtlasAsset.h index a57f65363..3a7aa24a5 100644 --- a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Public/SpineAtlasAsset.h +++ b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Public/SpineAtlasAsset.h @@ -72,5 +72,7 @@ protected: virtual void PostInitProperties() override; virtual void GetAssetRegistryTags(TArray &OutTags) const override; virtual void Serialize(FArchive &Ar) override; + virtual FPrimaryAssetId GetPrimaryAssetId() const override; + virtual void PostLoadAssetRegistryTags(const FAssetData& InAssetData, TArray& OutTagsAndValuesToUpdate) const override; #endif }; From 65d68ed45fefd08642887d8cb058cad8399f5890 Mon Sep 17 00:00:00 2001 From: badlogic Date: Wed, 18 Oct 2023 18:18:04 +0200 Subject: [PATCH 4/5] [ue] Temporary (disabled) hack to get atlas and skeleton assets to display in content browsers. This doesn't work, as the UE editor thinks the assets are cooked. It also only loads assets that are referenced. As soon as the references no longer exist, the assets are unloaded. See #2368. --- .../SpinePlugin/Private/SpineAtlasAsset.cpp | 19 ++++++++----------- .../Private/SpineSkeletonDataAsset.cpp | 12 ++++++++++++ .../SpinePlugin/Public/SpineAtlasAsset.h | 4 +--- .../Public/SpineSkeletonDataAsset.h | 1 + 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineAtlasAsset.cpp b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineAtlasAsset.cpp index b83e98918..d80d1e11a 100644 --- a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineAtlasAsset.cpp +++ b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineAtlasAsset.cpp @@ -52,24 +52,21 @@ void USpineAtlasAsset::PostInitProperties() { Super::PostInitProperties(); } -void USpineAtlasAsset::GetAssetRegistryTags(TArray &OutTags) const { - Super::GetAssetRegistryTags(OutTags); -} - void USpineAtlasAsset::Serialize(FArchive &Ar) { Super::Serialize(Ar); if (Ar.IsLoading() && Ar.UE4Ver() < VER_UE4_ASSET_IMPORT_DATA_AS_JSON && !importData) importData = NewObject(this, TEXT("AssetImportData")); } -FPrimaryAssetId USpineAtlasAsset::GetPrimaryAssetId() const { - return FPrimaryAssetId("spine-atlas", GetFName()); -} - void USpineAtlasAsset::PostLoadAssetRegistryTags(const FAssetData& InAssetData, - TArray& OutTagsAndValuesToUpdate) const -{ - UObject::PostLoadAssetRegistryTags(InAssetData, OutTagsAndValuesToUpdate); + TArray& OutTagsAndValuesToUpdate) const { + // FIXME: this is a massive hack. It will set the PackageFlags of the FAssetData + // in the AssetRegistry to PKG_FilterEditorOnly so the content browser displays it. + // This is necessary in UE 5.3 due to a regression in ContentBrowserAssetDataCore::IsPrimaryAsset + // See https://github.com/EsotericSoftware/spine-runtimes/issues/2368 + FAssetData& MutableAssetData = const_cast(InAssetData); + // MutableAssetData.PackageFlags = EPackageFlags::PKG_FilterEditorOnly; + UObject::PostLoadAssetRegistryTags(MutableAssetData, OutTagsAndValuesToUpdate); } #endif diff --git a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonDataAsset.cpp b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonDataAsset.cpp index 808cac805..d95094bb9 100644 --- a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonDataAsset.cpp +++ b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonDataAsset.cpp @@ -80,6 +80,18 @@ void USpineSkeletonDataAsset::Serialize(FArchive &Ar) { LoadInfo(); } + +void USpineSkeletonDataAsset::PostLoadAssetRegistryTags(const FAssetData& InAssetData, + // FIXME: this is a massive hack. It will set the PackageFlags of the FAssetData + // in the AssetRegistry to PKG_FilterEditorOnly so the content browser displays it. + // This is necessary in UE 5.3 due to a regression in ContentBrowserAssetDataCore::IsPrimaryAsset + // See https://github.com/EsotericSoftware/spine-runtimes/issues/2368 + TArray& OutTagsAndValuesToUpdate) const { + FAssetData& MutableAssetData = const_cast(InAssetData); + // MutableAssetData.PackageFlags = EPackageFlags::PKG_FilterEditorOnly; + UObject::PostLoadAssetRegistryTags(MutableAssetData, OutTagsAndValuesToUpdate); +} + #endif void USpineSkeletonDataAsset::ClearNativeData() { diff --git a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Public/SpineAtlasAsset.h b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Public/SpineAtlasAsset.h index 3a7aa24a5..b6a22a808 100644 --- a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Public/SpineAtlasAsset.h +++ b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Public/SpineAtlasAsset.h @@ -36,7 +36,7 @@ // clang-format on UCLASS(BlueprintType, ClassGroup = (Spine)) -class SPINEPLUGIN_API USpineAtlasAsset : public UObject { +class SPINEPLUGIN_API USpineAtlasAsset : public UPrimaryDataAsset { GENERATED_BODY() public: @@ -70,9 +70,7 @@ protected: class UAssetImportData *importData; virtual void PostInitProperties() override; - virtual void GetAssetRegistryTags(TArray &OutTags) const override; virtual void Serialize(FArchive &Ar) override; - virtual FPrimaryAssetId GetPrimaryAssetId() const override; virtual void PostLoadAssetRegistryTags(const FAssetData& InAssetData, TArray& OutTagsAndValuesToUpdate) const override; #endif }; diff --git a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Public/SpineSkeletonDataAsset.h b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Public/SpineSkeletonDataAsset.h index dd23d8c9e..407c521e9 100644 --- a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Public/SpineSkeletonDataAsset.h +++ b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Public/SpineSkeletonDataAsset.h @@ -116,6 +116,7 @@ protected: virtual void PostInitProperties() override; virtual void GetAssetRegistryTags(TArray &OutTags) const override; virtual void Serialize(FArchive &Ar) override; + virtual void PostLoadAssetRegistryTags(const FAssetData& InAssetData, TArray& OutTagsAndValuesToUpdate) const override; #endif void LoadInfo(); From 3c1492ac3290cc4f04d677e8c10bf3c862bd7b7d Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Wed, 18 Oct 2023 18:19:42 +0200 Subject: [PATCH 5/5] [unity] URP Shaders: Added Tint Black functionality at "Blend Modes" URP 2D and 3D shaders. --- CHANGELOG.md | 1 + .../Spine-Skeleton-Additive-URP-2D.shader | 25 +++++-- .../Spine-Skeleton-Multiply-URP-2D.shader | 25 +++++-- .../Spine-Skeleton-Screen-URP-2D.shader | 25 +++++-- .../Spine-Skeleton-Additive-URP.shader | 69 +++++++------------ .../Spine-Skeleton-Multiply-URP.shader | 33 +++++++-- .../Spine-Skeleton-Screen-URP.shader | 33 +++++++-- .../Spine-BlendModes-NormalPass-URP.hlsl | 40 ----------- .../Spine-BlendModes-NormalPass-URP.hlsl.meta | 10 --- .../Include/Spine-Input-BlendModes-URP.hlsl | 21 ------ .../Spine-Input-BlendModes-URP.hlsl.meta | 10 --- .../Spine-Skeleton-ForwardPass-URP.hlsl | 2 + .../package.json | 2 +- 13 files changed, 145 insertions(+), 151 deletions(-) delete mode 100644 spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Include/Spine-BlendModes-NormalPass-URP.hlsl delete mode 100644 spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Include/Spine-BlendModes-NormalPass-URP.hlsl.meta delete mode 100644 spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Include/Spine-Input-BlendModes-URP.hlsl delete mode 100644 spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Include/Spine-Input-BlendModes-URP.hlsl.meta diff --git a/CHANGELOG.md b/CHANGELOG.md index 47fd19045..bee9d97e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -115,6 +115,7 @@ * URP Shaders: Added `Depth Write` property to shaders `Universal Render Pipeline/Spine/Skeleton` and `Universal Render Pipeline/Spine/Skeleton Lit`. Defaults to false to maintain existing behaviour. * Added `Animation Update` mode (called `UpdateTiming` in code) `In Late Update` for `SkeletonAnimation`, `SkeletonMecanim` and `SkeletonGraphic`. This allows you to update the `SkeletonMecanim` skeleton in the same frame that the Mecanim Animator updated its state, which happens between `Update` and `LateUpdate`. * URP Shaders: Added URP "Blend Mode" shader variants for both URP 3D and URP 2D renderers. They are listed under shader name "Universal Render Pipeline/Spine/Blend Modes/" and "Universal Render Pipeline/2D/Spine/Blend Modes/" respectively. + * URP Shaders: Added support for [Tint Black](http://en.esotericsoftware.com/spine-slots#Tint-black) functionality at "Blend Modes" Spine URP shaders (2D and 3D shaders). * **Breaking changes** * Made `SkeletonGraphic.unscaledTime` parameter protected, use the new property `UnscaledTime` instead. diff --git a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/BlendModes/Spine-Skeleton-Additive-URP-2D.shader b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/BlendModes/Spine-Skeleton-Additive-URP-2D.shader index 765a4eabb..1fe8f8510 100644 --- a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/BlendModes/Spine-Skeleton-Additive-URP-2D.shader +++ b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/BlendModes/Spine-Skeleton-Additive-URP-2D.shader @@ -4,6 +4,8 @@ [NoScaleOffset] _MainTex ("MainTex", 2D) = "black" {} [Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0 _Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1 + [MaterialToggle(_TINT_BLACK_ON)] _TintBlack("Tint Black", Float) = 0 + _Black(" Dark Color", Color) = (0,0,0,0) [HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0 [HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default } @@ -28,9 +30,24 @@ Tags { "LightMode" = "Universal2D" } HLSLPROGRAM + // Required to compile gles 2.0 with standard srp library + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + + // ------------------------------------- + // Unity defined keywords + #pragma multi_compile_fog + + //-------------------------------------- + // GPU Instancing + #pragma multi_compile_instancing + + //-------------------------------------- + // Spine related keywords + #pragma shader_feature _ _STRAIGHT_ALPHA_INPUT + #pragma shader_feature _TINT_BLACK_ON #pragma vertex vert #pragma fragment frag - #pragma shader_feature _ _STRAIGHT_ALPHA_INPUT #undef LIGHTMAP_ON @@ -38,10 +55,10 @@ #define fixed4 half4 #define fixed3 half3 #define fixed half - #include "../../Include/Spine-Input-BlendModes-URP.hlsl" - #include "../../Include/Spine-BlendModes-NormalPass-URP.hlsl" + #define APPLY_MATERIAL_TINT_COLOR + #include "../../Include/Spine-Input-URP.hlsl" + #include "../../Include/Spine-Skeleton-ForwardPass-URP.hlsl" ENDHLSL } } - CustomEditor "SpineShaderWithOutlineGUI" } diff --git a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/BlendModes/Spine-Skeleton-Multiply-URP-2D.shader b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/BlendModes/Spine-Skeleton-Multiply-URP-2D.shader index 3ee7c1708..17048d9e2 100644 --- a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/BlendModes/Spine-Skeleton-Multiply-URP-2D.shader +++ b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/BlendModes/Spine-Skeleton-Multiply-URP-2D.shader @@ -4,6 +4,8 @@ [NoScaleOffset] _MainTex ("MainTex", 2D) = "black" {} [Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0 _Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1 + [MaterialToggle(_TINT_BLACK_ON)] _TintBlack("Tint Black", Float) = 0 + _Black(" Dark Color", Color) = (0,0,0,0) [HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0 [HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default } @@ -28,9 +30,24 @@ Tags { "LightMode" = "Universal2D" } HLSLPROGRAM + // Required to compile gles 2.0 with standard srp library + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + + // ------------------------------------- + // Unity defined keywords + #pragma multi_compile_fog + + //-------------------------------------- + // GPU Instancing + #pragma multi_compile_instancing + + //-------------------------------------- + // Spine related keywords + #pragma shader_feature _ _STRAIGHT_ALPHA_INPUT + #pragma shader_feature _TINT_BLACK_ON #pragma vertex vert #pragma fragment frag - #pragma shader_feature _ _STRAIGHT_ALPHA_INPUT #undef LIGHTMAP_ON @@ -38,10 +55,10 @@ #define fixed4 half4 #define fixed3 half3 #define fixed half - #include "../../Include/Spine-Input-BlendModes-URP.hlsl" - #include "../../Include/Spine-BlendModes-NormalPass-URP.hlsl" + #define APPLY_MATERIAL_TINT_COLOR + #include "../../Include/Spine-Input-URP.hlsl" + #include "../../Include/Spine-Skeleton-ForwardPass-URP.hlsl" ENDHLSL } } - CustomEditor "SpineShaderWithOutlineGUI" } diff --git a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/BlendModes/Spine-Skeleton-Screen-URP-2D.shader b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/BlendModes/Spine-Skeleton-Screen-URP-2D.shader index 28ffba1df..159d74a1e 100644 --- a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/BlendModes/Spine-Skeleton-Screen-URP-2D.shader +++ b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/BlendModes/Spine-Skeleton-Screen-URP-2D.shader @@ -4,6 +4,8 @@ [NoScaleOffset] _MainTex ("MainTex", 2D) = "black" {} [Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0 _Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1 + [MaterialToggle(_TINT_BLACK_ON)] _TintBlack("Tint Black", Float) = 0 + _Black(" Dark Color", Color) = (0,0,0,0) [HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0 [HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default } @@ -28,9 +30,24 @@ Tags { "LightMode" = "Universal2D" } HLSLPROGRAM + // Required to compile gles 2.0 with standard srp library + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + + // ------------------------------------- + // Unity defined keywords + #pragma multi_compile_fog + + //-------------------------------------- + // GPU Instancing + #pragma multi_compile_instancing + + //-------------------------------------- + // Spine related keywords + #pragma shader_feature _ _STRAIGHT_ALPHA_INPUT + #pragma shader_feature _TINT_BLACK_ON #pragma vertex vert #pragma fragment frag - #pragma shader_feature _ _STRAIGHT_ALPHA_INPUT #undef LIGHTMAP_ON @@ -38,10 +55,10 @@ #define fixed4 half4 #define fixed3 half3 #define fixed half - #include "../../Include/Spine-Input-BlendModes-URP.hlsl" - #include "../../Include/Spine-BlendModes-NormalPass-URP.hlsl" + #define APPLY_MATERIAL_TINT_COLOR + #include "../../Include/Spine-Input-URP.hlsl" + #include "../../Include/Spine-Skeleton-ForwardPass-URP.hlsl" ENDHLSL } } - CustomEditor "SpineShaderWithOutlineGUI" } diff --git a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/BlendModes/Spine-Skeleton-Additive-URP.shader b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/BlendModes/Spine-Skeleton-Additive-URP.shader index 929396eb6..a99c16785 100644 --- a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/BlendModes/Spine-Skeleton-Additive-URP.shader +++ b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/BlendModes/Spine-Skeleton-Additive-URP.shader @@ -4,6 +4,8 @@ [NoScaleOffset] _MainTex ("MainTex", 2D) = "black" {} [Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0 _Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1 + [MaterialToggle(_TINT_BLACK_ON)] _TintBlack("Tint Black", Float) = 0 + _Black(" Dark Color", Color) = (0,0,0,0) [HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0 [HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default } @@ -15,7 +17,6 @@ Fog { Mode Off } Cull Off ZWrite Off - Blend One One Lighting Off Stencil { @@ -27,10 +28,28 @@ Pass { Name "Forward" Tags{"LightMode" = "UniversalForward"} + + Blend One One + HLSLPROGRAM + // Required to compile gles 2.0 with standard srp library + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + + // ------------------------------------- + // Unity defined keywords + #pragma multi_compile_fog + + //-------------------------------------- + // GPU Instancing + #pragma multi_compile_instancing + + //-------------------------------------- + // Spine related keywords + #pragma shader_feature _ _STRAIGHT_ALPHA_INPUT + #pragma shader_feature _TINT_BLACK_ON #pragma vertex vert #pragma fragment frag - #pragma shader_feature _ _STRAIGHT_ALPHA_INPUT #undef LIGHTMAP_ON @@ -38,48 +57,12 @@ #define fixed4 half4 #define fixed3 half3 #define fixed half - #include "../Include/Spine-Input-BlendModes-URP.hlsl" - #include "../Include/Spine-BlendModes-NormalPass-URP.hlsl" + #define APPLY_MATERIAL_TINT_COLOR + #include "../Include/Spine-Input-URP.hlsl" + #include "../Include/Spine-Skeleton-ForwardPass-URP.hlsl" ENDHLSL - } + } - Pass - { - Name "ShadowCaster" - Tags{"LightMode" = "ShadowCaster"} - - ZWrite On - ColorMask 0 - ZTest LEqual - Cull Off - - HLSLPROGRAM - // Required to compile gles 2.0 with standard srp library - #pragma prefer_hlslcc gles - #pragma exclude_renderers d3d11_9x - #pragma target 2.0 - - // ------------------------------------- - // Material Keywords - #pragma shader_feature _ALPHATEST_ON - - //-------------------------------------- - // GPU Instancing - #pragma multi_compile_instancing - #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A - - #pragma vertex ShadowPassVertexSkeletonLit - #pragma fragment ShadowPassFragmentSkeletonLit - - #define USE_URP - #define fixed4 half4 - #define fixed3 half3 - #define fixed half - #include "../Include/Spine-Input-BlendModes-URP.hlsl" - #include "../Include/Spine-SkeletonLit-ShadowCasterPass-URP.hlsl" - - ENDHLSL - } + UsePass "Universal Render Pipeline/Spine/Skeleton/SHADOWCASTER" } - CustomEditor "SpineShaderWithOutlineGUI" } diff --git a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/BlendModes/Spine-Skeleton-Multiply-URP.shader b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/BlendModes/Spine-Skeleton-Multiply-URP.shader index 0d003ebb5..80302211d 100644 --- a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/BlendModes/Spine-Skeleton-Multiply-URP.shader +++ b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/BlendModes/Spine-Skeleton-Multiply-URP.shader @@ -4,6 +4,8 @@ [NoScaleOffset] _MainTex ("MainTex", 2D) = "black" {} [Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0 _Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1 + [MaterialToggle(_TINT_BLACK_ON)] _TintBlack("Tint Black", Float) = 0 + _Black(" Dark Color", Color) = (0,0,0,0) [HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0 [HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default } @@ -15,7 +17,6 @@ Fog { Mode Off } Cull Off ZWrite Off - Blend DstColor OneMinusSrcAlpha Lighting Off Stencil { @@ -27,10 +28,28 @@ Pass { Name "Forward" Tags{"LightMode" = "UniversalForward"} + + Blend DstColor OneMinusSrcAlpha + HLSLPROGRAM + // Required to compile gles 2.0 with standard srp library + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + + // ------------------------------------- + // Unity defined keywords + #pragma multi_compile_fog + + //-------------------------------------- + // GPU Instancing + #pragma multi_compile_instancing + + //-------------------------------------- + // Spine related keywords + #pragma shader_feature _ _STRAIGHT_ALPHA_INPUT + #pragma shader_feature _TINT_BLACK_ON #pragma vertex vert #pragma fragment frag - #pragma shader_feature _ _STRAIGHT_ALPHA_INPUT #undef LIGHTMAP_ON @@ -38,12 +57,12 @@ #define fixed4 half4 #define fixed3 half3 #define fixed half - #include "../Include/Spine-Input-BlendModes-URP.hlsl" - #include "../Include/Spine-BlendModes-NormalPass-URP.hlsl" + #define APPLY_MATERIAL_TINT_COLOR + #include "../Include/Spine-Input-URP.hlsl" + #include "../Include/Spine-Skeleton-ForwardPass-URP.hlsl" ENDHLSL - } + } - UsePass "Universal Render Pipeline/Spine/Blend Modes/Skeleton Additive/SHADOWCASTER" + UsePass "Universal Render Pipeline/Spine/Skeleton/SHADOWCASTER" } - CustomEditor "SpineShaderWithOutlineGUI" } diff --git a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/BlendModes/Spine-Skeleton-Screen-URP.shader b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/BlendModes/Spine-Skeleton-Screen-URP.shader index 667bd6064..2e200e3c6 100644 --- a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/BlendModes/Spine-Skeleton-Screen-URP.shader +++ b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/BlendModes/Spine-Skeleton-Screen-URP.shader @@ -4,6 +4,8 @@ [NoScaleOffset] _MainTex ("MainTex", 2D) = "black" {} [Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0 _Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1 + [MaterialToggle(_TINT_BLACK_ON)] _TintBlack("Tint Black", Float) = 0 + _Black(" Dark Color", Color) = (0,0,0,0) [HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0 [HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default } @@ -15,7 +17,6 @@ Fog { Mode Off } Cull Off ZWrite Off - Blend One OneMinusSrcColor Lighting Off Stencil { @@ -27,10 +28,28 @@ Pass { Name "Forward" Tags{"LightMode" = "UniversalForward"} + + Blend One OneMinusSrcColor + HLSLPROGRAM + // Required to compile gles 2.0 with standard srp library + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + + // ------------------------------------- + // Unity defined keywords + #pragma multi_compile_fog + + //-------------------------------------- + // GPU Instancing + #pragma multi_compile_instancing + + //-------------------------------------- + // Spine related keywords + #pragma shader_feature _ _STRAIGHT_ALPHA_INPUT + #pragma shader_feature _TINT_BLACK_ON #pragma vertex vert #pragma fragment frag - #pragma shader_feature _ _STRAIGHT_ALPHA_INPUT #undef LIGHTMAP_ON @@ -38,12 +57,12 @@ #define fixed4 half4 #define fixed3 half3 #define fixed half - #include "../Include/Spine-Input-BlendModes-URP.hlsl" - #include "../Include/Spine-BlendModes-NormalPass-URP.hlsl" + #define APPLY_MATERIAL_TINT_COLOR + #include "../Include/Spine-Input-URP.hlsl" + #include "../Include/Spine-Skeleton-ForwardPass-URP.hlsl" ENDHLSL - } + } - UsePass "Universal Render Pipeline/Spine/Blend Modes/Skeleton Additive/SHADOWCASTER" + UsePass "Universal Render Pipeline/Spine/Skeleton/SHADOWCASTER" } - CustomEditor "SpineShaderWithOutlineGUI" } diff --git a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Include/Spine-BlendModes-NormalPass-URP.hlsl b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Include/Spine-BlendModes-NormalPass-URP.hlsl deleted file mode 100644 index eeffc7166..000000000 --- a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Include/Spine-BlendModes-NormalPass-URP.hlsl +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef BLENDMODES_NORMAL_PASS_URP_INCLUDED -#define BLENDMODES_NORMAL_PASS_URP_INCLUDED - -#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" -#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl" -#include "SpineCoreShaders/Spine-Common.cginc" -#include "SpineCoreShaders/Spine-Skeleton-Tint-Common.cginc" - -struct VertexInput { - float3 pos : POSITION; - float2 uv : TEXCOORD0; - float4 vertexColor : COLOR; -}; - -struct VertexOutput { - float4 pos : SV_POSITION; - float2 uv : TEXCOORD0; - float4 vertexColor : COLOR; -}; - -VertexOutput vert(VertexInput v) { - VertexOutput o; - float3 positionWS = TransformObjectToWorld(v.pos); - o.pos = TransformWorldToHClip(positionWS); - o.uv = v.uv; - o.vertexColor = PMAGammaToTargetSpace(v.vertexColor) * float4(_Color.rgb * _Color.a, _Color.a); // Combine a PMA version of _Color with vertexColor. - return o; -} - -float4 frag(VertexOutput i) : SV_Target{ - float4 texColor = tex2D(_MainTex, i.uv); - - #if defined(_STRAIGHT_ALPHA_INPUT) - texColor.rgb *= texColor.a; - #endif - - return (texColor * i.vertexColor); -} - -#endif diff --git a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Include/Spine-BlendModes-NormalPass-URP.hlsl.meta b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Include/Spine-BlendModes-NormalPass-URP.hlsl.meta deleted file mode 100644 index 13c7872cf..000000000 --- a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Include/Spine-BlendModes-NormalPass-URP.hlsl.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: 444419be824cb1d4482a06b558b0892a -ShaderImporter: - externalObjects: {} - defaultTextures: [] - nonModifiableTextures: [] - preprocessorOverride: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Include/Spine-Input-BlendModes-URP.hlsl b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Include/Spine-Input-BlendModes-URP.hlsl deleted file mode 100644 index 5cf781a1f..000000000 --- a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Include/Spine-Input-BlendModes-URP.hlsl +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef URP_INPUT_BLEND_MODES_INCLUDED -#define URP_INPUT_BLEND_MODES_INCLUDED - -#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" - -//////////////////////////////////////// -// Defines -// -#undef LIGHTMAP_ON - -CBUFFER_START(UnityPerMaterial) - -float4 _MainTex_ST; -half _Cutoff; -half4 _Color; - -CBUFFER_END - -sampler2D _MainTex; - -#endif diff --git a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Include/Spine-Input-BlendModes-URP.hlsl.meta b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Include/Spine-Input-BlendModes-URP.hlsl.meta deleted file mode 100644 index c697bd74f..000000000 --- a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Include/Spine-Input-BlendModes-URP.hlsl.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: 7fbcfe81149b96e458243062a65e31b4 -ShaderImporter: - externalObjects: {} - defaultTextures: [] - nonModifiableTextures: [] - preprocessorOverride: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Include/Spine-Skeleton-ForwardPass-URP.hlsl b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Include/Spine-Skeleton-ForwardPass-URP.hlsl index 03fee1caf..afd16546c 100644 --- a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Include/Spine-Skeleton-ForwardPass-URP.hlsl +++ b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Include/Spine-Skeleton-ForwardPass-URP.hlsl @@ -41,6 +41,8 @@ VertexOutput vert(appdata v) { o.color *= _Color; o.darkColor = GammaToTargetSpace( half3(v.tintBlackRG.r, v.tintBlackRG.g, v.tintBlackB.r)) + _Black.rgb; +#elif defined (APPLY_MATERIAL_TINT_COLOR) + o.color *= _Color; #endif return o; } diff --git a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/package.json b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/package.json index 0ea608d4b..9df1313b7 100644 --- a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/package.json +++ b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/package.json @@ -2,7 +2,7 @@ "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.1.\n(See http://esotericsoftware.com/git/spine-runtimes/spine-unity)", - "version": "4.1.25", + "version": "4.1.26", "unity": "2019.3", "author": { "name": "Esoteric Software",