스토리지

[5.3] UV _Time 본문

Unity/Shader

[5.3] UV _Time

ljw4104 2021. 5. 3. 16:40

Time을 이용하여 애니메이션을 제작할 수 있다.

 

Shader "Custom/Test"
{
    Properties
    {
        _MainTex ("Albedo (RGB)", 2D) = "white" {}
        _V ("V Value", Range(-1,1)) = 0 
        _U ("U Value", Range(-1,1)) = 0
        _UV ("UV Value", Range(-1,1)) = 0
    }
    SubShader
    {
        Tags { "RenderType"="Opaque" }
        LOD 200

        CGPROGRAM
        // Physically based Standard lighting model, and enable shadows on all light types
        #pragma surface surf Standard fullforwardshadows

        sampler2D _MainTex;
        float _V;
        float _U;
        float _UV;

        struct Input
        {
            float2 uv_MainTex;
        };

        void surf (Input IN, inout SurfaceOutputStandard o)
        {
            // Albedo comes from a texture tinted by color
            //fixed4 c = tex2D (_MainTex, float2(IN.uv_MainTex.x, IN.uv_MainTex.y - _Time.y));
            fixed4 c = tex2D(_MainTex, IN.uv_MainTex + _Time.y);
            o.Emission = c.rgb;
        }
        ENDCG
    }
    FallBack "Diffuse"
}

'Unity > Shader' 카테고리의 다른 글

[5.4] Shader 복습 1  (0) 2021.05.04
[5.3] 불 이펙트 만들기  (0) 2021.05.03
[5.3] UV  (0) 2021.05.03
[5.3] Shader 연습 1  (0) 2021.05.03
[5.3] Shader, Texture 받아오기  (0) 2021.05.03
Comments