Project_WL/Assets/WL/Island/Shaders/WLSpriteOverlay.shader

61 lines
2.7 KiB
Plaintext
Raw Normal View History

// WLSpriteOverlay.shader — 가격판 스프라이트용 언릿 · 알파 블렌드 셰이더(깊이 검사 · 바닥 밀착)
// 2026-09-17 PD 「가격판이 풀·오브젝트에 가려지지 않게 상단에 보이게」 → 같은 날 「가격 판이 캐릭터를 가리지 않게 · 바닥에 붙은 느낌」.
// 확장 가격판(FI Purchaser 의 Frame/Coin 스프라이트)·우리 발판에 런타임 복사본 재질로 물린다.
// SpriteRenderer 가 _MainTex 에 스프라이트 텍스처를 넣어 주고 정점색을 곱한다. 모바일: 텍스처 1장 · 조명 없음.
Shader "WL/SpriteOverlay"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
}
SubShader
{
Tags { "Queue"="Transparent+100" "RenderType"="Transparent" "IgnoreProjector"="True" "PreviewType"="Plane" "CanUseSpriteAtlas"="True" }
Cull Off
Lighting Off
ZWrite Off
// 2026-09-17 PD 「가격판은 캐릭터보다 아래」 — 깊이 검사(캐릭터·소품이 앞이면 가린다). 판은 지형 표본 위 5 cm 에 놓이므로 깊이 당김은
// 버퍼 단위 2 만(기울기 계수 1 은 비스듬한 바닥 면에서 크게 당겨져 코인이 캐릭터 발 위로 올라왔다 · 실측).
// 풀에 가려지는 문제는 지형 쪽에서 판 자리에 모래를 깔아(풀 없음) 해결한다(WLDemoTerrain 판 자리 모래).
ZTest LEqual
Offset 0, -2
Blend SrcAlpha OneMinusSrcAlpha
Pass
{
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
TEXTURE2D(_MainTex); SAMPLER(sampler_MainTex);
CBUFFER_START(UnityPerMaterial)
float4 _MainTex_ST;
half4 _Color;
CBUFFER_END
struct Attributes { float4 positionOS : POSITION; float2 uv : TEXCOORD0; half4 color : COLOR; };
struct Varyings { float4 positionHCS : SV_POSITION; float2 uv : TEXCOORD0; half4 color : COLOR; };
Varyings vert(Attributes v)
{
Varyings o;
o.positionHCS = TransformObjectToHClip(v.positionOS.xyz);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
o.color = v.color * _Color;
return o;
}
half4 frag(Varyings i) : SV_Target
{
half4 c = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv) * i.color;
c.rgb *= c.a;
return half4(c.rgb / max(c.a, 1e-4), c.a);
}
ENDHLSL
}
}
Fallback Off
}