Browse Source

[unity] URP Skeleton Lit shader does not apply GI in shadow areas. Closes #2343.

Harald Csaszar 2 years ago
parent
commit
d9d836d5e5

+ 5 - 4
spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Include/Spine-SkeletonLit-ForwardPass-URP.hlsl

@@ -144,9 +144,6 @@ VertexOutput vert(appdata v) {
 #endif // !defined(_LIGHT_AFFECTS_ADDITIVE)
 
 	color.rgb *= LightweightLightVertexSimplified(positionWS, normalWS, shadowedColor);
-#if defined(SKELETONLIT_RECEIVE_SHADOWS)
-	o.shadowedColor = shadowedColor;
-#endif
 
 	// Note: ambient light is also handled via SH.
 	half3 vertexSH;
@@ -155,10 +152,14 @@ VertexOutput vert(appdata v) {
 #else
 	OUTPUT_SH(normalWS.xyz, vertexSH);
 #endif
-	color.rgb += SAMPLE_GI(v.lightmapUV, vertexSH, normalWS);
+	half3 bakedGI = SAMPLE_GI(v.lightmapUV, vertexSH, normalWS);
+	color.rgb += bakedGI;
 	o.color = color;
 
 #if defined(SKELETONLIT_RECEIVE_SHADOWS)
+	shadowedColor += bakedGI;
+	o.shadowedColor = shadowedColor;
+	
 	VertexPositionInputs vertexInput;
 	vertexInput.positionWS = positionWS;
 	vertexInput.positionCS = o.pos;

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