Unity Shader 笔记 一

Properties语义块的定义

Properties{

Name ("display name",PropertyType) = DefaultValue

Name ("display name",PropertyType) = DefaultValue

//更多的属性

}

例如

  

Shader "Custom/MyShader1"
{
    Properties
    {
        _MainTex ("Texture", 2D) = "white" {}
        //Numbers and Sliders
        _Int ("Int",Int) = 2
        _Float ("Float", Float) = 1.5
        _Range ("Range",Range(0.0,5.0)) = 3.0
        //Colors and Vectors
        _Color ("Color",color) = (1,1,1,1)
        _Vector ("Vector", Vector) = (2,3,6,1)
        //Textures
        _2D ("2D",2D) = "" {}
        _Cube ("Cube",Cube)="White" {}
        _3D ("3D",3D) = "black"{}
    }
}

SubShader语义块的定义

SubShader{
    //可选择的
    [Tags]

    //可选择的
    [RenderSetup]

    Pass{
    }
  //Other Passes      
}

Pass语义块的定义

Pass{
    [Name]
    [Tags]
    [Rendersetup]
    //Other code  
}
原文地址:https://www.cnblogs.com/muyouking/p/6498255.html