Game Development Reference
In-Depth Information
Now, we can click
Play
to see the result, as shown in the following screenshot:
We can also move or rotate our camera to see our character with the shader in a
different angle.
Next, we will go to our custom lighing funcion,
LightingRampSpecular()
. In this
funcion, we will add the following highlighted code:
Next, we calculate the diffuse color by using the
Half Lambert
or
Warp Lambert
method
to get the lighing warp around our model, and then we get the ramp texture from the
property, and muliply it with the light color and our main color texture.
Objective Complete - Mini Debriefing
In this secion, irst we added three properies (
_RimColor
,
_RimPower
,
_Ramp
) in the
Properties
secion, which will be used to calculate the rim light as well as the toon ramp
shader style.
Then, we put
exclude_path:prepass
ater
#pragma surface surf RampSpecular
.
This means that we set our shader to compile without the deferred rendering. Why would
we want to do this? Because our toon ramp shader needs the angle data between the
light direction
and
surface normals
to calculate the lighing that can't be calculated in the
deferred rendering, so we exclude it.