瀏覽代碼

[unity] Fixed `Spine/Skeleton Lit` shader not being affected by point lights. Closes #1550. Also fixed outline 4 vs 8 neighbourhood parameter being ignored (due to #pragma multi_compile / #pragma shader_feature not being evaluated in included cginc files, too late in preprocessor stage).

Harald Csaszar 5 年之前
父節點
當前提交
0006cd8b3c

+ 4 - 5
spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/CGIncludes/Spine-Skeleton-Lit-Common.cginc

@@ -12,19 +12,18 @@
 #define LIGHT_LOOP_LIMIT unity_VertexLightParams.x
 #endif
 
-#pragma multi_compile __ POINT SPOT
 
 ////////////////////////////////////////
 // Alpha Clipping
 //
 
-#if defined(_ALPHA_CLIP) 
+#if defined(_ALPHA_CLIP)
 	uniform fixed _Cutoff;
 	#define ALPHA_CLIP(pixel, color) clip((pixel.a * color.a) - _Cutoff);
 #else
 	#define ALPHA_CLIP(pixel, color)
-#endif	
-			
+#endif
+
 half3 computeLighting (int idx, half3 dirToLight, half3 eyeNormal, half4 diffuseColor, half atten) {
 	half NdotL = max(dot(eyeNormal, dirToLight), 0.0);
 	// diffuse
@@ -111,7 +110,7 @@ fixed4 frag (VertexOutput i) : SV_Target {
 	#else
 	col.rgb = tex * i.color;
 	#endif
-				
+
 	col *= 2;
 	col.a = tex.a * i.color.a;
 	return col;

+ 0 - 1
spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/CGIncludes/Spine-Outline-Pass.cginc

@@ -1,7 +1,6 @@
 #ifndef SPINE_OUTLINE_PASS_INCLUDED
 #define SPINE_OUTLINE_PASS_INCLUDED
 
-#pragma shader_feature _ _USE8NEIGHBOURHOOD_ON
 #include "UnityCG.cginc"
 
 #ifdef SKELETON_GRAPHIC

+ 1 - 0
spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/SkeletonGraphic/Spine-SkeletonGraphic-Outline.shader

@@ -62,6 +62,7 @@ Shader "Spine/Outline/SkeletonGraphic"
 			#pragma vertex vertOutlineGraphic
 			#pragma fragment fragOutline
 			#define SKELETON_GRAPHIC
+			#pragma shader_feature _ _USE8NEIGHBOURHOOD_ON
 			#include "../CGIncludes/Spine-Outline-Pass.cginc"
 			ENDCG
 		}

+ 1 - 0
spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Outline/Spine-Skeleton-Outline.shader

@@ -38,6 +38,7 @@ Shader "Spine/Outline/Skeleton" {
 			CGPROGRAM
 			#pragma vertex vertOutline
 			#pragma fragment fragOutline
+			#pragma shader_feature _ _USE8NEIGHBOURHOOD_ON
 			#include "CGIncludes/Spine-Outline-Pass.cginc"
 			ENDCG
 		}

+ 1 - 0
spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-Skeleton-Lit-ZWrite.shader

@@ -47,6 +47,7 @@ Shader "Spine/Skeleton Lit ZWrite" {
 			#pragma target 2.0
 
 			#define _ALPHA_CLIP
+			#pragma multi_compile __ POINT SPOT
 			#include "CGIncludes/Spine-Skeleton-Lit-Common.cginc"
 			ENDCG
 

+ 1 - 0
spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-Skeleton-Lit.shader

@@ -45,6 +45,7 @@ Shader "Spine/Skeleton Lit" {
 			#pragma fragment frag
 			#pragma target 2.0
 
+			#pragma multi_compile __ POINT SPOT
 			#include "CGIncludes/Spine-Skeleton-Lit-Common.cginc"
 			ENDCG