Unity Shader Build In Values

1. 常用矩阵API 
UNITY_MATRIX_MVP       float4x4       Current model * view * projection matrix.
UNITY_MATRIX_MV        float4x4       Current model * view matrix.
UNITY_MATRIX_V         float4x4       Current view matrix.
UNITY_MATRIX_P         float4x4       Current projection matrix.
UNITY_MATRIX_VP        float4x4       Current view * projection matrix.
UNITY_MATRIX_T_MV      float4x4       Transpose of model * view matrix.
UNITY_MATRIX_IT_MV     float4x4       Inverse transpose of model * view matrix.
UNITY_MATRIX_TEXTURE0 to UNITY_MATRIX_TEXTURE3  
                       float4x4       Texture transformation matrices.
_Object2World          float4x4       Current model matrix.
_World2Object          float4x4       Inverse of current world matrix.
_WorldSpaceCameraPos   float3         World space position of the camera.
unity_Scale            float4         xyz components unused; w contains scale for uniformly scaled objects.

2. 灯光API
Name    Type    Value
_ModelLightColor              float4                 Material’s Main * Light color
_SpecularLightColor           float4                 Material’s Specular * Light color
_ObjectSpaceLightPos          float4                 Light’s position in object space. w component is 0 for directional lights, 1 for other lights
_Light2World                  float4x4              Light to World space matrix
_World2Light                  float4x4                                  World to Light space matrix
_Object2Light                 float4x4              Object to Light space matrix

3.变量
_Time                         float4                Time (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).
_ProjectionParams             float4                x is 1.0 (or1.0 if currently rendering with a flipped projection matrix), y is the camera’s near plane, z is the camera’s far plane and w is 1/FarPlane.
_ScreenParams                 float4                x is the current render target width in pixels, y is the current render target height in pixels, z is 1.0 + 1.0/width and w is 1.0 + 1.0/height.

UnityCg.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值