顶点动画-VetexAnimation

Shader "QShader/VertexAnimation"{
    
    
    Properties{
    
    
        _MainTex("Main Texture",2D) = "white"{
    
    }
        _XSpeed("X Axis Speed",Float) = 1.0
        _YSpeed("Y Axis Speed",Float) = 1.0
    }
        SubShader{
    
    
            pass {
    
    
                Tags{
    
    "LightMode" = "Always"}
                CGPROGRAM
                #pragma vertex Vertex
                #pragma fragment Fragment
                #include "UnityCG.cginc"

                struct v2f {
    
    
                    float4 pos : SV_POSITION;
                    float2 uv : TEXCOORD0;
                };

                sampler2D _MainTex;
                float _XSpeed;
                float _YSpeed;

                v2f Vertex(appdata_base v) {
    
    

                    v2f o;
                    v.vertex.y += sin(_Time.y + v.vertex.x * _XSpeed + v.vertex.z * _YSpeed);
                    o.pos = UnityObjectToClipPos(v.vertex);
                    o.uv = v.texcoord;

                    return o;
                }

                fixed4 Fragment(v2f i) :SV_TARGET{
    
    

                    return tex2D(_MainTex,i.uv);
                }
                ENDCG
            }
        }

}

猜你喜欢

转载自blog.csdn.net/qq_39691716/article/details/120511131