2012年7月20日 星期五

Introduction to Stage3D: Part 6

perspective projections
透視投影基本介紹及教學

右手座標系 RH:
+x is right
+y is up
-z is into the screen
順時針為正面,逆時針為背面

左手座標系 LH:
+x is right
+y is up
+z is into the screen
順時針為正面,逆時針為背面兩種座標系差別只有 z 的方向

目前 adobe PerspectiveMatrix3D.as 已實作幾種常用的 3D 投影方法,
orthoLH(正交投影)
簡單說就是 z=0
orthoOffCenterLH 與 orthoLH 兩者的差別在自訂中心點位置

個人比較常用 LH 座標系,
另外,PerspectiveMatrix3D.as 實作 RH 上似乎有問題 ,
google 一下似乎沒人提到 orthoRH 裡面有錯,

修正 orthoRH
(zNear-zNear)
改為
(zFar-zNear)

另外,orthoOffCenterRH() render 出來也是上下顛倒....

弄了一個 Base3D Class 這樣實作起來比較簡單,
詳細 code 見這裡

沒有留言:

張貼留言