From 2ca3b6462b0622588ca2b69746841cd838b4a9ff Mon Sep 17 00:00:00 2001 From: Luke Ingram Date: Wed, 12 Jan 2022 13:39:26 -0400 Subject: [PATCH 1/4] [ts] Fixed development setup documentation --- spine-ts/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spine-ts/README.md b/spine-ts/README.md index 332eda3d4..8a6285437 100644 --- a/spine-ts/README.md +++ b/spine-ts/README.md @@ -7,7 +7,7 @@ up into multiple modules: 1. `spine-webgl/`, a self-contained WebGL backend, built on the core classes. 1. `spine-canvas/`, a self-contained Canvas backend, built on the core classes. 1. `spine-threejs/`, a self-contained THREE.JS backend, built on the core classes. -1. `spine-player/`, a self-contained player to easily display Spine animations on your website, built on core the classes and WebGL backend. +1. `spine-player/`, a self-contained player to easily display Spine animations on your website, built on the core classes and WebGL backend. In most cases, the `spine-player` module is best suited for your needs. Please refer to the [Spine Web Player documentation](https://esotericsoftware.com/spine-player) for more information. @@ -104,6 +104,7 @@ spine-ts is developed with TypeScript, we thus recommend the following developme 3. Open a terminal and execute ``` git clone https://github.com/esotericsoftware/spine-runtimes +cd spine-runtimes/spine-ts npm install npm run dev ``` From 0407bd830200476e57d6994a31619e9f50573081 Mon Sep 17 00:00:00 2001 From: Matt Roelle Date: Sat, 15 Jan 2022 07:20:06 -0800 Subject: [PATCH 2/4] Fix bad string concat in error messages in spine lua runtime. (#2021) --- spine-lua/spine-lua/AnimationState.lua | 2 +- spine-lua/spine-lua/SkeletonJson.lua | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spine-lua/spine-lua/AnimationState.lua b/spine-lua/spine-lua/AnimationState.lua index 555d1a040..7af750547 100644 --- a/spine-lua/spine-lua/AnimationState.lua +++ b/spine-lua/spine-lua/AnimationState.lua @@ -750,7 +750,7 @@ end function AnimationState:addAnimationByName (trackIndex, animationName, loop, delay) local animation = self.data.skeletonData:findAnimation(animationName) - if not animation then error("Animation not found: " + animationName, 2) end + if not animation then error("Animation not found: " .. animationName, 2) end return self:addAnimation(trackIndex, animation, loop, delay) end diff --git a/spine-lua/spine-lua/SkeletonJson.lua b/spine-lua/spine-lua/SkeletonJson.lua index 3ea740093..88b02e655 100644 --- a/spine-lua/spine-lua/SkeletonJson.lua +++ b/spine-lua/spine-lua/SkeletonJson.lua @@ -317,7 +317,7 @@ function SkeletonJson.new (attachmentLoader) if linkedMesh.skin then skin = skeletonData:findSkin(linkedMesh.skin) end if not skin then error("Skin not found: " .. linkedMesh.skin) end local parent = skin:getAttachment(linkedMesh.slotIndex, linkedMesh.parent) - if not parent then error("Parent mesh not found: " + linkedMesh.parent) end + if not parent then error("Parent mesh not found: " .. linkedMesh.parent) end if linkedMesh.inheritDeform then linkedMesh.mesh.deformAttachment = parent else @@ -486,7 +486,7 @@ function SkeletonJson.new (attachmentLoader) local _end = getValue(map, "end", nil) if _end then local slot = skeletonData:findSlot(_end) - if not slot then error("Clipping end slot not found: " + _end) end + if not slot then error("Clipping end slot not found: " .. _end) end clip.endSlot = slot end From 8a30203ab943b837a28d1edad76dcb4e87e9d959 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Tue, 18 Jan 2022 18:59:52 +0100 Subject: [PATCH 3/4] [unity] Fixed incorrect normal orientation for lighting in URP 2D shaders. Closes #2023. Fixed compile error of `URP/2D/Spine/Sprite` shader on Unity 2021.2. Closes #2022. --- .../Include/Spine-Sprite-NormalsPass-URP-2D.hlsl | 13 ++++++------- .../Include/Spine-Sprite-StandardPass-URP-2D.hlsl | 11 +++++++++++ .../Shaders/2D/Spine-SkeletonLit-URP-2D.shader | 14 ++++++-------- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/Include/Spine-Sprite-NormalsPass-URP-2D.hlsl b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/Include/Spine-Sprite-NormalsPass-URP-2D.hlsl index 0bdd83882..150a75d76 100644 --- a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/Include/Spine-Sprite-NormalsPass-URP-2D.hlsl +++ b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/Include/Spine-Sprite-NormalsPass-URP-2D.hlsl @@ -51,16 +51,15 @@ half4 NormalsRenderingFragment(Varyings i) : SV_Target half4 mainTex = i.color * tex2D(_MainTex, i.uv); #if defined(_NORMALMAP) - half3 normalWS = calculateNormalFromBumpMap(i.uv.xy, i.tangentWS.xyz, i.bitangentWS.xyz, i.normalWS.xyz); + half3 normalTS = normalize(UnpackScaleNormal(tex2D(_BumpMap, i.uv.xy), _BumpScale)); + return NormalsRenderingShared(mainTex, normalTS, i.tangentWS.xyz, i.bitangentWS.xyz, i.normalWS.xyz); #else + half3 normalTS = half3(0, 0, 1); + half3 tangentWS = half3(0, 0, 0); + half3 bitangentWS = half3(0, 0, 0); half3 normalWS = i.normalWS.xyz; + return NormalsRenderingShared(mainTex, normalTS, tangentWS, bitangentWS, normalWS); #endif - - half3 normalVS = TransformWorldToViewDir(normalWS); - float4 normalColor; - normalColor.rgb = 0.5 * ((normalVS) + 1); - normalColor.a = mainTex.a; - return normalColor; } #endif diff --git a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/Include/Spine-Sprite-StandardPass-URP-2D.hlsl b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/Include/Spine-Sprite-StandardPass-URP-2D.hlsl index c30493218..9556108c5 100644 --- a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/Include/Spine-Sprite-StandardPass-URP-2D.hlsl +++ b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/Include/Spine-Sprite-StandardPass-URP-2D.hlsl @@ -92,7 +92,18 @@ half4 CombinedShapeLightFragment(VertexOutputSpriteURP2D input) : SV_Target half4 main = texureColor * input.vertexColor; half4 mask = SAMPLE_TEXTURE2D(_MaskTex, sampler_MaskTex, input.texcoord.xy); +#if UNITY_VERSION < 202120 half4 pixel = half4(CombinedShapeLightShared(half4(main.rgb, 1), mask, input.lightingUV).rgb, main.a); +#else + SurfaceData2D surfaceData; + InputData2D inputData; + surfaceData.albedo = main.rgb; + surfaceData.alpha = 1; + surfaceData.mask = mask; + inputData.uv = input.texcoord; + inputData.lightingUV = input.lightingUV; + half4 pixel = half4(CombinedShapeLightShared(surfaceData, inputData).rgb, main.a); +#endif #if defined(_RIM_LIGHTING) #if defined(_NORMALMAP) diff --git a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/Spine-SkeletonLit-URP-2D.shader b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/Spine-SkeletonLit-URP-2D.shader index bb2dd7f28..77d99f1d7 100644 --- a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/Spine-SkeletonLit-URP-2D.shader +++ b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/Spine-SkeletonLit-URP-2D.shader @@ -153,7 +153,7 @@ float4 positionCS : SV_POSITION; float4 color : COLOR; float2 uv : TEXCOORD0; - float3 normalVS : TEXCOORD1; + float3 normalWS : TEXCOORD1; }; TEXTURE2D(_MainTex); @@ -166,8 +166,7 @@ o.positionCS = TransformObjectToHClip(attributes.positionOS); o.uv = attributes.uv; o.color = attributes.color; - float3 normalWS = TransformObjectToWorldDir(float3(0, 0, -1)); - o.normalVS = TransformWorldToViewDir(normalWS); + o.normalWS = TransformObjectToWorldDir(float3(0, 0, -1)); return o; } @@ -176,11 +175,10 @@ float4 NormalsRenderingFragment(Varyings i) : SV_Target { float4 mainTex = i.color * SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv); - - float4 normalColor; - normalColor.rgb = 0.5 * ((i.normalVS)+1); - normalColor.a = mainTex.a; - return normalColor; + half3 normalTS = half3(0, 0, 1); + half3 tangentWS = half3(0, 0, 0); + half3 bitangentWS = half3(0, 0, 0); + return NormalsRenderingShared(mainTex, normalTS, tangentWS, bitangentWS, i.normalWS); } ENDHLSL } From 9e54dc4faaae70529e9de84cb3c3fc6ae534d499 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Tue, 18 Jan 2022 19:06:47 +0100 Subject: [PATCH 4/4] [unity] Increased version number of Spine URP Shaders UPM package in package.json. --- .../Modules/com.esotericsoftware.spine.urp-shaders/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 2fe826886..ae33b43fa 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.0.\n(See http://esotericsoftware.com/git/spine-runtimes/spine-unity)", - "version": "4.0.5", + "version": "4.0.6", "unity": "2019.3", "author": { "name": "Esoteric Software",