mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-10 17:18:44 +08:00
[unity] Fixed URP Sprite shader treating skeleton alpha incorrectly. Closes #1735.
This commit is contained in:
parent
bb34e33aee
commit
11006baa65
@ -75,7 +75,7 @@ half4 LightweightFragmentPBRSimplified(InputData inputData, half4 texAlbedoAlpha
|
||||
half4 albedo = texAlbedoAlpha * vertexColor;
|
||||
|
||||
BRDFData brdfData;
|
||||
half ignoredAlpha = 1; // ignore alpha, otherwise
|
||||
half ignoredAlpha = 1; // ignore alpha, otherwise
|
||||
InitializeBRDFData(albedo.rgb, metallic, specular, smoothness, ignoredAlpha, brdfData);
|
||||
brdfData.specular *= albedo.a;
|
||||
|
||||
@ -105,7 +105,7 @@ half4 LightweightFragmentPBRSimplified(InputData inputData, half4 texAlbedoAlpha
|
||||
finalColor += inputData.vertexLighting * brdfData.diffuse;
|
||||
#endif
|
||||
finalColor += emission;
|
||||
return prepareLitPixelForOutput(half4(finalColor, texAlbedoAlpha.a), vertexColor);
|
||||
return prepareLitPixelForOutput(half4(finalColor, albedo.a), vertexColor);
|
||||
}
|
||||
|
||||
#else // !SPECULAR
|
||||
@ -148,7 +148,7 @@ half4 LightweightFragmentBlinnPhongSimplified(InputData inputData, half4 texDiff
|
||||
diffuseLighting += emission;
|
||||
//half3 finalColor = diffuseLighting * diffuse + emission;
|
||||
half3 finalColor = diffuseLighting * diffuse.rgb;
|
||||
return prepareLitPixelForOutput(half4(finalColor, texDiffuseAlpha.a), vertexColor);
|
||||
return prepareLitPixelForOutput(half4(finalColor, diffuse.a), vertexColor);
|
||||
}
|
||||
#endif // SPECULAR
|
||||
|
||||
@ -168,7 +168,7 @@ VertexOutputLWRP ForwardPassVertexSprite(VertexInput input)
|
||||
float backFaceSign = 1;
|
||||
#if defined(FIXED_NORMALS_BACKFACE_RENDERING)
|
||||
backFaceSign = calculateBackfacingSign(positionWS.xyz);
|
||||
#endif
|
||||
#endif
|
||||
output.viewDirectionWS = GetCameraPositionWS() - positionWS;
|
||||
|
||||
#if defined(PER_PIXEL_LIGHTING)
|
||||
@ -219,7 +219,7 @@ half4 ForwardPassFragmentSprite(VertexOutputLWRP input) : SV_Target
|
||||
#if defined(_MAIN_LIGHT_SHADOWS) && !defined(_RECEIVE_SHADOWS_OFF)
|
||||
inputData.shadowCoord = input.shadowCoord;
|
||||
#endif
|
||||
|
||||
|
||||
inputData.viewDirectionWS = input.viewDirectionWS;
|
||||
inputData.vertexLighting = input.fogFactorAndVertexLight.yzw;
|
||||
|
||||
@ -239,7 +239,7 @@ half4 ForwardPassFragmentSprite(VertexOutputLWRP input) : SV_Target
|
||||
#if defined(_RIM_LIGHTING) || defined(_ADDITIONAL_LIGHTS)
|
||||
inputData.positionWS = input.positionWS.rgb;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(SPECULAR)
|
||||
half2 metallicGloss = getMetallicGloss(input.texcoord.xy);
|
||||
half metallic = metallicGloss.x;
|
||||
|
||||
@ -75,7 +75,7 @@ half4 LightweightFragmentPBRSimplified(InputData inputData, half4 texAlbedoAlpha
|
||||
half4 albedo = texAlbedoAlpha * vertexColor;
|
||||
|
||||
BRDFData brdfData;
|
||||
half ignoredAlpha = 1; // ignore alpha, otherwise
|
||||
half ignoredAlpha = 1; // ignore alpha, otherwise
|
||||
InitializeBRDFData(albedo.rgb, metallic, specular, smoothness, ignoredAlpha, brdfData);
|
||||
brdfData.specular *= albedo.a;
|
||||
|
||||
@ -105,7 +105,7 @@ half4 LightweightFragmentPBRSimplified(InputData inputData, half4 texAlbedoAlpha
|
||||
finalColor += inputData.vertexLighting * brdfData.diffuse;
|
||||
#endif
|
||||
finalColor += emission;
|
||||
return prepareLitPixelForOutput(half4(finalColor, texAlbedoAlpha.a), vertexColor);
|
||||
return prepareLitPixelForOutput(half4(finalColor, albedo.a), vertexColor);
|
||||
}
|
||||
|
||||
#else // !SPECULAR
|
||||
@ -148,7 +148,7 @@ half4 LightweightFragmentBlinnPhongSimplified(InputData inputData, half4 texDiff
|
||||
diffuseLighting += emission;
|
||||
//half3 finalColor = diffuseLighting * diffuse + emission;
|
||||
half3 finalColor = diffuseLighting * diffuse.rgb;
|
||||
return prepareLitPixelForOutput(half4(finalColor, texDiffuseAlpha.a), vertexColor);
|
||||
return prepareLitPixelForOutput(half4(finalColor, diffuse.a), vertexColor);
|
||||
}
|
||||
#endif // SPECULAR
|
||||
|
||||
@ -168,7 +168,7 @@ VertexOutputLWRP ForwardPassVertexSprite(VertexInput input)
|
||||
float backFaceSign = 1;
|
||||
#if defined(FIXED_NORMALS_BACKFACE_RENDERING)
|
||||
backFaceSign = calculateBackfacingSign(positionWS.xyz);
|
||||
#endif
|
||||
#endif
|
||||
output.viewDirectionWS = GetCameraPositionWS() - positionWS;
|
||||
|
||||
#if defined(PER_PIXEL_LIGHTING)
|
||||
@ -219,7 +219,7 @@ half4 ForwardPassFragmentSprite(VertexOutputLWRP input) : SV_Target
|
||||
#if defined(_MAIN_LIGHT_SHADOWS) && !defined(_RECEIVE_SHADOWS_OFF)
|
||||
inputData.shadowCoord = input.shadowCoord;
|
||||
#endif
|
||||
|
||||
|
||||
inputData.viewDirectionWS = input.viewDirectionWS;
|
||||
inputData.vertexLighting = input.fogFactorAndVertexLight.yzw;
|
||||
|
||||
@ -239,7 +239,7 @@ half4 ForwardPassFragmentSprite(VertexOutputLWRP input) : SV_Target
|
||||
#if defined(_RIM_LIGHTING) || defined(_ADDITIONAL_LIGHTS)
|
||||
inputData.positionWS = input.positionWS.rgb;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(SPECULAR)
|
||||
half2 metallicGloss = getMetallicGloss(input.texcoord.xy);
|
||||
half metallic = metallicGloss.x;
|
||||
@ -261,6 +261,7 @@ half4 ForwardPassFragmentSprite(VertexOutputLWRP input) : SV_Target
|
||||
|
||||
COLORISE(pixel)
|
||||
APPLY_FOG_LWRP(pixel, input.fogFactorAndVertexLight.x)
|
||||
|
||||
return pixel;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user