mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 07:14:55 +08:00
[unity] Fixed a shader branch compile error with Unity 2022.2 URP Forward+ renderer when shadow receiving is disabled. See #2173.
This commit is contained in:
parent
b80b57b380
commit
55c2bd9ed4
@ -101,7 +101,7 @@ half4 CombinedShapeLightFragment(VertexOutputSpriteURP2D input) : SV_Target
|
||||
surfaceData.albedo = main.rgb;
|
||||
surfaceData.alpha = 1;
|
||||
surfaceData.mask = mask;
|
||||
inputData.uv = input.texcoord;
|
||||
inputData.uv = input.texcoord.xy;
|
||||
inputData.lightingUV = input.lightingUV;
|
||||
half4 pixel = half4(CombinedShapeLightShared(surfaceData, inputData).rgb * main.a, main.a);
|
||||
#endif
|
||||
|
||||
@ -65,7 +65,7 @@ half3 LightweightLightVertexSimplified(float3 positionWS, half3 normalWS, out ha
|
||||
additionalLightColor += ProcessLight(positionWS, normalWS, meshRenderingLayers, lightIndex);
|
||||
}
|
||||
#else // !USE_FORWARD_PLUS
|
||||
int pixelLightCount = GetAdditionalLightsCount();
|
||||
uint pixelLightCount = GetAdditionalLightsCount();
|
||||
LIGHT_LOOP_BEGIN_SPINE(pixelLightCount)
|
||||
additionalLightColor += ProcessLight(positionWS, normalWS, meshRenderingLayers, lightIndex);
|
||||
LIGHT_LOOP_END_SPINE
|
||||
@ -84,9 +84,9 @@ half3 LightweightLightFragmentSimplified(float3 positionWS, float2 positionCS, h
|
||||
InputData inputData; // LIGHT_LOOP_BEGIN macro requires InputData struct in USE_FORWARD_PLUS branch
|
||||
inputData.positionWS = positionWS;
|
||||
inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(positionCS);
|
||||
|
||||
|
||||
uint meshRenderingLayers = GetMeshRenderingLayerBackwardsCompatible();
|
||||
int pixelLightCount = GetAdditionalLightsCount();
|
||||
uint pixelLightCount = GetAdditionalLightsCount();
|
||||
LIGHT_LOOP_BEGIN_SPINE(pixelLightCount)
|
||||
additionalLightColor += ProcessLight(positionWS, normalWS, meshRenderingLayers, lightIndex);
|
||||
LIGHT_LOOP_END_SPINE
|
||||
@ -124,7 +124,7 @@ VertexOutput vert(appdata v) {
|
||||
if (color.a == 0) {
|
||||
o.color = color;
|
||||
#if defined(SKELETONLIT_RECEIVE_SHADOWS)
|
||||
o.shadowedColor = color;
|
||||
o.shadowedColor = color.rgb;
|
||||
o.shadowCoord = float4(0, 0, 0, 0);
|
||||
#endif
|
||||
return o;
|
||||
@ -169,9 +169,11 @@ half4 frag(VertexOutput i
|
||||
// USE_FORWARD_PLUS lights need to be processed in fragment shader,
|
||||
// otherwise light culling by vertex will create a very bad lighting result.
|
||||
half3 shadowedColor;
|
||||
i.color.rgb += LightweightLightFragmentSimplified(i.positionWS, i.pos, i.normalWS, shadowedColor);
|
||||
i.color.rgb += LightweightLightFragmentSimplified(i.positionWS, i.pos.xy, i.normalWS, shadowedColor);
|
||||
#if defined(SKELETONLIT_RECEIVE_SHADOWS)
|
||||
i.shadowedColor += shadowedColor;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(SKELETONLIT_RECEIVE_SHADOWS)
|
||||
half shadowAttenuation = MainLightRealtimeShadow(i.shadowCoord);
|
||||
|
||||
@ -131,7 +131,7 @@ half4 LightweightFragmentPBRSimplified(InputData inputData, half4 texAlbedoAlpha
|
||||
|
||||
#ifdef _ADDITIONAL_LIGHTS
|
||||
uint meshRenderingLayers = GetMeshRenderingLayerBackwardsCompatible();
|
||||
|
||||
|
||||
#if defined(_ADDITIONAL_LIGHT_SHADOWS) && !defined(_RECEIVE_SHADOWS_OFF)
|
||||
half4 shadowMask = CalculateShadowMaskBackwardsCompatible(inputData);
|
||||
#else
|
||||
@ -145,7 +145,7 @@ half4 LightweightFragmentPBRSimplified(InputData inputData, half4 texAlbedoAlpha
|
||||
finalColor += ProcessLightPBRSimplified(inputData, brdfData, shadowMask, meshRenderingLayers, lightIndex);
|
||||
}
|
||||
#endif
|
||||
int pixelLightCount = GetAdditionalLightsCount();
|
||||
uint pixelLightCount = GetAdditionalLightsCount();
|
||||
LIGHT_LOOP_BEGIN_SPINE(pixelLightCount)
|
||||
finalColor += ProcessLightPBRSimplified(inputData, brdfData, shadowMask, meshRenderingLayers, lightIndex);
|
||||
LIGHT_LOOP_END_SPINE
|
||||
@ -221,11 +221,11 @@ half4 LightweightFragmentBlinnPhongSimplified(InputData inputData, half4 texDiff
|
||||
diffuseLighting += ProcessLightLambert(inputData, shadowMask, meshRenderingLayers, lightIndex);
|
||||
}
|
||||
#endif
|
||||
int pixelLightCount = GetAdditionalLightsCount();
|
||||
uint pixelLightCount = GetAdditionalLightsCount();
|
||||
LIGHT_LOOP_BEGIN(pixelLightCount)
|
||||
diffuseLighting += ProcessLightLambert(inputData, shadowMask, meshRenderingLayers, lightIndex);
|
||||
LIGHT_LOOP_END
|
||||
|
||||
|
||||
#endif
|
||||
#ifdef _ADDITIONAL_LIGHTS_VERTEX
|
||||
diffuseLighting += inputData.vertexLighting;
|
||||
@ -329,7 +329,7 @@ half4 ForwardPassFragmentSprite(VertexOutputLWRP input
|
||||
#else
|
||||
inputData.normalizedScreenSpaceUV = 0;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(SPECULAR)
|
||||
half2 metallicGloss = getMetallicGloss(input.texcoord.xy);
|
||||
half metallic = metallicGloss.x;
|
||||
|
||||
@ -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.8",
|
||||
"version": "4.1.9",
|
||||
"unity": "2019.3",
|
||||
"author": {
|
||||
"name": "Esoteric Software",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user