ย ----์ํ๊ฐ 50%์ดํ------>ย
์ ํ๋ธ ์์๋ณด๋ฉด์ ์ฌ์ฉํ๊ธฐ ์ฝ๊ณ ์ ํํ
๋ง๊ฒ ๋ง๋ค์์ต๋๋ค.
ํด๋น ์์ด๋๋ฅผ ์ด์ฉํ๋ฉด 2d๊ฒ์์์ ์ค๋ฃจ์ฃ์ ํํํ ์๋ ์๊ณ ,
๋
ธ๋์์ผ๋ก ๋ฐ์ง๋ฐ์งํ๊ฒ ํ ์๋์๊ณ , ์ธ๋ฒคํ ๋ฆฌ์๋ ํ์ฉํ ์ ์๊ณ ,
๋ค์ํ๊ฒ ํ์ฉ๊ฐ๋ฅํ ๊ฑฐ๊ฐ์ต๋๋ค.
Solid Color : ์ํ๊ฐ์ด Alpha Limit์์น ์ดํ๋ก ๋ด๋ ค๊ฐ๋ฉด, Solid Color๊ฐ์ผ๋ก ๋ณ๊ฒฝ
Alpha Limit : ํด๋น ๊ฐ ์ดํ๋ก ๋ด๋ ค๊ฐ๋ฉด Solid Color๊ฐ์ผ๋ก ๋ณ๊ฒฝ
์๋๋ ์ค๋ฃจ์ฃ ์ด๋ฏธ์ง๋ ํ์ํด์ ๋ค ์บ๋ฆญํฐ๋ง๋ค ํฌํ ์ต์ผ๋ก ๋จ์์ผ๋ก ๋ง๋ค์ด์
์ด๋ฏธ์งํด๋์ ๋ฃ์ผ๋ ค๊ณ ํ๋๋ฐ, ์์ด๋ ์ฌ์ฉํ๋ฉด ๊ทธ๋ดํ์๊ฐ ์์ ๊ฑฐ ๊ฐ์์
์ด๋ฐ ์์ด๋๊ฐ ์๋์ง ์ฐพ์๋ดค๋๋ฐ ์๋๋ผ๊ณ ์!
์ฝ๋ ์๋ณธ ์์ค ์ถ์ฒ ๋ฐ ๊ฐ์ ์์: https://youtu.be/HFzyCwWUs_4
Shader "Custom/SolidColor"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
[HideInInspector] _Color ("Tint", Color) = (1,1,1,1)
_SolidColor("Solid Color", color) = (1,1,1,1)
_AlphaLimit("Alpha Limit", Range (0.0, 0.99)) = 0.5
[MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
[HideInInspector] _RendererColor ("RendererColor", Color) = (1,1,1,1)
[HideInInspector] _Flip ("Flip", Vector) = (1,1,1,1)
[PerRendererData] _AlphaTex ("External Alpha", 2D) = "white" {}
[PerRendererData] _EnableExternalAlpha ("Enable External Alpha", Float) = 0
}
SubShader
{
Tags
{
"Queue"="Transparent"
"IgnoreProjector"="True"
"RenderType"="Transparent"
"PreviewType"="Plane"
"CanUseSpriteAtlas"="True"
}
Cull Off
Lighting Off
ZWrite Off
Blend One OneMinusSrcAlpha
Pass
{
CGPROGRAM
#pragma vertex SpriteVert
#pragma fragment BlinkSpriteFrag
#pragma target 2.0
#pragma multi_compile_instancing
#pragma multi_compile_local _ PIXELSNAP_ON
#pragma multi_compile _ ETC1_EXTERNAL_ALPHA
#include "UnitySprites.cginc"
fixed4 _SolidColor;
fixed _AlphaLimit;
fixed4 BlinkSpriteFrag(v2f IN) : SV_Target
{
fixed4 texel = SampleSpriteTexture (IN.texcoord);
float showTexel = step(_AlphaLimit, IN.color.a);
IN.color.a = (IN.color.a - _AlphaLimit) / (1.0 - _AlphaLimit);
fixed4 c = texel * IN.color * showTexel + _SolidColor * (1.0 - showTexel) * sign(texel.a);
c.rgb *= c.a;
return c;
}
ENDCG
}
}
}
์์ ์ธ๊ฐ ์ด๋ฏธ์ง ์๋ณด์ด๋๋
์์ ํ์ต๋๋น
๊ทธ๋ผ ์๋ฆฌ๋ ์ปฌ๋ฌ ๋ด๋ ค๋ฉด ์ํ๊ฐ๋ง ๋ฎ์ถ๋ฉด ๋๋๊ฑฐ์? ์ข๋ค
๋น ์ํ๊ฐ Limit์กฐ์ ํด์ ์ด๋์ ๋ ์ํ๊ฐ ๋ด๋ ค๊ฐ์ผ ์๋ฆฌ๋์ปฌ๋ฌ๋ก ๋ฐ๋๋์ง๋ ์ ํ ์ ์์ด์ผ
๊ฟํ์ถ
์ฝ๊ฒ ํ๋๋ฒ์ด ์๋๋ฐ์.
dotween๋ฌด๋ฃ์์ ์ฌ์ฉํ์ ์ ์ฝ๋ํ์ค๋ก ํด๊ฒฐํ์๊ธธ~