
Properties
{
_MainTex("Texture", 2D) = "white" {}
_XCount("Texture Count", Range(1, 10)) = 1
_Speed("Speed", Range(0.1, 10)) = 1
}
SubShader
{
Tags { "RenderType" = "Transparent" "Queue" = "Transparent" }
LOD 200
cull off
CGPROGRAM
#pragma surface surf Lambert noambient alpha:fade
#pragma target 3.0
sampler2D _MainTex;
float _Speed;
int _XCount;
int _WaitCount;
struct Input
{
float2 uv_MainTex;
};
void surf(Input IN, inout SurfaceOutput o)
{
float tile = floor(fmod(_Time.y * _Speed, _XCount);
float uvX = (IN.uv_MainTex + tile) / _XCount;
fixed4 c = tex2D(_MainTex, float2(uvX, IN.uv_MainTex.y));
o.Emission = c.rgb;
o.Alpha = c.a;
}
ENDCG
}
마지막 프레임 기다리기

최대 타일수를 _WaitCount 만큼 늘려주고
원래 타일 수를 초과하면 출력가능한만큼 줄여준다.

'유니티 > 쉐이더' 카테고리의 다른 글
| [Unity Shader] Custom PostProcessing(포스트 프로세싱) 직접 만들기 (노이즈 필터) (0) | 2022.06.10 |
|---|---|
| [Unity Shader] 비눗방울 쉐이더 만들기 (0) | 2022.03.25 |
| [Unity Shader] 외곽선 만들기 : Pass 추가, Vertex Shader, zwrite (8) | 2022.02.15 |
| [Unity Shader] 커스텀 라이트 : Lambert, Half - Lambert (0) | 2022.02.08 |
| [Unity Shader] 쉐이더 코드 설명 : Properties, SurfaceOutputstandard (0) | 2022.02.08 |