Browse Source

[unity] URP Shaders: Added `Depth Write` property to URP 3D shaders `URP/Spine/Skeleton` and `-/Skeleton Lit`.

Harald Csaszar 2 years ago
parent
commit
b83ee23be8

+ 1 - 0
CHANGELOG.md

@@ -112,6 +112,7 @@
     4) Assign this *_Outline* material at the new child GameObject's `MeshRenderer` component.
     4) Assign this *_Outline* material at the new child GameObject's `MeshRenderer` component.
     If you are using `SkeletonRenderSeparator` and need to enable and disable the `SkeletonRenderSeparator` component at runtime, you can increase the `RenderCombinedMesh` `Reference Renderers` array by one and assign the `SkeletonRenderer` itself at the last entry after the parts renderers. Disabled `MeshRenderer` components will be skipped when combining the final mesh, so the combined mesh is automatically filled from the desired active renderers.
     If you are using `SkeletonRenderSeparator` and need to enable and disable the `SkeletonRenderSeparator` component at runtime, you can increase the `RenderCombinedMesh` `Reference Renderers` array by one and assign the `SkeletonRenderer` itself at the last entry after the parts renderers. Disabled `MeshRenderer` components will be skipped when combining the final mesh, so the combined mesh is automatically filled from the desired active renderers.
   * Timeline extension package: Added static `EditorEvent` callback to allow editor scripts to react to animation events outside of play-mode. Register to the events via `Spine.Unity.Playables.SpineAnimationStateMixerBehaviour.EditorEvent += YourCallback;`.
   * Timeline extension package: Added static `EditorEvent` callback to allow editor scripts to react to animation events outside of play-mode. Register to the events via `Spine.Unity.Playables.SpineAnimationStateMixerBehaviour.EditorEvent += YourCallback;`.
+  * 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.
 
 
 * **Breaking changes**
 * **Breaking changes**
   * Made `SkeletonGraphic.unscaledTime` parameter protected, use the new property `UnscaledTime` instead.
   * Made `SkeletonGraphic.unscaledTime` parameter protected, use the new property `UnscaledTime` instead.

+ 2 - 1
spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Spine-Skeleton-URP.shader

@@ -3,6 +3,7 @@ Shader "Universal Render Pipeline/Spine/Skeleton" {
 		_Cutoff("Shadow alpha cutoff", Range(0,1)) = 0.1
 		_Cutoff("Shadow alpha cutoff", Range(0,1)) = 0.1
 		[NoScaleOffset] _MainTex("Main Texture", 2D) = "black" {}
 		[NoScaleOffset] _MainTex("Main Texture", 2D) = "black" {}
 		[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
 		[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
 		[MaterialToggle(_TINT_BLACK_ON)]  _TintBlack("Tint Black", Float) = 0
 		_Color("    Light Color", Color) = (1,1,1,1)
 		_Color("    Light Color", Color) = (1,1,1,1)
 		_Black("    Dark Color", Color) = (0,0,0,0)
 		_Black("    Dark Color", Color) = (0,0,0,0)
@@ -29,7 +30,7 @@ Shader "Universal Render Pipeline/Spine/Skeleton" {
 			Name "Forward"
 			Name "Forward"
 			Tags{"LightMode" = "UniversalForward"}
 			Tags{"LightMode" = "UniversalForward"}
 
 
-			ZWrite Off
+			ZWrite[_ZWrite]
 			Cull Off
 			Cull Off
 			Blend One OneMinusSrcAlpha
 			Blend One OneMinusSrcAlpha
 
 

+ 4 - 3
spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Spine-SkeletonLit-URP.shader

@@ -1,8 +1,9 @@
-Shader "Universal Render Pipeline/Spine/Skeleton Lit" {
+Shader "Universal Render Pipeline/Spine/Skeleton Lit" {
 	Properties {
 	Properties {
 		_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
 		_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
 		[NoScaleOffset] _MainTex ("Main Texture", 2D) = "black" {}
 		[NoScaleOffset] _MainTex ("Main Texture", 2D) = "black" {}
 		[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
 		[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(_RECEIVE_SHADOWS)] _ReceiveShadows("Receive Shadows", Int) = 0
 		[Toggle(_DOUBLE_SIDED_LIGHTING)] _DoubleSidedLighting("Double-Sided Lighting", Int) = 0
 		[Toggle(_DOUBLE_SIDED_LIGHTING)] _DoubleSidedLighting("Double-Sided Lighting", Int) = 0
 		[MaterialToggle(_LIGHT_AFFECTS_ADDITIVE)] _LightAffectsAdditive("Light Affects Additive", Float) = 0
 		[MaterialToggle(_LIGHT_AFFECTS_ADDITIVE)] _LightAffectsAdditive("Light Affects Additive", Float) = 0
@@ -19,7 +20,7 @@
 		Tags { "RenderPipeline" = "UniversalPipeline" "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
 		Tags { "RenderPipeline" = "UniversalPipeline" "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
 		LOD 100
 		LOD 100
 		Cull Off
 		Cull Off
-		ZWrite Off
+		ZWrite[_ZWrite]
 		Blend One OneMinusSrcAlpha
 		Blend One OneMinusSrcAlpha
 
 
 		Stencil {
 		Stencil {
@@ -32,7 +33,7 @@
 			Name "ForwardLit"
 			Name "ForwardLit"
 			Tags{"LightMode" = "UniversalForward"}
 			Tags{"LightMode" = "UniversalForward"}
 
 
-			ZWrite Off
+			ZWrite[_ZWrite]
 			Cull Off
 			Cull Off
 			Blend One OneMinusSrcAlpha
 			Blend One OneMinusSrcAlpha
 
 

+ 1 - 1
spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/package.json

@@ -2,7 +2,7 @@
   "name": "com.esotericsoftware.spine.urp-shaders",
   "name": "com.esotericsoftware.spine.urp-shaders",
   "displayName": "Spine Universal RP 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)",
   "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.21",
+  "version": "4.1.22",
   "unity": "2019.3",
   "unity": "2019.3",
   "author": {
   "author": {
     "name": "Esoteric Software",
     "name": "Esoteric Software",