The spine character's Z value is less than that of the transparent object, but it is rendered overlaying it.
Why does it behave like this?
How can the character be rendered behind the transparent object?
Here is the transparent obj shader codes
Shader "Custom/TransparentTex"
{
Properties
{
_MainTex("Base Texture", 2D) = "white" {}
_Color("Color", Color) = (1, 1, 1, 1)
_TexLod("Texure LOD", Float) = 0.0
[Enum(UnityEngine.Rendering.BlendMode)]
_SrcBlend("Source blend Factor", Int) = 1
[Enum(UnityEngine.Rendering.BlendMode)]
_DstBlend("Destination blend Factor", Int) = 1
}
SubShader
{
Tags
{
"RenderType" = "Transparent"
"Queue" = "Transparent"
"RenderPipeline" = "UniversalPipeline"
}
pass
{
Blend [_SrcBlend] [_DstBlend]
ZWrite Off
HLSLPROGRAM
#pragma target 3.0
#pragma vertex vert
#pragma fragment frag
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
sampler2D _MainTex;
CBUFFER_START(UnityPerMaterial)
float4 _Color;
float4 _MainTex_ST;
float _TexLod;
CBUFFER_END
struct appdata
{
float4 positionOS: POSITION;
float2 uv: TEXCOORD0;
};
struct v2f
{
float4 positionCS: SV_POSITION;
float2 uv: TEXCOORD0;
};
v2f vert(appdata inputData)
{
v2f outData;
outData.positionCS = TransformObjectToHClip(inputData.positionOS);
outData.uv = TRANSFORM_TEX(inputData.uv, _MainTex);
return outData;
}
float4 frag(v2f inputData) : SV_TARGET
{
float4 sampleUVs = float4(inputData.uv, 0.0f, _TexLod);
float4 textureSample = tex2Dlod(_MainTex, sampleUVs);
return textureSample * _Color;
}
ENDHLSL
}
}
FallBack "Diffuse"
}