Shader "Custom/UV_TimeShader"
{
Properties
{
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_FlowSpeed("FlowSpeed", float) = 1
}
SubShader
{
Tags { "RenderType"="Opaque" }
CGPROGRAM
#pragma surface surf Standard
sampler2D _MainTex;
float _FlowSpeed;
struct Input
{
float2 uv_MainTex;
};
void surf (Input IN, inout SurfaceOutputStandard o)
{
fixed4 c = tex2D (_MainTex, float2(IN.uv_MainTex.x, IN.uv_MainTex.y + _Time.y * _FlowSpeed));
o.Albedo = (c.r + c.g + c.b) / 3;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}
y 방향으로 흘러가게
fixed4 c = tex2D (_MainTex, float2(IN.uv_MainTex.x, IN.uv_MainTex.y + _Time.y * _FlowSpeed));
x 방향으로 흘러가게
fixed4 c = tex2D (_MainTex, float2(IN.uv_MainTex.x + _Time.y * _FlowSpeed, IN.uv_MainTex.y));
'Unity > Shader' 카테고리의 다른 글
4. lerp (선형보간) 사용해서 텍스처 2장 섞기 (0) | 2020.11.01 |
---|---|
3. 이미지를 흑백으로 만들기 (0) | 2020.10.31 |
2. 기초적인 서피스 셰이더 제작 (0) | 2020.10.31 |
1. 렌더링 파이프라인 (렌더링 순서) (0) | 2020.10.31 |