half4
half4 是4维向量,每一维的类型是half,原来half就是2字节的(半个float长度)浮点数类型的意思,对应到double是8字节(2个float长度)的浮点数类型。
参见:http://http.developer.nvidia.com/Cg/Cg_language.html
floats23e8 ("fp32") IEEE single precision floating point halfs10e5 ("fp16") floating point w/ IEEE semantics fixedS1.10 fixed point, clamping to [-2, 2) doubles52e11 ("fp64") IEEE double precision floating point
_Time
参见:
http://docs.unity3d.com/Documentation/Components/SL-BuiltinValues.html
http://answers.unity3d.com/questions/266584/shaders-why-is-time-stored-in-a-vector4.html
_Time是个4维向量,跟Unity3D中的deltaTime(这是个一维的,数值)不同。
- float4 _Time : Time (t/20, t, t*2, t*3), use to animate things inside the shaders
fixed x= Speed * _Time;
那么默认x = Speed * _Time.x
但是如果知道_Time的结构中每个元素代表的意思,那么将上式改写成
fixed x= Speed * _Time.y;
那么会发现,结果x的值要大很多。这毕竟是20倍的差距!