4  case (make 3 real-axis look like match  right hand rule)  
  它們都做了奇數次的鏡射(odd times mirror)
  3 case (make 3  real-axis still  match left hand rule)
  它們都做了偶數次的鏡射(even times mirror)
  在奇數次的鏡射的情況(in  odd times  mirror)
  要再多改變一次tangent的方向(swap y again)
  Unity乘上unity_WorldTransformParams.w應該就是這個原因
  但Unity怎麼計算出unity_WorldTransformParams.w?
  我猜可能像這樣...
  方法(1)
  transform  has  LossyScale(the global scale of object)
unity_WorldTransformParams.w=sign(LossyScaleX*LossyScaleY*LossyScaleZ)
  方法(2)
  transform has   right ,
    up , forward
  但是right,up ,forward並不會反應出scale設為負值後的方向改變
  所以必須乘上lossyScale
  (也就是光看right,up,forward看不出3軸有沒有match right hand rule )
  檢查cross(real_right ,real_up)和real_forward
    是不是同向,決定[鏡射因子]
Vector3 real_right=LossyScaleX*right;Vector3 real_up=LossyScaleY*up;Vector3 real_forward=LossyScaleZ*forward;unity_WorldTransformParams.w=sign(dot(cross(real_right,real_up),real_forward));




沒有留言:
張貼留言