One
transformation matrices
UNITY_MATRIX_MVP from object space to projection space (projection)
UNITY_MATRIX_MV from object space to camera space
Unity_matrix_v from World space to camera space
Unity_matrix_p from camera space to projection space
UNITY_MATRIX_VP from World space to projection space
Transpose matrix of UNITY_MATRIX_T_MV UNITY_MATRIX_MV
UNITY_MATRIX_IT_MV the inverse matrix of the UNITY_MATRIX_MV, the matrix transformation of the normal needs to use the reversal matrix of the transformation matrix.
_object2world from object space to world space
_world2object _object2world's inverse matrix, from world space to object space
second, Camera and screen
Name |
Type |
Value |
_worldspacecamerapos |
Float3 |
World space position of the camera. Camera's World coordinates |
_projectionparams |
Float4 |
X is 1.0 (or–1.0 if currently rendering with aflipped projection matrix), is the camera's near y plane, is the z camera ' s far plane and is w 1/farplane.
The X value is 1.0 or-1.0 (when the projection matrix is inverted) Y near section, Z far section, W 1/Far cross section |
_screenparams |
Float4 |
x Is the camera's render target width in pixels, is the y camera's render target height in pixels, is z 1.0 + 1.0/width and is w 1.0 + 1.0/height.
Screen size x width, y high, z 1+1.0/width,w 1+1.0/height |
_zbufferparams |
Float4 |
Used to linearize Z buffer values. x Is (1-far/near), was ( y far/near), is z (X/far) and is w (Y/far). For linearization of ZBuffer |
Unity_orthoparams |
Float4 |
x Is orthographic camera's width, is y orthographic camera's height, is unused and was z w 1.0 when camera is Orthograp HIC, 0.0 when perspective.
orthogonal Camera related parameters, W value 1 is orthogonal projection, 0 o'clock is perspective projection |
Unity_cameraprojection |
float4x4 |
Camera ' s projection matrix. Projection matrix of the camera |
Unity_camerainvprojection |
float4x4 |
Inverse of camera ' s projection matrix. Inverse matrix of the projection matrix of the camera |
UNITY_CAMERAWORLDCLIPPLANES[6] |
Float4 |
Camera frustum plane World space equations, in this order:left, right, bottom, top, near, far. The right and left of the cone of view |
Three, time
Name |
Type |
Value |
_time |
float4 |
time since level load (T/20, T, T*2, t*3), use to animate things inside the shaders. |
_sintime |
float4 |
sine of Time: (T/8, T/4, T/2, T). |
_costime |
float4 |
cosine of Time: (T/8, T/4, T/2, T). |
Unity_deltatime |
Float4 |
Delta time: (DT, 1/DT, SMOOTHDT, 1/SMOOTHDT). Frame interval Time |
Four
illumination variables for forward rendering
Name |
Type |
Value |
_lightcolor0(declared in Lighting.cginc) |
Fixed4 |
Light color. Light color |
_worldspacelightpos0 |
Float4 |
Directional Lights: (World Space Direction, 0). Other lights: (World space Position, 1). World space Illumination Position, the W value of the parallel light is 0, the other light source has a W value of 1 |
_lightmatrix0(declared in Autolight.cginc) |
float4x4 |
World-to-light Matrix. Used to sample cookies & attenuation textures. World space goes to light space matrix |
Unity_4lightposx0, Unity_4lightposy0, unity_4lightposz0 |
Float4 |
(Forwardbase pass only)world space positions of the first four non-important point lights. |
Unity_4lightatten0 |
Float4 |
(Forwardbase pass only)attenuation factors of the first four non-important point lights. |
Unity_lightcolor |
HALF4[4] |
(Forwardbase pass only)colors of the first four non-important point lights. |
v. Delayed illumination-related variables
Name |
Type |
Value |
_lightcolor |
float4 |
Span style= "FONT-SIZE:16PX;" >light color. Light colors |
_lightmatrix0 |
float4x4 |
world-to-light Matrix. Used to sample cookies & attenuation textures. world space goes to light space matrix   |
Six
vertex illumination related variables
Name |
Type |
Value |
Unity_lightcolor |
HALF4[8] |
Light colors. Light color |
Unity_lightposition |
FLOAT4[8] |
View-space light positions. (-direction,0) for directional lights; (position,1) for point/spot lights. View space illumination position, the W value of the parallel light is 0, and the other light source has a W value of 1 |
Unity_lightatten |
HALF4[8] |
Light attenuation factors. xis cos (SPOTANGLE/2) or–1 for non-spot lights; yis 1/cos (SPOTANGLE/4) or 1 for non-spot lights; zis quadratic attenuation; Wis squared light range. Light Attenuation value |
Unity_spotdirection |
FLOAT4[8] |
View-space spot light positions; (0,0,1,0) for non-spot lights. View Space Spotlight Location |
Unity shader built-in variables