Unity教程合集Unity Shader分享

Shader:两套uv结合顶点着色

2017-08-24  本文已影响0人  Wwnje
WX20170824-100520@2x.png
Shader "Mobile/doubleUVDiffuse" {
    Properties{
        _MainTex("Base (RGB)", 2D) = "white" {}
    _MainTex2("Base (RGB)", 2D) = "white" {}
    }
        SubShader{
        Tags{ "RenderType" = "Opaque" }
        LOD 150

        CGPROGRAM
#pragma surface surf Lambert vertex:vert

        sampler2D _MainTex;
    sampler2D _MainTex2;

    struct Input {
        float2 uv_MainTex;
        float2 uv2_MainTex2;
        float4 vertColor;
    };

    void vert(inout appdata_full v, out Input o)
    {
        UNITY_INITIALIZE_OUTPUT(Input,o);
        o.vertColor = v.color;
    }

    void surf(Input IN, inout SurfaceOutput o) {
        fixed4 c = tex2D(_MainTex, IN.uv_MainTex);
        fixed4 c2 = tex2D(_MainTex2, IN.uv2_MainTex2);
        o.Albedo = c.rgb* c2.rgb * IN.vertColor.rgb;
        o.Alpha = c.a;
    }
    ENDCG
    }

        Fallback "Mobile/VertexLit"
}
上一篇下一篇

猜你喜欢

热点阅读