Game Development Reference
In-Depth Information
Tip
This is also a good option if your shader doesn't need a fancy effect such as a 2D
game on mobile. This could save your time so that you can write a shader that
supports old and new hardware.
Regardless of which type you choose, the actual code of the shader code will always be
wrapped in ShaderLab, which is used to organize the shader structure. It looks like the fol-
lowing code:
Shader "MyShader" {
Properties {
// All properties go here
_MyTexture ("My Texture", 2D) = "white" { }
}
SubShader {
// Choose your written style
// - surface shader or
// - vertex and fragment shader or
// - fixed function shader
}
SubShader {
// Optional - A simpler version of the SubShader above
that can run on older graphics cards
}
}
However, we will only talk about the surface shaders that we used in Project 3 , Shade
Your Hero/Heroine , of this topic.
Note
For more information about other shader types, visit the following URLs:
ShaderLab : http://docs.unity3d.com/Documentation/Components/SL-
Shader.html
Vertex and fragment shaders : http://docs.unity3d.com/Documentation/Compon-
ents/SL-ShaderPrograms.html
Search WWH ::




Custom Search