zoukankan      html  css  js  c++  java
  • 【原】高光贴图参数放入颜色贴图的alpha通道中

    今天美术想把高光贴图参数合成到Main贴图中,减少贴图数,挺好,知道省内存了。
    于是简单改了改surface着色器。
    Shader "Custom/HighLightByAlphaPass" {
        Properties {
             _MainTex ("Base (RGBA A--HighLight)", 2D) = "white" {}
             _MainColor("Diffuse",Color) = (1,1,1,1)
             _SpecColor("Specular Color", Color) = (1, 1, 1, 1)
        _Gloss("Gloss", Range(0.01, 10)) = 0.5
        }
        SubShader {
            Tags { "RenderType"="Opaque" }
            LOD 200
            CGPROGRAM
            #pragma surface surf BlinnPhong
            sampler2D _MainTex;
            float _SpecularPower;
         float _Gloss;
           float _Spec;
           float4 _MainColor;
            struct Input {
                float2 uv_MainTex;
            };
            void surf (Input IN, inout SurfaceOutput o) {
                float4 c = tex2D (_MainTex, IN.uv_MainTex);
                o.Specular = c.a;
           o.Gloss = _Gloss;
                o.Albedo = c.rgb * _MainColor.rgb;
            }
            ENDCG
        } 
        FallBack "Diffuse"
    }
  • 相关阅读:
    《构建之法》第四章的感悟
    单复利软件单元测试
    实验一 操作系统模仿cmd
    <构建之法>第一二三章感悟
    近期工作量统计
    复利计算3.0
    复利运算
    单利运算1
    复利计算6.0
    汉堡包
  • 原文地址:https://www.cnblogs.com/hengsoft/p/10250910.html
Copyright © 2011-2022 走看看