Game Development Reference
In-Depth Information
F lightModel —lighing model to use. Built-in ones are Lambert (diffuse) and
BlinnPhong (specular). You can also write your own by using the following custom
lighing models:
half4 LightingName (SurfaceOutput s, half3 lightDir,
half atten); : This is used in a forward rendering path for light models
that are not view direcion dependent (for example, difuse).
half4 LightingName (SurfaceOutput s, half3 lightDir,
half3 viewDir, half atten); : This is used in a forward rendering
path for light models that are view direcion dependent.
half4 LightingName_PrePass (SurfaceOutput s, half4
light); : This is used in a deferred lighing path.
Note that you don't need to declare all funcions. A lighing model
either uses view direcion or it does not. Similarly, if the lighing
model will not work in deferred lighing, you just do not declare the
_PrePass funcion. All the shaders that use it will compile to forward
rendering only, such as the shader that we did in Chapter 3 , The Hero/
Heroine Part I - Models and Shaders . We don't need the _PrePass
funcion because our shader needs the view direcion( viewDir ) and
the light direcion( lightDir ) for our custom lighing funcion to
calculate the ramp effect for the cartoon style shader (Toon Shader/
Cel Shader), which is only available in forward rendering.
F Opional parameters [optionalparams] :
Type
Descripion
alpha
Alpha blending mode. Use this for semitransparent
shaders.
alphatest:VariableName
Alpha tesing mode. Use this for transparent-cutout
shaders. Cutoff value is in float variable with VariableName.
vertex:VertexFunction
Custom vertex modiicaion funcion. See the Tree Bark
shader, for example.
exclude_path:prepass or
exclude_path:forward
Do not generate passes for given rendering path.
addshadow
Add shadow caster and collector passes. Commonly used
with custom vertex modiicaion, so that shadow casing
also gets any procedural vertex animaion.
dualforward
Use dual lightmaps in forward path.
fullforwardshadows
Support all shadow types in forward rendering path.
decal:add
Addiive decal shader (for example, terrain AddPass).
decal:blend
Semitransparent decal shader.
Search WWH ::




Custom Search