1 / 88

傳統的多邊形著色方式

傳統的多邊形著色方式. 6.1 座標空間與傳統繪圖管線的幾何操作 6.2 瀏覽空間的操作 6.3 繪圖管線的演算 6.4 著色的範例. Introduction. 三維繪圖管線. 物件座標 場景座標 瀏覽座標 三維螢幕座標 顯示平面. 6.1 座標空間與傳統繪圖管線的幾何操作. 區域 物件 建模座標系統 世界 場景座標系統 相機 眼睛 瀏覽座標系統. 6.1.1 區域 物件 建模座標系統. 以物件之某個部份為參考點 用於物件之建模

daw
Télécharger la présentation

傳統的多邊形著色方式

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 傳統的多邊形著色方式 6.1 座標空間與傳統繪圖管線的幾何操作 6.2 瀏覽空間的操作 6.3 繪圖管線的演算 6.4 著色的範例

  2. Introduction • 三維繪圖管線 物件座標 場景座標 瀏覽座標 三維螢幕座標 顯示平面

  3. 6.1座標空間與傳統繪圖管線的幾何操作 • 區域\物件\建模座標系統 • 世界\場景座標系統 • 相機\眼睛\瀏覽座標系統

  4. 6.1.1 區域\物件\建模座標系統 • 以物件之某個部份為參考點 • 用於物件之建模 • 保有物件之對稱性 • 有利於形變之處理

  5. 6.1.2世界\場景座標系統 • 用來描述一個世界或場景之座標系統 • 物件: • 運用Modelling transformations來放置 • 物件 • Camera/light source • Surface attributes are specified in this space (texture, colour and so on)

  6. 6.1.3 相機\眼睛\瀏覽座標系統 • 用於 建立瀏覽參數(視點, 瀏覽方向) 與瀏覽區域(view volume).

  7. Virtual camera analogy • External camera parameters • Position • Orientation • Internal camera parameters • Those that affect the nature and size of the image on the film plane. • Lens type • Film size/ position/orientation

  8. Simplest or minimum viewing system • This system consist of the following: • A view pointC • the view’s positions in world space • either the origin of the view coordinate system • or the centerof projection together with a view direction normal N • A view coordinate system defined with respect to the viewpoint • A view plane onto which the 2D image of the scene is projected • A view frustum or volume which defines the field of view

  9. Simplest or minimum viewing system

  10. Simplest or minimum viewing system

  11. Transformation • Camera that can be positioned anywhere in world coordinate space, pointed in any direction and rotated about the viewing direction N. • Two components of the change coordinate transform of a point P in world coordinate (xw,yw,zw) to view coordinate (xv,yv,zv) • Translation: T • Rotational: R. where

  12. View coordinates system • Three viewing parameters required for setting up view space axes • C :view point • A world space coordinate of the view point • N :view orientation • Can be specified by spherical coordinate system • V' : up vector • A world space vector used to calculate V axis, then U axis

  13. View coordinates system (N view orientation) • Specifying the orientation of a vector N

  14. View coordinates system (up vector) • The up vector V can be calculated from an indication given by V' • V = V'– (V‧N)N • U = N V

  15. View coordinates system • In many APIs the following notation is used for the above UVN terminology • V = VUP (view-up vector) • N = VPN (view plane normal) • C = VRP (view reference point) • In OpenGL, for example, the viewing utility uses a camera point, a look at point and an up vector and in this case we have • gluLookAt(eyeX,eyeY,eyeZ, centreX,centreY,centerZ, upX,upY,upZ) • U = N  (upX,upY,upZ) • V = (upX,upY,upZ) • N = (centreX,centreY,centerZ) – (eyeX,eyeY,eyeZ) • C = (eyeX,eyeY,eyeZ)

  16. View coordinates system • Example

  17. View coordinates system • A flight simulator, here the camera would remain fixed to the local coordinate system of the aircraft and would take the same transformations –translation and three rotations specifying roll, pitch and yaw • Rotate roll degrees about the z axis • Rotate pitch degrees about the x axis • Rotate yaw degrees about the y axis

  18. 6.2 Operations carried out in view space 6.2.1 Culling or back-face elimination 6.2.2 The view volume 6.2.3 Three-dimensional screen space 6.2.4 view volume and depth

  19. 6.2.1 Culling or back-face elimination • Culling or back-face elimination is an operation that compare the polygon normal Np of a complete polygon with the vieworientation vector N to determine the visibility of the polygon. • Visibility = Np • N >0 • Np is the polygon normal • N the line of sight vector

  20. Culling and hidden space removal

  21. Culling or back-face elimination

  22. 6.2.2 The view volume • A semi-infinite pyramid which can be further constrained to a more general view volume defined by • A view plane window • A near clip plane • A far clip plane • Objects and polygons outside the view volume are culled in whole or partially clipped

  23. General view volume

  24. Practical view volume

  25. Clipping against a view volume

  26. 6.2.3 Three-dimensional screen space • The final 3D space in our pipeline • Operations carry out in this space • Clipping against the view volume • Rendering • Hidden surface removal (HSR) • Z-buffer • Perspective divide: projection from 3D view volume to 2D view plane window • Parallel/orthographic • perspective

  27. Parallel projection VS. perspective projection

  28. Perspective projection • A perspective projection is the more popular or common choice in computer graphics because it incorporates foreshortening. • In a perspective projection relative dimensions are not preserved, and a distant line is displayed smaller than a nearer line of the same length.

  29. Deriving a perspective transformation

  30. Deriving a perspective transformation • 由相似三角型得 • In homogeneous coordinates

  31. Deriving a parallel projection

  32. 6.2.4 View volume and depth • 為能執行 HSR 計算(特別是在 Z-buffer 演算法), 必須能計算出多邊形內任一點的深度資訊 • 實際方法:給定一直線與一平面, 首先計算出兩者交接點的位置(參數位置), 再以內差方式由兩頂點的深度計算出該交接點的深度

  33. Depth calculation • Zs = A+B/Zv • Where A and B are constants. These constants are determined from the following constraints • Choosing B < 0 so that as Zv increases then so does Zs • An important practical consideration concerning depth is the accuracy to which we store its value. To ensure this is as high as possible we normalise the range of Zs values so that the range Zv  [d,f] maps into range Zs  [0,1]

  34. Full perspective transform • Considering the view volume in Figure 6.9 the full perspective transformation is given by • Where the additional constant h appearing in the transformation for xs and ys, ensure that these values fall in the range [-1,1] over the square screen

  35. Full perspective transform • Adopting a similar manipulation to section 6.2.3 we have • The overall transformation from world space to screen space

  36. Distortion in 3D screen space • Interpolating along a line in eye space is not the same as interpolating this line in screen.

  37. Transformation from view space to screen space • The transformation of a box with one side parallel to theimage plane.

  38. Transformation of the view volume into a canonical view volume Tpers1 Tpers2

  39. 6.3 Algorithm operations in the graphics pipeline 6.3.1 Basic view frustum culling and clipping 6.3.2 Shading pixels 6.3.3 interpolative shading techniques 6.3.4 Hidden surface removal

  40. Introduction • We will describe a particular, but common, approach. • Hidden surface removal : Z-buffer algorithm • Shading : Interpolative shading • Advantage & Disadvantage • Advantage • There is no upwards limit on scene complexity • Disadvantage • Inefficiency: polygon rendered may be overwritten subsequently by other nearer polygons

  41. 6.3.1 Basic view frustum culling and clipping • The two common approaches to avoiding detailed low-level testing • Scene management • Bounding volumes

  42. A simple bounding volume – the sphere • Information required • Radius of the bounding sphere • can be pre-calculated and stored as part of the database • Center of object • Usually be the local coordinate origin. • can be transformed by the pipeline

  43. Completely inside Retained in list Completely outside Discarded A simple bounding volume – the sphere

  44. A simple bounding volume – the sphere

  45. Sutherland-Hodgman • A polygon is tested against a clip boundary by testing each polygon edge against a single infinite clip boundary

  46. Dot product test • To calculate whether a point or vertex is inside, outside or on the clip boundary we use a dot product test • C : clip boundary • Nc : outward normal • S,F : endpoints of line • The line parametrically as • P(t) = S + (F-S)t • 0 ≤ t ≤ 1

  47. 6.3.2 Shading pixels • Local reflection models • Local reflection models – practical points • Local reflection models – light source considerations

  48. Two separate considerations • There are two separate considerations to shading the pixels onto which a polygon projects. • Local reflection models • Shading algorithm

  49. Local reflection models

  50. Local reflection models • The physical reflection phenomena that the model simulates are • Perfect specular reflection • Imperfect specular reflection • Perfect diffuse reflection

More Related