05計算機圖形學雙語課程matrices_第1頁
05計算機圖形學雙語課程matrices_第2頁
05計算機圖形學雙語課程matrices_第3頁
05計算機圖形學雙語課程matrices_第4頁
05計算機圖形學雙語課程matrices_第5頁
已閱讀5頁,還剩25頁未讀 繼續免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、Projection Matrices投影矩陣原著Ed AngelProfessor of Computer Science, Electrical and Computer Engineering, and Media ArtsUniversity of New Mexico編輯 武漢大學計算機學院圖形學課程組ObjectivesDerive the projection matrices used for standard OpenGL projections推導出在標準OpenGL投影中所用的投影Introduce oblique projections矩陣具體表示,介紹傾斜投影Intr

2、oduce projection normalization介紹投影規范化Outline5.8 Parallel-Projection Matrices平行投影矩陣5.8.1 Projection Normalization規范化5.8.2 Orthogonal-Projection Matrices正投影矩陣5.8.3 Oblique Projections傾斜投影5.9 Perspective-Projection Matrices透視投影矩陣5.9.1 Perspective Normalization透視規范化5.9.2 OpenGL Perspective Transformatio

3、n OpenGL透視規范化5.8 Parallel-Projection Matrices 平行投影矩陣5.8.1 Projection Normalization 投影規范化Rather than derive a different projection matrix for each type of projection, we can convert all projections to orthogonal projections with the default view volume不想為每種類型的投影設計不同的投影矩陣,所以把所有的投影轉化為具有默認視景體的正交投影This s

4、trategy allows us to use standard transformations in the pipeline and makes for efficient clipping這種策略可以使我們在流水線中應用標準變換,并進行有效的裁剪5.8.1 Projection Normalization規范化把對象進行變形,使得變形后的對象經正交投影后得到與原對象的理想投影一樣的視圖規范化矩陣就是正交投影矩陣串乘上對象變形(distort)矩陣5.8.1 Projection Normalization規范化(Pipeline View流水線)model-view transform

5、ation模型視圖projectiontransformation投影變換perspectivedivision透視除法clipping裁剪projection投影Nonsingular非奇異變換4D 3Dagainst default cube相對于默認立方體3D 2D5.8.1 Projection Normalization規范化(Notes-1)We stay in four-dimensional homogeneous coordinates through both the model-view and projection transformations在模型視圖變換和投影變換

6、的過程中,我們是一直在四維齊次坐標系中的Both these transformations are nonsingular這些變換都是非奇異的Default to identity matrices (orthogonal view)默認值為單位陣(正交視圖)5.8.1 Projection Normalization規范化(Notes-2)Normalization lets us clip against simple cube regardless of type of projection規范化使得不管投影的類型是什么,都是相對于默認的簡單立方體進行裁剪Delay final pro

7、jection until end直到最后時刻才進行 投影處理Important for hidden-surface removal to retain depth information as long as possible從而可以盡可能的保留深度信息,這對隱藏面消除是非常重要的5.8.2 Orthogonal-Projection Matrices正投影矩陣(正則視景體)OpenGL缺省的視景體是中心在原點,邊長為2的立方體,相當于調用glMatrixMode(GL_PROJECTION);glLoadIdentity();glOrtho(-1.0, 1.0, -1.0, 1.0, -

8、1.0, 1.0);稱這個視景體為正則視景體(canonical view volume)5.8.2 Orthogonal-Projection Matrices正投影矩陣(Orthogonal Normalization正交規范化)glOrtho(left,right,bottom,top,near,far)normalization find transformation to convertspecified clipping volume to default規范化 求出把指定裁剪體轉化為默認裁剪體的變換Figure 5.36 Mapping a view volume to the

