mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +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.albedo = main.rgb;
|
||||||
surfaceData.alpha = 1;
|
surfaceData.alpha = 1;
|
||||||
surfaceData.mask = mask;
|
surfaceData.mask = mask;
|
||||||
inputData.uv = input.texcoord;
|
inputData.uv = input.texcoord.xy;
|
||||||
inputData.lightingUV = input.lightingUV;
|
inputData.lightingUV = input.lightingUV;
|
||||||
half4 pixel = half4(CombinedShapeLightShared(surfaceData, inputData).rgb * main.a, main.a);
|
half4 pixel = half4(CombinedShapeLightShared(surfaceData, inputData).rgb * main.a, main.a);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -65,7 +65,7 @@ half3 LightweightLightVertexSimplified(float3 positionWS, half3 normalWS, out ha
|
|||||||
additionalLightColor += ProcessLight(positionWS, normalWS, meshRenderingLayers, lightIndex);
|
additionalLightColor += ProcessLight(positionWS, normalWS, meshRenderingLayers, lightIndex);
|
||||||
}
|
}
|
||||||
#else // !USE_FORWARD_PLUS
|
#else // !USE_FORWARD_PLUS
|
||||||
int pixelLightCount = GetAdditionalLightsCount();
|
uint pixelLightCount = GetAdditionalLightsCount();
|
||||||
LIGHT_LOOP_BEGIN_SPINE(pixelLightCount)
|
LIGHT_LOOP_BEGIN_SPINE(pixelLightCount)
|
||||||
additionalLightColor += ProcessLight(positionWS, normalWS, meshRenderingLayers, lightIndex);
|
additionalLightColor += ProcessLight(positionWS, normalWS, meshRenderingLayers, lightIndex);
|
||||||
LIGHT_LOOP_END_SPINE
|
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 inputData; // LIGHT_LOOP_BEGIN macro requires InputData struct in USE_FORWARD_PLUS branch
|
||||||
inputData.positionWS = positionWS;
|
inputData.positionWS = positionWS;
|
||||||
inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(positionCS);
|
inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(positionCS);
|
||||||
|
|
||||||
uint meshRenderingLayers = GetMeshRenderingLayerBackwardsCompatible();
|
uint meshRenderingLayers = GetMeshRenderingLayerBackwardsCompatible();
|
||||||
int pixelLightCount = GetAdditionalLightsCount();
|
uint pixelLightCount = GetAdditionalLightsCount();
|
||||||
LIGHT_LOOP_BEGIN_SPINE(pixelLightCount)
|
LIGHT_LOOP_BEGIN_SPINE(pixelLightCount)
|
||||||
additionalLightColor += ProcessLight(positionWS, normalWS, meshRenderingLayers, lightIndex);
|
additionalLightColor += ProcessLight(positionWS, normalWS, meshRenderingLayers, lightIndex);
|
||||||
LIGHT_LOOP_END_SPINE
|
LIGHT_LOOP_END_SPINE
|
||||||
@ -124,7 +124,7 @@ VertexOutput vert(appdata v) {
|
|||||||
if (color.a == 0) {
|
if (color.a == 0) {
|
||||||
o.color = color;
|
o.color = color;
|
||||||
#if defined(SKELETONLIT_RECEIVE_SHADOWS)
|
#if defined(SKELETONLIT_RECEIVE_SHADOWS)
|
||||||
o.shadowedColor = color;
|
o.shadowedColor = color.rgb;
|
||||||
o.shadowCoord = float4(0, 0, 0, 0);
|
o.shadowCoord = float4(0, 0, 0, 0);
|
||||||
#endif
|
#endif
|
||||||
return o;
|
return o;
|
||||||
@ -169,9 +169,11 @@ half4 frag(VertexOutput i
|
|||||||
// USE_FORWARD_PLUS lights need to be processed in fragment shader,
|
// USE_FORWARD_PLUS lights need to be processed in fragment shader,
|
||||||
// otherwise light culling by vertex will create a very bad lighting result.
|
// otherwise light culling by vertex will create a very bad lighting result.
|
||||||
half3 shadowedColor;
|
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;
|
i.shadowedColor += shadowedColor;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(SKELETONLIT_RECEIVE_SHADOWS)
|
#if defined(SKELETONLIT_RECEIVE_SHADOWS)
|
||||||
half shadowAttenuation = MainLightRealtimeShadow(i.shadowCoord);
|
half shadowAttenuation = MainLightRealtimeShadow(i.shadowCoord);
|
||||||
|
|||||||
@ -131,7 +131,7 @@ half4 LightweightFragmentPBRSimplified(InputData inputData, half4 texAlbedoAlpha
|
|||||||
|
|
||||||
#ifdef _ADDITIONAL_LIGHTS
|
#ifdef _ADDITIONAL_LIGHTS
|
||||||
uint meshRenderingLayers = GetMeshRenderingLayerBackwardsCompatible();
|
uint meshRenderingLayers = GetMeshRenderingLayerBackwardsCompatible();
|
||||||
|
|
||||||
#if defined(_ADDITIONAL_LIGHT_SHADOWS) && !defined(_RECEIVE_SHADOWS_OFF)
|
#if defined(_ADDITIONAL_LIGHT_SHADOWS) && !defined(_RECEIVE_SHADOWS_OFF)
|
||||||
half4 shadowMask = CalculateShadowMaskBackwardsCompatible(inputData);
|
half4 shadowMask = CalculateShadowMaskBackwardsCompatible(inputData);
|
||||||
#else
|
#else
|
||||||
@ -145,7 +145,7 @@ half4 LightweightFragmentPBRSimplified(InputData inputData, half4 texAlbedoAlpha
|
|||||||
finalColor += ProcessLightPBRSimplified(inputData, brdfData, shadowMask, meshRenderingLayers, lightIndex);
|
finalColor += ProcessLightPBRSimplified(inputData, brdfData, shadowMask, meshRenderingLayers, lightIndex);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
int pixelLightCount = GetAdditionalLightsCount();
|
uint pixelLightCount = GetAdditionalLightsCount();
|
||||||
LIGHT_LOOP_BEGIN_SPINE(pixelLightCount)
|
LIGHT_LOOP_BEGIN_SPINE(pixelLightCount)
|
||||||
finalColor += ProcessLightPBRSimplified(inputData, brdfData, shadowMask, meshRenderingLayers, lightIndex);
|
finalColor += ProcessLightPBRSimplified(inputData, brdfData, shadowMask, meshRenderingLayers, lightIndex);
|
||||||
LIGHT_LOOP_END_SPINE
|
LIGHT_LOOP_END_SPINE
|
||||||
@ -221,11 +221,11 @@ half4 LightweightFragmentBlinnPhongSimplified(InputData inputData, half4 texDiff
|
|||||||
diffuseLighting += ProcessLightLambert(inputData, shadowMask, meshRenderingLayers, lightIndex);
|
diffuseLighting += ProcessLightLambert(inputData, shadowMask, meshRenderingLayers, lightIndex);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
int pixelLightCount = GetAdditionalLightsCount();
|
uint pixelLightCount = GetAdditionalLightsCount();
|
||||||
LIGHT_LOOP_BEGIN(pixelLightCount)
|
LIGHT_LOOP_BEGIN(pixelLightCount)
|
||||||
diffuseLighting += ProcessLightLambert(inputData, shadowMask, meshRenderingLayers, lightIndex);
|
diffuseLighting += ProcessLightLambert(inputData, shadowMask, meshRenderingLayers, lightIndex);
|
||||||
LIGHT_LOOP_END
|
LIGHT_LOOP_END
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef _ADDITIONAL_LIGHTS_VERTEX
|
#ifdef _ADDITIONAL_LIGHTS_VERTEX
|
||||||
diffuseLighting += inputData.vertexLighting;
|
diffuseLighting += inputData.vertexLighting;
|
||||||
@ -329,7 +329,7 @@ half4 ForwardPassFragmentSprite(VertexOutputLWRP input
|
|||||||
#else
|
#else
|
||||||
inputData.normalizedScreenSpaceUV = 0;
|
inputData.normalizedScreenSpaceUV = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SPECULAR)
|
#if defined(SPECULAR)
|
||||||
half2 metallicGloss = getMetallicGloss(input.texcoord.xy);
|
half2 metallicGloss = getMetallicGloss(input.texcoord.xy);
|
||||||
half metallic = metallicGloss.x;
|
half metallic = metallicGloss.x;
|
||||||
|
|||||||
@ -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.8",
|
"version": "4.1.9",
|
||||||
"unity": "2019.3",
|
"unity": "2019.3",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Esoteric Software",
|
"name": "Esoteric Software",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user