Shader 透明效果+纹理融合Code

Shader "ShaderCustom/ShaderStructs" {

    Properties{
        _MainColor("MainColor",color) = (1,1,1,1)
        _AmbientColor("AmbientColor",color)=(0.3,0.3,0.3,0.3)
        _Specular("Specular",color) = (1,1,1,1)
        _Shininess("Shininess",range(0,1)) = 1
        _Emission("Emission",color) = (1,1,1,1)
        _SetTexture("texture2d",2d) = ""
        _SetSecondTexture("setSecondTexture",2d) = ""
//        _TextureRet("texture rect",rect) = "whitle"{}
    }

    //fixed shader
    SubShader{
        pass{
            color[_MainColor]

            blend SrcAlpha OneMinusSrcAlpha  //Shader lab  blend   
            Tags { "Queue" = "Transparent" }

            //设置环境光等。。。。
            material
            {
                diffuse[_MainColor]  //漫反射光
                ambient[_AmbientColor] //环境光
                specular[_Specular]        //高光  镜面反射
                shininess[_Shininess]    //高光的范围
                emission[_Emission]        //自发光的颜色
            }

            lighting on            //使用 diffuse ambient  必须要开始lighting
            separatespecular on //  使用specular  必须开始

            settexture[_SetTexture] //设置材质
            {    
                //设置纹理合并  combine  
                combine texture * primary  double
            }
            settexture[_SetSecondTexture]
            {
                //设置纹理合并
                combine texture * primary  double
            }

        }
    }
    FallBack "diffuse"
}


你可能感兴趣的:(shader)