mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[unity] Fixed URP Sprite shader ignoring Fixed normal in some settings. Closes #1967. Fixed a warning.
This commit is contained in:
parent
5937b3021b
commit
43e8000c80
@ -104,7 +104,7 @@ half4 CombinedShapeLightFragment(VertexOutputSpriteURP2D input) : SV_Target
|
|||||||
pixel.rgb = applyRimLighting(input.positionWS.xyz, normalWS, pixel);
|
pixel.rgb = applyRimLighting(input.positionWS.xyz, normalWS, pixel);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
APPLY_EMISSION(pixel.rgb, input.texcoord)
|
APPLY_EMISSION(pixel.rgb, input.texcoord.xy)
|
||||||
pixel = prepareLitPixelForOutput(pixel, texureColor.a, input.vertexColor.a);
|
pixel = prepareLitPixelForOutput(pixel, texureColor.a, input.vertexColor.a);
|
||||||
COLORISE(pixel)
|
COLORISE(pixel)
|
||||||
return pixel;
|
return pixel;
|
||||||
|
|||||||
@ -127,7 +127,7 @@ half4 LightweightFragmentBlinnPhongSimplified(InputData inputData, half4 texDiff
|
|||||||
#endif
|
#endif
|
||||||
half3 diffuseLighting = inputData.bakedGI;
|
half3 diffuseLighting = inputData.bakedGI;
|
||||||
|
|
||||||
half3 attenuation = mainLight.distanceAttenuation * mainLight.shadowAttenuation;
|
half3 attenuation = mainLight.distanceAttenuation* mainLight.shadowAttenuation;
|
||||||
half3 attenuatedLightColor = mainLight.color * attenuation;
|
half3 attenuatedLightColor = mainLight.color * attenuation;
|
||||||
#ifndef _DIFFUSE_RAMP
|
#ifndef _DIFFUSE_RAMP
|
||||||
diffuseLighting += LightingLambert(attenuatedLightColor, mainLight.direction, inputData.normalWS);
|
diffuseLighting += LightingLambert(attenuatedLightColor, mainLight.direction, inputData.normalWS);
|
||||||
@ -184,24 +184,15 @@ VertexOutputLWRP ForwardPassVertexSprite(VertexInput input)
|
|||||||
output.positionWS = float4(positionWS, 1);
|
output.positionWS = float4(positionWS, 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PER_PIXEL_LIGHTING)
|
|
||||||
|
|
||||||
half3 normalWS = calculateSpriteWorldNormal(input, -backFaceSign);
|
half3 normalWS = calculateSpriteWorldNormal(input, -backFaceSign);
|
||||||
output.normalWorld.xyz = normalWS;
|
output.normalWorld.xyz = normalWS;
|
||||||
|
|
||||||
#if defined(_NORMALMAP)
|
#if defined(_NORMALMAP)
|
||||||
output.tangentWorld.xyz = calculateWorldTangent(input.tangent);
|
output.tangentWorld.xyz = calculateWorldTangent(input.tangent);
|
||||||
output.binormalWorld.xyz = calculateSpriteWorldBinormal(input, output.normalWorld.xyz, output.tangentWorld.xyz, backFaceSign);
|
output.binormalWorld.xyz = calculateSpriteWorldBinormal(input, output.normalWorld.xyz, output.tangentWorld.xyz, backFaceSign);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else // !PER_PIXEL_LIGHTING
|
|
||||||
half3 fixedNormal = half3(0, 0, -1);
|
|
||||||
half3 normalWS = normalize(mul((float3x3)unity_ObjectToWorld, fixedNormal));
|
|
||||||
|
|
||||||
#endif // !PER_PIXEL_LIGHTING
|
|
||||||
output.fogFactorAndVertexLight.yzw = LightweightLightVertexSimplified(positionWS, normalWS);
|
output.fogFactorAndVertexLight.yzw = LightweightLightVertexSimplified(positionWS, normalWS);
|
||||||
|
|
||||||
|
|
||||||
#if (defined(_MAIN_LIGHT_SHADOWS) || defined(MAIN_LIGHT_CALCULATE_SHADOWS)) && !defined(_RECEIVE_SHADOWS_OFF)
|
#if (defined(_MAIN_LIGHT_SHADOWS) || defined(MAIN_LIGHT_CALCULATE_SHADOWS)) && !defined(_RECEIVE_SHADOWS_OFF)
|
||||||
VertexPositionInputs vertexInput;
|
VertexPositionInputs vertexInput;
|
||||||
vertexInput.positionWS = positionWS;
|
vertexInput.positionWS = positionWS;
|
||||||
@ -243,16 +234,11 @@ half4 ForwardPassFragmentSprite(VertexOutputLWRP input) : SV_Target
|
|||||||
inputData.viewDirectionWS = input.viewDirectionWS;
|
inputData.viewDirectionWS = input.viewDirectionWS;
|
||||||
inputData.vertexLighting = input.fogFactorAndVertexLight.yzw;
|
inputData.vertexLighting = input.fogFactorAndVertexLight.yzw;
|
||||||
|
|
||||||
#if defined(PER_PIXEL_LIGHTING)
|
#if defined(PER_PIXEL_LIGHTING) && defined(_NORMALMAP)
|
||||||
#if defined(_NORMALMAP)
|
|
||||||
half3 normalWS = calculateNormalFromBumpMap(input.texcoord.xy, input.tangentWorld.xyz, input.binormalWorld.xyz, input.normalWorld.xyz);
|
half3 normalWS = calculateNormalFromBumpMap(input.texcoord.xy, input.tangentWorld.xyz, input.binormalWorld.xyz, input.normalWorld.xyz);
|
||||||
#else
|
#else
|
||||||
half3 normalWS = input.normalWorld.xyz;
|
half3 normalWS = input.normalWorld.xyz;
|
||||||
#endif
|
#endif
|
||||||
#else // !PER_PIXEL_LIGHTING
|
|
||||||
half3 fixedNormal = half3(0, 0, -1);
|
|
||||||
half3 normalWS = normalize(mul((float3x3)unity_ObjectToWorld, fixedNormal));
|
|
||||||
#endif // !PER_PIXEL_LIGHTING
|
|
||||||
|
|
||||||
inputData.normalWS = normalWS;
|
inputData.normalWS = normalWS;
|
||||||
inputData.bakedGI = SAMPLE_GI(input.lightmapUV, input.vertexSH, inputData.normalWS);
|
inputData.bakedGI = SAMPLE_GI(input.lightmapUV, input.vertexSH, inputData.normalWS);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user