瀏覽代碼

[unity] Added previously missing unlit URP 2D shader variant `Universal Render Pipeline/2D/Spine/Skeleton`.

Harald Csaszar 2 年之前
父節點
當前提交
ae2f1a1dc6

+ 1 - 0
CHANGELOG.md

@@ -98,6 +98,7 @@
   * Added `Spine/SkeletonGraphic Fill` shader to provide functionality of `Spine/Skeleton Fill` shader for `SkeletonGraphic`.
   * 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`.
  
 * **Breaking changes**
   * Made `SkeletonGraphic.unscaledTime` parameter protected, use the new property `UnscaledTime` instead.

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

@@ -0,0 +1,64 @@
+Shader "Universal Render Pipeline/2D/Spine/Skeleton" {
+	Properties {
+		_Cutoff("Shadow alpha cutoff", Range(0,1)) = 0.1
+		[NoScaleOffset] _MainTex("Main Texture", 2D) = "black" {}
+		[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
+		[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
+		[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
+	}
+
+	SubShader {
+		// Universal Pipeline tag is required. If Universal render pipeline is not set in the graphics settings
+		// this Subshader will fail.
+		Tags { "RenderPipeline" = "UniversalPipeline" "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
+		LOD 100
+		Cull Off
+		ZWrite Off
+		Blend One OneMinusSrcAlpha
+
+		Stencil {
+			Ref[_StencilRef]
+			Comp[_StencilComp]
+			Pass Keep
+		}
+
+		Pass {
+			Tags { "LightMode" = "Universal2D" }
+
+			ZWrite Off
+			Cull Off
+			Blend One 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 vertex vert
+			#pragma fragment frag
+
+			#undef LIGHTMAP_ON
+
+			#define USE_URP
+			#define fixed4 half4
+			#define fixed3 half3
+			#define fixed half
+			#include "../Include/Spine-Input-URP.hlsl"
+			#include "../Include/Spine-Skeleton-ForwardPass-URP.hlsl"
+			ENDHLSL
+		}
+	}
+
+	FallBack "Hidden/InternalErrorShader"
+}

+ 9 - 0
spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/Spine-Skeleton-URP-2D.shader.meta

@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 3bb7ed9d223c7d749bc42dad56e4ad0f
+ShaderImporter:
+  externalObjects: {}
+  defaultTextures: []
+  nonModifiableTextures: []
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 1 - 1
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.10",
+  "version": "4.1.11",
   "unity": "2019.3",
   "author": {
     "name": "Esoteric Software",