Game Development Reference
In-Depth Information
Type
Descripion
softvegetation
Makes the surface shader only be rendered when Soft
Vegetaion is on.
Noambient
Do not apply any ambient lighing or spherical harmonics
lights.
novertexlights
Do not apply any spherical harmonics or per-vertex lights in
forward rendering.
nolightmap
Disables lightmap support in this shader (makes a shader
smaller).
Noforwardadd
Disables forward rendering addiive pass. This makes the
shader support one full direcional light, with all other
lights computed per-vertex/SH. Makes shaders smaller as
well.
approxview
Computes normalized view direcion per-vertex instead of
per-pixel, for shaders that need it. This is faster, but view
direcion is not enirely correct when camera gets close to
the surface.
halfasview
Pass half-direcion vector into the lighing funcion instead
of view-direcion. Half-direcion will be computed and
normalized per vertex. This is faster, but not enirely
correct.
Addiionally, you can write #pragma debug inside the CGPROGRAM block, and then the
surface compiler will spit out a lot of comments of the generated code. You can view that
using Open Compiled Shader in shader inspector.
Surface shaders input structure
The input structure Input generally has any texture coordinates needed by the shader.
Texture coordinates must be named uv followed by a texture name (or start it with uv2 to
use the second texture coordinate set).
Example:
Properties {
_MainTex ("Texture", 2D) = "white" {}
}
……
sampler2D _MainTex;
……
struct Input {
float2 uv_MainTex;
};
Search WWH ::




Custom Search