UNITY SHADER学习笔记1(unity 5.6)

UNITY_UV_STARTS_AT_TOP

通常用于判断D3D平台,在开启抗锯齿的时候,图片采样可能会用到

UNITY_SINGLE_PASS_STEREO

单通道立体渲染,目前主要用于VR

UNITY_COLORSPACE_GAMMA

当前使用gamma空间,还是线性颜色空间

参数

变换相关

最常用的,估计没有不清楚的,都是float4*4

UNITY_MATRIX_MVP

model * view * projection

UNITY_MATRIX_MV

model * view

UNITY_MATRIX_V

view

UNITY_MATRIX_P

projection

UNITY_MATRIX_VP

view * projection

UNITY_MATRIX_T_MV

model * view的转置矩阵

UNITY_MATRIX_IT_MV

model * view的逆转矩阵

_Object2World _World2Object

如名

相机和屏幕相关

_WorldSpaceCameraPos

float3
摄像机的世界坐标

_ProjectionParams

float4
// x = 1 or -1 (很少用,-1说明rendering有翻转投影矩阵)
// y = near plane
// z = far plane
// w = 1/far plane

_ScreenParams

float4
用屏幕坐标除以屏幕分辨率,_ScreenParams.xy可以得到视口空间中的坐标
x is the camera’s render target width in pixels, y is the camera’s render target height in pixels, z is 1.0 + 1.0/width and w is 1.0 + 1.0/height

_ZBufferParams

float4
用于将z缓存线性化时使用
x is (1-far/near), y is (far/near), z is (x/far) and w is (y/far)

unity_OrthoParams

正交相机的相关参数
x is orthographic camera’s width, y is orthographic camera’s height, z is unused and w is 1.0 when camera is orthographic, 0.0 when perspective

unity_CameraProjection

float4*4
摄像机的投影矩阵

unity_CameraInvProjection

unity_CameraProjection的逆矩阵

unity_CameraWorldClipPlanes[6]

float4
裁剪空间下的一些参数
left, right, bottom, top, near, far

时间相关

单位是秒

_Time

float4
// (t/20, t, t*2, t*3)

_SinTime

float4
// sin(t/8), sin(t/4), sin(t/2), sin(t)

_CosTime

float4
// cos(t/8), cos(t/4), cos(t/2), cos(t)

unity_DeltaTime

float4
就是上一帧的时间,smooothdt为平滑时间&#x

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值