一、变换矩阵
UNITY_MATRIX_MVP 从object space转到 projection space(投影)
UNITY_MATRIX_MV 从object space转到camera space
UNITY_MATRIX_V 从world space转到camera space
UNITY_MATRIX_P 从camera space转到projection space
UNITY_MATRIX_VP 从world space转到projection space
UNITY_MATRIX_T_MV UNITY_MATRIX_MV 的转置矩阵
UNITY_MATRIX_IT_MV UNITY_MATRIX_MV的逆转置矩阵,法线的矩阵转换需要用变换矩阵的逆转置矩阵.
_Object2World 从object space转到world space
_World2Object _Object2World的逆矩阵,从world space 到object space
二、Camera and screen
Name | Type | Value |
_WorldSpaceCameraPos | float3 | World space position of the camera. 相机的世界坐标 |
_ProjectionParams | float4 |
x 值是1.0或-1.0(当为反转的投影矩阵时) y 近截面,z远截面,w 1/远截面 |
float4 |
屏幕尺寸x宽,y高,z 1+1.0/width,w 1+1.0/height | |
float4 | Used to linearize Z buffer values. 用于线性化zbuffer | |
unity_OrthoParams | float4 |
正交摄像机的相关参数,w值1时是正交投影,0时是透视投影 |
unity_CameraProjection | float4x4 | Camera’s projection matrix. 摄像机的投影矩阵 |
unity_CameraInvProjection | float4x4 | Inverse of camera’s projection matrix. 摄像机的投影矩阵的逆矩阵 |
unity_CameraWorldClipPlanes[6] | float4 | Camera frustum plane world space equations, in this order: left, right, bottom, top, near, far. 视锥体的左右下上远近
|
三、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). 帧间隔时间 |
四、forward渲染的光照变量
Name | Type | Value |
_LightColor0(declared in Lighting.cginc) | fixed4 | Light color. 光线颜色 |
_WorldSpaceLightPos0 | float4 | Directional lights: (world space direction, 0). Other lights: (world space position, 1). World space 光照位置,平行光的w值为0,其他光源的w值为1 |
_LightMatrix0(declared in AutoLight.cginc) | float4x4 | World-to-light matrix. Used to sample cookie & attenuation textures. World space转到light space矩阵 |
unity_4LightPosX0, unity_4LightPosY0, unity_4LightPosZ0 | float4 | (ForwardBase pass only)world space positions of first four non-important point lights. |
unity_4LightAtten0 | float4 | (ForwardBase pass only)attenuation factors of first four non-important point lights. |
unity_LightColor | half4[4] | (ForwardBase pass only)colors of of first four non-important point lights. |
五、延迟光照相关变量
Name | Type | Value |
_LightColor | float4 | Light color.光照颜色 |
_LightMatrix0 | float4x4 | World-to-light matrix. Used to sample cookie & attenuation textures. World space转到light space矩阵
|
六、顶点光照相关变量
Name | Type | Value |
unity_LightColor | half4[8] | Light colors. 光照颜色 |
unity_LightPosition | float4[8] | View-space light positions. (-direction,0) for directional lights; (position,1) for point/spot lights. View space光照位置,平行光的w值为0,其他光源的w值为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. 光照衰减值 |
unity_SpotDirection | float4[8] | View-space spot light positions; (0,0,1,0) for non-spot lights. View space聚光灯位置
|