Xem mẫu

Các giải thuật sinh các thực thể cơ sở Le Tan Hung hunglt@it-hut.edu.vn 0913030731 Rendering Pipeline: 3-D Transform Illuminate Transform Clip Project Rasterize Model & Camera Parameters Rendering Pipeline Framebuffer Display The Rendering Pipeline: 3-D Phép biến đổi Transformations Scene graph Object geometry Modeling Transforms Lighting Calculations Viewing Transform Clipping Projection Transform • Các điểm của hệ thống tọa độ 3D thế giới thực • Các điểm bóng theo mô hình chiếu sáng • Các điểm trong mô hình hệ tọa độ Camera hay tọa độ điểm nhìn • Các tọa độ điểm của vùng hình chóp cụt với điểm nhìn xác định • Điểm 2-D theo tọa độ màn hình sau phép chiếu được xén tỉa ⌘screen space- không gian màn hình ⌘model space Không gian mô hình (a.k.a. object space or world space) ⌘3 loại phép biến đổi: – Modeling transforms – Viewing transforms – Projection transforms Rendering: Transformations ⌘Modeling transforms – Size, place, scale, and rotate objects parts of the model w.r.t. each other – Object coordinates ⮳world coordinates Y Rendering: Transformations ⌘Viewing transform – Rotate & translate the world to lie directly in front of the camera ⌘Typically place camera at origin ⌘Typically looking down -Z axis – World coordinates ⮳view coordinates Y Z X X Z 1 Rendering: Transformations ⌘Projection transform – Apply perspective foreshortening ⌘Distant = small: the pinhole camera model – View coordinates ⮳screen coordinates Rendering: Transformations ⌘All these transformations involve shifting coordinate systems (i.e., basis sets) ⌘Oh yeah, that’s what matrices do… ⌘Represent coordinates as vectors, transforms as matrices ⎡X ′⎤ cosθ ⎣Y′⎦ ⎣sinθ −sinθ⎤⎡X ⎤ cosθ ⎦⎣Y ⎦ ⌘Multiply matrices = concatenate transforms! Rendering: Transformations The Rendering Pipeline: 3-D ⌘Homogeneous coordinates: represent coordinates in 3 dimensions with a 4-vector – Denoted [x, y, z, w]T ⌘Note that w = 1 in model coordinates – To get 3-D coordinates, divide by w: [x’, y’, z’]T = [x/w, y/w, z/w]T ⌘Transformations are 4x4 matrices ⌘Why? To handle translation and projection Scene graph Object geometry Modeling Transforms Lighting Calculations Viewing Transform Clipping Projection Transform Result: • All vertices of scene in shared 3-D “world” coordinate system • Vertices shaded according to lighting model • Scene vertices in 3-D “view” or “camera” coordinate system • Exactly those vertices & portions of polygons in view frustum • 2-D screen coordinates of clipped vertices Rendering: Ánh sáng - Lighting The Rendering Pipeline: 3-D ⌘Illuminating a scene: coloring pixels according to some approximation of lighting – Global illumination: solves for lighting of the whole scene at once – Local illumination: local approximation, typically lighting each polygon separately ⌘Interactive graphics (e.g., hardware) does only local illumination at run time Scene graph Object geometry Modeling Transforms Lighting Calculations Viewing Transform Clipping Projection Transform Result: • All vertices of scene in shared 3-D “world” coordinate system • Vertices shaded according to lighting model • Scene vertices in 3-D “view” or “camera” coordinate system • Exactly those vertices & portions of polygons in view frustum • 2-D screen coordinates of clipped vertices 2 Rendering: Clipping ⌘Clipping a 3-D primitive returns its intersection with the view frustum: Rendering: Xén tỉa - Clipping ⌘Clipping is tricky! – We will have a whole assignment on clipping Clip Clip In: 3 vertices Out: 6 vertices In: 1 polygon Out: 2 polygons The Rendering Pipeline: 3-D Transform Illuminate Transform Clip Project Rasterize Modeling: The Basics ⌘Common interactive 3-D primitives: points, lines, polygons (i.e., triangles) ⌘Organized into objects – Collection of primitives, other objects – Associated matrix for transformations ⌘Instancing: using same geometry for multiple objects Model & Camera Parameters Rendering Pipeline Framebuffer Display – 4 wheels on a car, 2 arms on a robot Modeling: The Scene Graph ⌘Đồ thị cảnh scene graph : cây đồ thị lưu trữ đối tượng, quan hệ giũa các đối tượng và các phép biến đổi trên đối tượng đó ⌘Nút là đối tượng; ⌘Cành là các thực thể biến đổi Modeling: The Scene Graph ⌘Traverse the scene graph in depth-first order, concatenating transformations ⌘Maintain a matrix stack of transformations Visited Robot – Tương ứng là các ma trận Robot Head Body Unvisited Head Body Active Mouth Eye Matrix Stack Leg Trunk Arm Foot Mouth Eye Leg Trunk Arm 3 Modeling: The Camera ⌘Finally: need a model of the virtual camera – Can be very sophisticated ⌘Field of view, depth of field, distortion, chromatic aberration… – Interactive graphics (OpenGL): ⌘Camera pose: position & orientation – Captured in viewing transform (i.e., modelview matrix) ⌘Pinhole camera model – Field of view – Aspect ratio – Near & far clipping planes ... - tailieumienphi.vn
nguon tai.lieu . vn