9、canonical view volume5.8.2 Orthogonal-Projection Matrices正投影矩陣(Orthogonal Matrix正交規范化矩陣)Two stepsMove center to origin把中心移到原點,對應的變換為T(-(left+right)/2, -(bottom+top)/2,(near+far)/2)Scale to have sides of length 2進行放縮從而使視景體的邊長為2S(2/(left-right),2/(top-bottom),2/(near-far)P = ST =5.8.2 Orthogonal-Proje

10、ction Matrices正投影矩陣(Final Projection最后的投影)Set z =0 Equivalent to the homogeneous coordinate transformation這等價于如下的齊次坐標變換Hence, general orthogonal projection in 4D is從而在4D中一般的正交投影為Morth = P = MorthST5.8.3 Oblique Projections傾斜投影The OpenGL projection functions cannot produce general parallel projection

11、s such as 投影函數不支持一般的平行投影,例如立方體的如下圖示However if we look at the example of the cube it appears that the cube has been sheared此時立方體好像發生了錯切,然后再進行正交投影Oblique Projection = Shear + Orthogonal Projection 傾斜投影= 錯切正交投影5.8.3 Oblique Projections傾斜投影(General Shear一般的錯切)top viewside viewFigure 5.40 Oblique clippin

12、g volume5.8.3 Oblique Projections傾斜投影(頂視圖和側視圖)top viewside viewFigure 5.40 Oblique projection (a) Top view (b) side view volume5.8.3 Oblique Projections傾斜投影(Shear Matrix錯切矩陣)xy shear (z values unchanged) xy 錯切(z值不變)Projection matrix投影矩陣General case:一般情形 H(q,f) = P = Morth H(q,f) P = Morth STH(q,f) 5

13、.8.3 Oblique Projections傾斜投影(Equivalency等價性)Figure 5.45 Effect of shear transformation5.8.3 Oblique Projections傾斜投影(Effect on Clipping對裁剪體的影響)The projection matrix P = STH transforms the original clipping volume to the default clipping volume投影矩陣P = STH把原來的裁剪體變換為默認的裁剪體top viewDOPDOPnear planefar pla

14、neobjectclippingvolumez = -1z = 1x = -1x = 1 distorted object變形后的對象(projects correctly)5.9 Perspective-Projection Matrices透視投影矩陣5.9.1 Perspective Normalization 透視規范化(Simple Perspective簡單透視)Consider a simple perspective考慮簡單透視 with the COP at the origin:COP在原點, the near clipping plane at z = -1近裁剪面在z

15、= -1, and a 90 degree field of view determined by the planes由平面x = z, y = z確定的有90度的視野 x = z, y = z5.9.1 Perspective Normalization(Perspective Matrices透視矩陣)Simple projection matrix in homogeneous coordinates齊次坐標下的簡單投影矩陣為Note that this matrix is independent of the far clipping plane注意這個矩陣與遠裁剪面無關M =5.9

16、.1 Perspective Normalization(Generalization推廣)N =after perspective division, the point (x, y, z, 1) goes to在透視除法后,點( x,z,1)變到了x = x/zy = y/zZ = -(a+b/z)which projects orthogonally to the desired point regardless of a and b 無論, 的值是什么,在正交透影后就得到所期望的點。此時矩陣N非奇異 x = z, y = zz=-nearz=-far5.9.1 Perspective

17、Normalization(Picking and 與的選取)If we pick如果取a = b = the near plane is mapped to那么近平面映射到 z = -1the far plane is mapped to遠平面映射到z =1and the sides are mapped to各側邊映射到 x = 1, y = 1Hence the new clipping volume is the default clipping volume這樣,新的裁剪體就是缺省裁剪體5.9.1 Perspective Normalization(Normalization Tra

18、nsformation規范變換)original clippingvolume原來的裁剪體original object原來的對象new clipping volume新裁剪體distorted object變形后的對象projects correctlyFigure 5.43 Perspective normalization of view volumeNormalization and Hidden-Surface Removal規范化與隱藏面消除-1Although our selection of the form of the perspective matrices may ap

19、pear somewhat arbitrary, it was chosen so that if z1 z2 in the original clipping volume then the for the transformed points z1 z2 雖然這里選擇的透視矩陣形式上看起來有點兒任意,但這種選擇保證如果在原來的裁剪體內z1z2, 那么變換后的點滿足z1z2Normalization and Hidden-Surface Removal規范化與隱藏面消除-2Thus hidden surface removal works if we first apply the norm

20、alization transformation因此如果首先應用規范變化,隱藏面消除算法有效However, the formula z = -(a+b/z) implies that the distances are distorted by the normalization which can cause numerical problems especially if the near distance is small 然而,公式z = -(+/z)意味著由于規范化導致距離發生了改變,這可能導致數值問題,特別是當近距離非常小的時候更是如此5.9.2 OpenGL Perspecti

21、ve Transformation (OpenGL Perspective OpenGL的透視)glFrustum allows for an unsymmetric viewing frustum可以定義非對稱視景體(盡管 gluPerspective does not不能做到這一點)Figure 5.44 OpenGL Perspective5.9.2 OpenGL Perspective Transformation(OpenGL Perspective Matrix OpenGL透視矩陣)The normalization in glFrustum requires an initial shear to form a right viewing pyramid, followed by a scaling to get the normalized perspective volume. Finally, the perspective matrix results in needing only a final orthogonal transformation 在glFrustum中的規范化需要進行一個初始剪切變換,從而形成一個視景棱臺,接著進行放縮變換,得到規范后的透視視

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論