mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-07 03:06:55 +08:00
[unity] Fixed Universal Render Pipeline/2D/Spine/Sprite normals being incorrect in transparent areas. Closes #1588.
This commit is contained in:
parent
a297e7f7c5
commit
3a255abe1f
@ -170,46 +170,50 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
Pass
|
Pass
|
||||||
{
|
{
|
||||||
Name "Unlit"
|
Name "Unlit"
|
||||||
Tags { "LightMode" = "UniversalForward" "Queue"="Transparent" "RenderType"="Transparent"}
|
Tags { "LightMode" = "UniversalForward" "Queue"="Transparent" "RenderType"="Transparent"}
|
||||||
|
|
||||||
HLSLPROGRAM
|
ZWrite Off
|
||||||
#pragma prefer_hlslcc gles
|
Cull Off
|
||||||
#pragma vertex UnlitVertex
|
Blend One OneMinusSrcAlpha
|
||||||
#pragma fragment UnlitFragment
|
|
||||||
|
|
||||||
struct Attributes
|
HLSLPROGRAM
|
||||||
{
|
#pragma prefer_hlslcc gles
|
||||||
float3 positionOS : POSITION;
|
#pragma vertex UnlitVertex
|
||||||
float4 color : COLOR;
|
#pragma fragment UnlitFragment
|
||||||
float2 uv : TEXCOORD0;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Varyings
|
struct Attributes
|
||||||
{
|
{
|
||||||
float4 positionCS : SV_POSITION;
|
float3 positionOS : POSITION;
|
||||||
float4 color : COLOR;
|
float4 color : COLOR;
|
||||||
float2 uv : TEXCOORD0;
|
float2 uv : TEXCOORD0;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEXTURE2D(_MainTex);
|
struct Varyings
|
||||||
SAMPLER(sampler_MainTex);
|
{
|
||||||
float4 _MainTex_ST;
|
float4 positionCS : SV_POSITION;
|
||||||
|
float4 color : COLOR;
|
||||||
|
float2 uv : TEXCOORD0;
|
||||||
|
};
|
||||||
|
|
||||||
Varyings UnlitVertex(Attributes attributes)
|
TEXTURE2D(_MainTex);
|
||||||
{
|
SAMPLER(sampler_MainTex);
|
||||||
Varyings o = (Varyings)0;
|
float4 _MainTex_ST;
|
||||||
|
|
||||||
o.positionCS = TransformObjectToHClip(attributes.positionOS);
|
Varyings UnlitVertex(Attributes attributes)
|
||||||
o.uv = TRANSFORM_TEX(attributes.uv, _MainTex);
|
{
|
||||||
o.uv = attributes.uv;
|
Varyings o = (Varyings)0;
|
||||||
o.color = attributes.color;
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
|
|
||||||
float4 UnlitFragment(Varyings i) : SV_Target
|
o.positionCS = TransformObjectToHClip(attributes.positionOS);
|
||||||
{
|
o.uv = TRANSFORM_TEX(attributes.uv, _MainTex);
|
||||||
|
o.uv = attributes.uv;
|
||||||
|
o.color = attributes.color;
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
float4 UnlitFragment(Varyings i) : SV_Target
|
||||||
|
{
|
||||||
half4 tex = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv);
|
half4 tex = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv);
|
||||||
half4 main;
|
half4 main;
|
||||||
#if defined(_STRAIGHT_ALPHA_INPUT)
|
#if defined(_STRAIGHT_ALPHA_INPUT)
|
||||||
@ -219,10 +223,10 @@
|
|||||||
#endif
|
#endif
|
||||||
main.a = tex.a * i.color.a;
|
main.a = tex.a * i.color.a;
|
||||||
|
|
||||||
return main;
|
return main;
|
||||||
}
|
}
|
||||||
ENDHLSL
|
ENDHLSL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FallBack "Universal Render Pipeline/2D/Sprite-Lit-Default"
|
FallBack "Universal Render Pipeline/2D/Sprite-Lit-Default"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -111,12 +111,15 @@ Shader "Universal Render Pipeline/2D/Spine/Sprite"
|
|||||||
}
|
}
|
||||||
|
|
||||||
Pass
|
Pass
|
||||||
{
|
{
|
||||||
Tags { "LightMode" = "NormalsRendering"}
|
Tags { "LightMode" = "NormalsRendering"}
|
||||||
HLSLPROGRAM
|
|
||||||
#pragma prefer_hlslcc gles
|
Blend SrcAlpha OneMinusSrcAlpha
|
||||||
#pragma vertex NormalsRenderingVertex
|
|
||||||
#pragma fragment NormalsRenderingFragment
|
HLSLPROGRAM
|
||||||
|
#pragma prefer_hlslcc gles
|
||||||
|
#pragma vertex NormalsRenderingVertex
|
||||||
|
#pragma fragment NormalsRenderingFragment
|
||||||
|
|
||||||
// -------------------------------------
|
// -------------------------------------
|
||||||
// Material Keywords
|
// Material Keywords
|
||||||
@ -138,8 +141,8 @@ Shader "Universal Render Pipeline/2D/Spine/Sprite"
|
|||||||
|
|
||||||
#include "Include/Spine-Sprite-NormalsPass-URP-2D.hlsl"
|
#include "Include/Spine-Sprite-NormalsPass-URP-2D.hlsl"
|
||||||
|
|
||||||
ENDHLSL
|
ENDHLSL
|
||||||
}
|
}
|
||||||
|
|
||||||
UsePass "Universal Render Pipeline/2D/Spine/Skeleton Lit/UNLIT"
|
UsePass "Universal Render Pipeline/2D/Spine/Skeleton Lit/UNLIT"
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user