viewing
play

Viewing Werner Purgathofer Rendering Pipeline object - PDF document

Einfhrung in Visual Computing 186.822 186.822 Viewing Werner Purgathofer Rendering Pipeline object capture/creation scene objects in object space modeling vertex stage vertex stage viewing (vertex shader) projection


  1. Einführung in Visual Computing 186.822 186.822 Viewing Werner Purgathofer Rendering Pipeline object capture/creation scene objects in object space modeling vertex stage vertex stage viewing („vertex shader“) projection transformed vertices in clip space clipping + homogenization scene in normalized device coordinates viewport transformation rasterization pixel stage shading („fragment shader“) raster image in pixel coordinates 1 Werner Purgathofer 1

  2. From Object Space to Screen Space modeling camera „view frustum“ transformation transformation object space world space camera space projection viewport p transformation transformation transformation clip space screen space 2 Werner Purgathofer Viewport Transformation 2

  3. From Object Space to Screen Space modeling camera transformation transformation object space world space camera space projection transformation transformation viewport viewport transformation screen space clip space 4 Werner Purgathofer Viewport Transformation (1) assumption: scene is in clip space ! clip space = [–1,1]  [–1,1]  [–1,1] orthographic camera looking in –z direction screen resolution n x  n y pixels ( –1,–1)  (0,0) clip space: (1,1)  (n x ,n y ) ( ) ( x y ) screen (1,1,1) z space n x n y (–1,–1,–1) 5 Werner Purgathofer 3

  4. Viewport Transformation (2) can be done with the matrix x screen n x /2 0 n x /2 x ( –1,–1)  (0,0) y screen = 0 n y /2 n y /2 y · (1,1)  (n x ,n y ) ( ) ( x y ) 1 1 0 0 0 0 1 1 1 1 this ignores the z-coordinate, but… Viewport Transformation (3) … we will need z later to remove hidden parts of the image, so we add a row and a column to keep z : to keep z : x screen n x /2 0 n x /2 x 0 y screen 0 n y /2 n y /2 y = 0 · z 0 0 1 0 z 0 0 1 0 1 0 0 1 1 0 M vp 4

  5. Projection Transformation (1 1 1) (1,1,1) (r,t,n) z z (l,b,f) (–1,–1,–1) From Object Space to Screen Space modeling camera transformation transformation object space world space camera space projection viewport viewport transformation transformation transformation screen space clip space 9 Werner Purgathofer 5

  6. Parallel Projection (Orthographic Projection) top side front 3 parallel-projection views of an object, showing relative proportions object, showing relative proportions from different viewing positions 10 Werner Purgathofer Parallel vs. Perspective Projection 11 Werner Purgathofer 6

  7. For Now: Parallel (Orthographic) Projection modeling camera transformation transformation object space world space camera space projection transformation transformation viewport viewport transformation screen space clip space 12 Werner Purgathofer For Now: Parallel (Orthographic) Projection modeling camera transformation transformation object space world space camera space projection viewport viewport transformation transformation transformation screen space clip space 13 Werner Purgathofer 7

  8. Projection Transformation (Orthographic) assumption: scene in box [ L,R]  [B,T]  [F,N] orthographic camera looking in –z direction transformation to clip space ( L,B,F)  (–1,–1,–1) (R,T,N)  (1,1,1) orthographic view volume clip space: in camera space: (1,1,1) (R,T,N) z z (L,B,F) (–1,–1,–1) 14 Werner Purgathofer Projection Transformation (Orthographic) ( L,B,F)  (–1,–1,–1) (R,T,N)  (1,1,1) 2 R + L 0 0 – R – L R – L 2 T + B 0 0 – T – B T – B M orth = 2 N + F 0 0 0 0 – N N – F F N N – F F 0 0 0 1 15 Werner Purgathofer 8

  9. Parallel Projection (1) viewing plane viewing plane –g –g orthographic oblique projection projection projection projection orientation of the projection vector –g 16 Werner Purgathofer Camera Transformation 9

  10. For Now: Parallel (Orthographic) Projection modeling camera transformation transformation object space world space camera space projection transformation transformation viewport viewport transformation screen space clip space 18 Werner Purgathofer Viewing: Projection Plane display plane coordinate reference for obtaining a selected view of a 3D scene 19 Werner Purgathofer 10

  11. Viewing: Camera Definition similar to taking a photograph involves selection of camera position p camera direction camera orientation “window” (aperture) of camera world coordinates coordinates camera coordinates 20 Werner Purgathofer Viewing: Camera Transformation (1) view reference point origin of camera coordinate system camera position or look-at point right-handed u camera-coordinate v y system, w with axes u, v, w, relative to world- e coordinate scene o x z 21 Werner Purgathofer 11

  12. Viewing: Camera Transformation (2) e … eye position g … gaze direction (positive w axis points to the viewer) (positive w -axis points to the viewer) t … view-up vector w = – g v u t  g  w t  w u =  t  w  e g v = w  u 22 Werner Purgathofer Viewing: Camera Transformation (3) u v y y y w u u e v v u o o w e x x x w z z z M cam = R z · R y · R x ·T M R R R T aligning viewing system with world-coordinate axes using translate-rotate transformations 23 Werner Purgathofer 12

  13. For Now: Parallel (Orthographic) Projection modeling camera transformation transformation object space world space camera space projection transformation transformation viewport viewport transformation screen space clip space 24 Werner Purgathofer Viewing: Camera + Projection + Viewport x screen x y screen y = M vp · M orth · M cam · ( ( ) ) z z vp orth cam z z 1 1 pixels on world coordinates the screen the screen 25 Werner Purgathofer 13

  14. For Now: Parallel (Orthographic) Projection modeling camera transformation transformation object space world space camera space projection transformation transformation viewport viewport transformation screen space clip space 26 Werner Purgathofer Perspective Projection 14

  15. Perspective Projection 28 Werner Purgathofer Perspective Projection 29 Werner Purgathofer 15

  16. Perspective Projection y projection projection reference point z view plane x perspective projection of equal-sized objects at different distances from the view plane 30 Werner Purgathofer Parallel vs. Perspective Projection parallel projection: preserves relative l ti proportions & perspective projection: parallel features center of projection, (affine transform.) realistic views 31 Werner Purgathofer 16

  17. Perspective Transform T T O N F B B 32 Werner Purgathofer Perspective Transformation (1) view plane y y y p O f z f f … focal length f focal length y p = y z 33 Werner Purgathofer 17

  18. Perspective Transformation (2) view plane (z=N) y y (z=0) y p O f N z f N N 0 0 0 y p = y z 0 N 0 0 = P analogous: 0 0 N+F –F · N d N x p = x 0 0 1 0 z 34 Werner Purgathofer Perspective Transformation (3) x x · N N 0 0 0 y y · N 0 N 0 0 P = 0 0 N+F –F · N · = z z z (N+F) –F N z · (N+F) F · N 0 0 N+F F N 1 z 0 0 1 0 homogenization: divide by z N x·N/z x·N/z y p = y z y·N/z ~> N (N+F) –F·N/z x p = x 1 z 35 Werner Purgathofer 18

  19. Example: Right Top Near Corner R R · N R N 0 0 0 T T · N T 0 N 0 0 · = N · (N+F) F · N ~> N N N (N+F) –F N N N 0 0 0 N+F –F · N 0 N+F F N 1 N 1 0 0 1 0 view plane x (B or T or L or R) O N F 36 Werner Purgathofer Example: Right Top Near Corner L · F/N L · F L N 0 0 0 B · F/N B · F B 0 N 0 0 · = F · (N+F) F · N ~> F F F (N+F) –F N F F 0 0 0 N+F –F · N 0 N+F F N 1 F 1 0 0 1 0 view plane x·F/N x (B or T or L or R) O N F 37 Werner Purgathofer 19

  20. Perspective Transform T T O N F B B 38 Werner Purgathofer Nonlinear z-Behaviour 39 Werner Purgathofer 20

  21. Nonlinear z-Behaviour 40 Werner Purgathofer From Object Space to Screen Space modeling camera transformation transformation object space world space camera space projection viewport viewport transformation transformation transformation screen space clip space 41 Werner Purgathofer 21

  22. Viewing: Camera + Projection + Viewport M per x screen x y screen y ( ( ) ) = M vp · M orth · P · M cam · z´ z z z vp orth cam 1 1 pixels on world coordinates the screen the screen 42 Werner Purgathofer From Object Space to Screen Space modeling camera transformation transformation object space world space camera space projection viewport viewport transformation transformation transformation screen space clip space 43 Werner Purgathofer 22

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend