📜  Unlit shader 获取相机 UNity 的方向 - C# 代码示例

📅  最后修改于: 2022-03-11 14:48:53.001000             🧑  作者: Mango

代码示例1
struct v2f {     
 float4 pos : SV_POSITION;     
 float3 normal : TEXCOORD0; //you don't need these semantics except for XBox360     
 float3 viewT : TEXCOORD1; //you don't need these semantics except for XBox360 
 }; 
 
 v2f vert (appdata_base v) {     
 v2f o;     
 o.pos = mul (UNITY_MATRIX_MVP, v.vertex);    
 o.normal = normalize(v.normal);     
 o.viewT = normalize(WorldSpaceViewDir(v.vertex));//ObjSpaceViewDir is similar, but localspace.     
 return o; 
 }