original articles should be reproduced please specify: Reproduced from the Wind Yu Chong Unity3d Tutorial College
Fixed function Shader Introduction: Belongs to the stationary rendering pipeline Shader, which is basically used for advanced Shader when the old video card cannot be displayed. Using the Shaderlab language, the syntax is similar to Microsoft's FX files or Nvidia's CGFX.
Example one: show a single color
Let's take a look at the first example, show a single color, the comments are written in detail, according to the format can be written.
Root Shadershader "Custom/1_1color" { //attribute Properties { //define a color _color ("Main color", color) = (1,.5,. 5,1) } //child shader Subshader { Pass { Material { ///Display the color diffuse [_color] } //Turn on the light switch, i.e. accept the light Lighting on }}}
Example two: displaying a decal
Shader "Custom/1_2show1texture" { Properties { _maintex ("Base (RGB)", 2D) = "White" {} _color ("Main Color", Color) = (1,1,1,1) } subshader { Pass { Material { diffuse[_color] } Lighting on Settexture[_maintex] { //combine color section, Alpha part // material * Vertex color Combine Texture * Primary,texture * constant }}}
Example three: overlay of two posting graphs
Shader "Custom/1_3merge2texture" { Properties { _maintex ("Base (RGB)", 2D) = "White" {} _maintex2 ("Tex2 (RG B) ", 2D) =" White "{} _color (" Main Color ", color) = (1,1,1,1) } subshader { Pass { Material { diffuse[_color] } Lighting on Settexture[_maintex] { // First material * Vertex color Combine Texture * Primary } SETTEXTURE[_MAINTEX2] { // second material * Accumulated before (this is the first material) Combine texture * Previous } } }}
Unity3d Tutorial Shader Chapter: The second fixed Function Shader