diff --git a/CHANGELOG.md b/CHANGELOG.md index e3f19954d..025eed9e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -99,6 +99,7 @@ * Lit Spine URP shaders (`Universal Render Pipeline/Spine/Sprite` and `Universal Render Pipeline/Spine/Skeleton Lit`) now support `Forward+` rendering path as introduced by Unity 2022.2 and URP version 14. * `SkeletonGraphic` now supports automatic scaling based on its `RectTransform` bounds. Automatic scaling can be enabled by setting the added `Layout Scale Mode` Inspector property to either `Width Controls Height`, `Height Controls Width`, `FitInParent` or `EnvelopeParent`. It is set to `None` by default to keep previous behaviour and avoid breaking existing projects. To modify the reference layout bounds, hit the additional `Edit Layout Bounds` toggle button to switch into edit mode, adjust the bounds or hit `Match RectTransform with Mesh`, and hit the button again when done adjusting. The skeleton will now be scaled accordingly to fit the reference layout bounds to the object's `RectTransform`. * Added previously missing unlit URP 2D shader variant, available under `Universal Render Pipeline/2D/Spine/Skeleton`. + * Added support for light cookies at `Universal Render Pipeline/Spine/Sprite` shader. * **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/Include/Spine-Sprite-ForwardPass-URP.hlsl b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Include/Spine-Sprite-ForwardPass-URP.hlsl index 303fcd1fd..51cfb052a 100644 --- a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Include/Spine-Sprite-ForwardPass-URP.hlsl +++ b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Include/Spine-Sprite-ForwardPass-URP.hlsl @@ -7,7 +7,7 @@ #include "SpineCoreShaders/Spine-Common.cginc" #include "Spine-Common-URP.hlsl" -#if defined(_RIM_LIGHTING) || defined(_ADDITIONAL_LIGHTS) || defined(MAIN_LIGHT_CALCULATE_SHADOWS) +#if defined(_RIM_LIGHTING) || defined(_ADDITIONAL_LIGHTS) || defined(MAIN_LIGHT_CALCULATE_SHADOWS) || defined(_LIGHT_COOKIES) #define NEEDS_POSITION_WS #endif @@ -122,6 +122,10 @@ half4 LightweightFragmentPBRSimplified(InputData inputData, half4 texAlbedoAlpha #else Light mainLight = GetMainLight(); #endif +#if defined(_LIGHT_COOKIES) + half3 cookieColor = SampleMainLightCookie(inputData.positionWS); + mainLight.color *= cookieColor; +#endif half3 finalColor = inputData.bakedGI * albedo.rgb; finalColor += LightingPhysicallyBased(brdfData, mainLight, inputData.normalWS, inputData.viewDirectionWS); @@ -193,6 +197,11 @@ half4 LightweightFragmentBlinnPhongSimplified(InputData inputData, half4 texDiff #else Light mainLight = GetMainLight(); #endif +#if defined(_LIGHT_COOKIES) + half3 cookieColor = SampleMainLightCookie(inputData.positionWS); + mainLight.color *= cookieColor; +#endif + half3 diffuseLighting = inputData.bakedGI; half3 attenuation = mainLight.distanceAttenuation* mainLight.shadowAttenuation; diff --git a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Spine-Sprite-URP.shader b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Spine-Sprite-URP.shader index 7b3aaf319..0daca7265 100644 --- a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Spine-Sprite-URP.shader +++ b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Spine-Sprite-URP.shader @@ -107,6 +107,8 @@ Shader "Universal Render Pipeline/Spine/Sprite" #pragma multi_compile _ _ADDITIONAL_LIGHT_SHADOWS #pragma multi_compile _ _SHADOWS_SOFT #pragma multi_compile _ _MIXED_LIGHTING_SUBTRACTIVE + #pragma multi_compile_fragment _ _LIGHT_COOKIES + // Farward+ renderer keywords #pragma multi_compile_fragment _ _LIGHT_LAYERS #pragma multi_compile _ _FORWARD_PLUS 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 a398dce30..231d68e18 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.11", + "version": "4.1.12", "unity": "2019.3", "author": { "name": "Esoteric Software",