鸟语天空
Tags
post by:追风剑情 2017-8-3 11:48

参考 http://www.jianshu.com/p/7b9498e58659

SubShader中的Tags
SubShader
{
   Tags {"Queue"="Geometry" "RenderType"="Opaque" "ForceNoShadowCasting"="true" "IgnoreProjector"="true"}
}

参见官方文档 https://docs.unity3d.com/Manual/SL-ShaderReplacement.html
Queue: 渲染队列



RenderType: 渲染类型

ForceNoShadowCasting: 值为"true"时,表示不接受阴影。
IgnoreProjector: 值为"true"时,表示不接受Projector组件的投影。

Pass中的Tags
SubShader {
   Pass {
      Tags{ "LightMode"="ForwardBase" }
   }
}

参见官方文档 https://docs.unity3d.com/Manual/SL-PassTags.html
LightMode: 光照模式

示例


Shader "Custom/ForwardBase" {
	Properties {
        _Color ("Main Color", Color) = (1,1,1,0)
        _SpecColor ("Spec Color", Color) = (1,1,1,1)
        _Emission ("Emmisive Color", Color) = (0,0,0,0)
        _Shininess ("Shininess", Range (0.01, 1)) = 0.7
        _MainTex ("Base (RGB)", 2D) = "white" {}
    }
    SubShader {
		Tags {"Queue"="Geometry" "RenderType"="Opaque" "ForceNoShadowCasting"="true" "IgnoreProjector"="true"}
		
        Pass {
			Tags{ "LightMode"="ForwardBase" }
			
            Material {
            	//漫反射颜色
                Diffuse [_Color]
                //环境光颜色
                Ambient [_Color]
                //亮度
                Shininess [_Shininess]
                //高光颜色
                Specular [_SpecColor]
                //自发光颜色
                Emission [_Emission]
            }
            //开启光照
            Lighting On
            //开启高光
            SeparateSpecular On
            //混合纹理
            SetTexture [_MainTex] {
            	//纹理混合模式参见: https://docs.unity3d.com/Manual/SL-SetTexture.html
            	//主纹理rgb * 光照颜色rgb 2倍亮度, 主纹理alpha * 光照颜色的alpha
                Combine texture * primary DOUBLE, texture * primary

                //Quad: 4倍亮度
                //Combine texture * primary Quad, texture * primary
            }
        }
    }
}


评论:
发表评论:
昵称

邮件地址 (选填)

个人主页 (选填)

内容