diff --git a/CHANGELOG.md b/CHANGELOG.md index 5649cd239..d3d695cea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -167,7 +167,8 @@ - URP Shaders: Added `ZWrite` variant of outline shader `Universal Render Pipeline/Spine/Outline/Skeleton-OutlineOnly ZWrite`. Suitable for e.g. depth of field (DoF) effect where writing to the depth buffer is required. Note that for DoF effect, `Render Queue` needs to be set to `Alpha Test`. - SkeletonGraphic: Exposed `SetScaledPivotOffset` as public method outside of the editor to support programatically moving mesh offsets at runtime based on mesh bounds. - SkeletonMecanim: Added `Scene Preview` option to preview an Animation Clip for e.g. easier event placement. When enabled, the Animation Clip selected in the Animation window is previewed in the Scene and Game views. Lock the `SkeletonMecanim` Inspector window, open the Animation window and select the Animation Clip. Then in the Animation window scrub through the timeline to see the current animation frame previewed. - - `Universal Render Pipeline/Spine/Skeleton Lit` shader now supports [Adaptive Probe Volumes (APV)](https://docs.unity3d.com/6000.0/Documentation/Manual/urp/probevolumes-concept.html) introduced in Unity 6. The shader also provides a new material property `APV per Pixel` to either calculate APV lighting contribution per pixel (the default) or per vertex. + - `Universal Render Pipeline/Spine/Skeleton Lit` shader now supports [Adaptive Probe Volumes (APV)](https://docs.unity3d.com/6000.0/Documentation/Manual/urp/probevolumes-concept.html) introduced in Unity 6. The shader also provides a new material property `APV per Pixel` to either calculate APV lighting contribution per pixel (the default) or per vertex. + - `Universal Render Pipeline/Spine/Sprite` shader now also supports [Adaptive Probe Volumes (APV)](https://docs.unity3d.com/6000.0/Documentation/Manual/urp/probevolumes-concept.html) introduced in Unity 6. APV lighting contribution is automatically calculated per pixel. - **Breaking changes** 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 aa2cc4bd5..6b39d5a91 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 @@ -18,6 +18,10 @@ #define NEEDS_POSITION_WS #endif +#if !defined(DYNAMICLIGHTMAP_ON) && !defined(LIGHTMAP_ON) && (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) +#define USE_ADAPTIVE_PROBE_VOLUMES +#endif + //////////////////////////////////////// // Vertex output struct // @@ -48,6 +52,9 @@ struct VertexOutputLWRP #if defined(_TINT_BLACK_ON) float3 darkColor : TEXCOORD9; #endif +#if defined(USE_ADAPTIVE_PROBE_VOLUMES) + float3 positionCS : TEXCOORD10; +#endif UNITY_VERTEX_OUTPUT_STEREO }; @@ -324,6 +331,9 @@ VertexOutputLWRP ForwardPassVertexSprite(VertexInput input) #endif #else OUTPUT_SH(normalWS.xyz, output.vertexSH); +#endif +#if defined(USE_ADAPTIVE_PROBE_VOLUMES) + output.positionCS = output.pos; #endif return output; } @@ -370,7 +380,20 @@ half4 ForwardPassFragmentSprite(VertexOutputLWRP input #endif inputData.normalWS = normalWS; +#if defined(USE_ADAPTIVE_PROBE_VOLUMES) + half4 shadowMask = 1.0; + float4 ignoredProbeOcclusion; + inputData.bakedGI = SAMPLE_GI(input.vertexSH, + GetAbsolutePositionWS(input.positionWS), + inputData.normalWS.xyz, + GetWorldSpaceNormalizeViewDir(input.positionWS), + input.positionCS.xy, + ignoredProbeOcclusion, + shadowMask); +#else // USE_ADAPTIVE_PROBE_VOLUMES inputData.bakedGI = SAMPLE_GI(input.lightmapUV, input.vertexSH, inputData.normalWS); +#endif + #if defined(_RIM_LIGHTING) || defined(_ADDITIONAL_LIGHTS) || defined(USE_LIGHT_COOKIES) inputData.positionWS = input.positionWS.rgb; #endif 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 3add9894f..5325ea419 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 @@ -121,6 +121,7 @@ Shader "Universal Render Pipeline/Spine/Sprite" // Unity defined keywords #pragma multi_compile _ DIRLIGHTMAP_COMBINED #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 //-------------------------------------- // GPU Instancing 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 0b480222d..e11e59022 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.2.\n(See http://esotericsoftware.com/git/spine-runtimes/spine-unity)", - "version": "4.2.40", + "version": "4.2.41", "unity": "2019.3", "author": { "name": "Esoteric Software",