Преглед на файлове

Merge branch '4.0' into 4.1-beta

Harald Csaszar преди 3 години
родител
ревизия
ca9274b86d

+ 2 - 1
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-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-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-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.
 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
 3. Open a terminal and execute
 ```
 ```
 git clone https://github.com/esotericsoftware/spine-runtimes
 git clone https://github.com/esotericsoftware/spine-runtimes
+cd spine-runtimes/spine-ts
 npm install
 npm install
 npm run dev
 npm run dev
 ```
 ```

+ 6 - 7
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);
 	half4 mainTex = i.color * tex2D(_MainTex, i.uv);
 
 
 #if defined(_NORMALMAP)
 #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
 #else
+	half3 normalTS = half3(0, 0, 1);
+	half3 tangentWS = half3(0, 0, 0);
+	half3 bitangentWS = half3(0, 0, 0);
 	half3 normalWS = i.normalWS.xyz;
 	half3 normalWS = i.normalWS.xyz;
+	return NormalsRenderingShared(mainTex, normalTS, tangentWS, bitangentWS, normalWS);
 #endif
 #endif
-
-	half3 normalVS = TransformWorldToViewDir(normalWS);
-	float4 normalColor;
-	normalColor.rgb = 0.5 * ((normalVS) + 1);
-	normalColor.a = mainTex.a;
-	return normalColor;
 }
 }
 
 
 #endif
 #endif

+ 11 - 0
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 main = texureColor * input.vertexColor;
 
 
 	half4 mask = SAMPLE_TEXTURE2D(_MaskTex, sampler_MaskTex, input.texcoord.xy);
 	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);
 	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(_RIM_LIGHTING)
 	#if defined(_NORMALMAP)
 	#if defined(_NORMALMAP)

+ 6 - 8
spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/Spine-SkeletonLit-URP-2D.shader

@@ -153,7 +153,7 @@
 				float4  positionCS		: SV_POSITION;
 				float4  positionCS		: SV_POSITION;
 				float4  color			: COLOR;
 				float4  color			: COLOR;
 				float2	uv				: TEXCOORD0;
 				float2	uv				: TEXCOORD0;
-				float3  normalVS		: TEXCOORD1;
+				float3  normalWS		: TEXCOORD1;
 			};
 			};
 
 
 			TEXTURE2D(_MainTex);
 			TEXTURE2D(_MainTex);
@@ -166,8 +166,7 @@
 				o.positionCS = TransformObjectToHClip(attributes.positionOS);
 				o.positionCS = TransformObjectToHClip(attributes.positionOS);
 				o.uv = attributes.uv;
 				o.uv = attributes.uv;
 				o.color = attributes.color;
 				o.color = attributes.color;
-				float3 normalWS = TransformObjectToWorldDir(float3(0, 0, -1));
-				o.normalVS = TransformWorldToViewDir(normalWS);
+				o.normalWS = TransformObjectToWorldDir(float3(0, 0, -1));
 				return o;
 				return o;
 			}
 			}
 
 
@@ -176,11 +175,10 @@
 			float4 NormalsRenderingFragment(Varyings i) : SV_Target
 			float4 NormalsRenderingFragment(Varyings i) : SV_Target
 			{
 			{
 				float4 mainTex = i.color * SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv);
 				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
 			ENDHLSL
 		}
 		}

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