Game Development Reference
In-Depth Information
float nh = saturate(dot (s.Normal, h)); //Make sure that
the return number isn't lower than 0 and greater than 1
float specPower = pow (nh, _Glossiness);
fixed3 specular = _LightColor0.rgb * specPower * _
SpecularColor.rgb;
//Result
fixed4 c;
c.rgb = (ambient + diffuse + specular) * (atten * 2);
c.a = s.Alpha + (_LightColor0.a * _SpecularColor.a *
specPower * atten);
return c;
}
Finally, we go back to Unity and apply the ramp texture to our model. Let's click on the
Heroine.FBX
model in the
Hierarchy
view to bring up its
Inspector
view. In the
Inspector
view, we will go to the material component in the new property
Shading Ramp
and set
the following:
F
Shading Ramp
: Drag-and-drop the
Ramp.jpg
in the
Textures
folder from the
Project
view to this thumbnail
After finishing, we will see the
Inspector
view, as shown in the following screenshot: