Game Development Reference
In-Depth Information
Every ime you add new properies in the Properties secion, you
will need to create the same parameter inside the CGPROGRAM in the
SubShader secion, as shown in the following code:
Properties { _BumpMap ("Bumpmap", 2D) = "bump" {} }
SubShader {
………
CGPROGRAM
#pragma surface surf Lambert
sampler2D _BumpMap;
……..
ENDCG
}
We can see more details at the following website and see what each
parameter does:
http://unity3d.com/support/documentation/Components/
SL-Properties.html
Then, we set LOD (Level of Detail) for our shader to 300. The Level of Detail is the setup that
will limit our shader to use the maximum of detail to the number that we set. We used 300
because we have included the bump map to our shader, which is the same number of the
Unity built-in setup for the diffuse bump. You can take a look at the following link to get
more informaion on the Shader Level of Detail:
http://unity3d.com/support/documentation/Components/SL-ShaderLOD.html
We added the sampler2D _BumpMap; line, which is the same property that gets passed
from the Properties secion ( _BumpMap ("Bumpmap", 2D) = "bump" {} ).
sampler2 is basically the type of parameter that is used in the Cg/HLSL
shader programming language, which is a two-dimensional texture. We can
get more informaion about the Cg parameter from the following website:
http://http.developer.nvidia.com/CgTutorial/cg_
tutorial_chapter03.html
Next, we added float2 uv_BumpMap in struct Input {} , which will be used to
calculate the color informaion from our _BumpMap . The uv_BumpMap parameter is the
texture coordinate, which is the vector2 .
 
Search WWH ::




Custom Search