[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).

This commit is contained in:
Harald Csaszar 2019-11-19 17:10:35 +01:00
parent 41cfd38049
commit fa712fc325
6 changed files with 8 additions and 6 deletions

View File

@ -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;

View File

@ -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

View File

@ -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
}

View File

@ -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
}

View File

@ -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

View File

@ -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