Fixed function shader

固定管线shader

 

  • properties:参数
  • material:材质
  • lighting:灯光
  • settexture:纹理
  • pass 
  • combine: 混合
  • blend: 也是混合
  • constantColor:alpha系数
  • tags:队列
Shader "Unlit/NewUnlitShader"
{  properties{
    _Color("Color",color) = (1,0,0,1)
    _Ambient("Ambient",color) = (0.3,0.3,0.3,0.5)
    _Specular("Specular",color) = (1,1,1,1)
    _Shininess("Shininess",range(0,4)) = 2 // 浮点数 0-4
    _Emission("Emission",color) = (1,0,0,1)
    _ConstantColor("ConstantColor",color) = (1,1,1,0.3)
    _MainTex("MainTex",2d) = "white"{}
    _SecondTex("SecondTex",2d) = ""{}
    }

   SubShader{
        Tags { "Queue" = "Transparent" }
        //Tags {"Queue" = "Transparent"} // 改变渲染顺序队列
        pass{
            Blend SrcAlpha OneMinusSrcAlpha  // 混合原和已经渲染好的Alpha层
            // color(1,0,0,1) // ()代表默认值
            // color[_Color] // []代表参数值
            material{
                diffuse[_Color] // 漫反射
                ambient[_Ambient]  //  环境光
                specular[_Specular] // 镜面反射
                shininess[_Shininess]  //  高光反射区域,越高反光越集中
                emission[_Emission]  //  自发光
                }
                
                lighting on // 要有光才有颜色
                separatespecular on  // 单独处理镜面光

                settexture[_MainTex]{
                    combine texture * primary double // 贴图 *  primary: 计算顶点光照 double x2 quad x4 
                }
                settexture[_SecondTex]{
                    constantColor[ConstantColor]
                    combine texture * previous double, texture * constant //  previous: 之前所有计算的参数 , 第二参数为alpha通道
                } // 混合的纹理数量受硬件限制
        }
   } 
}

“您的支持是我持续分享的动力”

微信收款码
微信
支付宝收款码
支付宝

采唐
采唐的狐言狐语🦊
公告

欢迎欢迎!这是采唐的新博客页!
最新评论

加载中...