Game Development Reference
In-Depth Information
We can also have the addiional values that can be put into the input structure:
Type
Descripion
float3 viewDir
Contains view direcion, for compuing parallax efects, rim
lighing, and so on.
float4 with COLOR semanic
Contains interpolated per-vertex color.
float4 screenPos
Contains screen space posiion for relecion efects. Used by
WetStreet shader in Dark Unity, for example.
float3 worldPos
Contains world space posiion.
float3 worldRefl
Contains world relecion vector if surface shader does not
write to o.Normal. See Reflect-Diffuse shader, for example.
float3 worldNormal
Contains world normal vector if surface shader does not write
to o.Normal.
float3 worldRefl;
INTERNAL_DATA
Contains world relecion vector if surface shader writes to
o.Normal. To get the relecion vector based on per-pixel
normal map, use WorldRelecionVector (IN, o.Normal). See
Reflect-Bumped shader, for example.
float3 worldNormal;
INTERNAL_DATA
Contains world normal vector if surface shader writes to
o.Normal. To get the normal vector based on per-pixel normal
map, use WorldNormalVector (IN, o.Normal).
SurfaceOutput structure
The standard output structure of surface shaders is as follows:
struct SurfaceOutput {
fixed3 Albedo;
fixed3 Normal;
fixed3 Emission;
half Specular;
fixed Gloss;
fixed Alpha;
};
You can also find it in the Lighting.cginc file inside Unity in {unity install path}/
Data/CGIncludes/Lighting.cginc on Windows, and in /Applications/Unity/
Unity.app/Contents/CGIncludes/Lighting.cginc on a Mac.
Search WWH ::




Custom Search