Game Development Reference
In-Depth Information
Engage thrusters
Let's get started. Go to MonoDevelop , open the MyShader file, and go to the Proper-
ties section and add the highlighted script:
Properties {
_AmbientColor ("Ambient Color", Color) = (0.5, 0.5, 0.5,
1.0)
_SpecularColor ("Specular Color", Color) = (0.17, 0.42,
0.75, 1.0)
_Shininess ("Shininess", Range (0.01, 1)) = 0.078125
_MainTex ("Diffuse (RGBA)", 2D) = "white" {}
_BumpMap ("Bumpmap", 2D) = "bump" {}
}
Next, go to the SubShader section and modify it as well as add the following highlighted
code:
SubShader {
Tags { "RenderType"="Opaque" }
LOD 400
CGPROGRAM
#pragma surface surf Lambert
fixed4 _AmbientColor;
fixed4 _SpecularColor;
half _Shininess;
sampler2D _MainTex;
sampler2D _BumpMap;
struct Input {
float2 uv_MainTex;
float2 uv_BumpMap;
};
void surf (Input IN, inout SurfaceOutput o) {
fixed4 c = tex2D (_MainTex, IN.uv_MainTex);
o.Albedo = c.rgb * _AmbientColor.rgb;
o.Alpha = c.a * _AmbientColor.a;
Search WWH ::




Custom Search