COMP30019 Graphics and Interaction Perspective & Polygonal - - PowerPoint PPT Presentation

comp30019 graphics and interaction perspective polygonal
SMART_READER_LITE
LIVE PREVIEW

COMP30019 Graphics and Interaction Perspective & Polygonal - - PowerPoint PPT Presentation

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry COMP30019 Graphics and Interaction Perspective & Polygonal Geometry Adrian Pearce Department of Computing and Information


slide-1
SLIDE 1

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

COMP30019 Graphics and Interaction Perspective & Polygonal Geometry

Adrian Pearce

Department of Computing and Information Systems University of Melbourne

The University of Melbourne

Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry

slide-2
SLIDE 2

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

Lecture outline

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry

slide-3
SLIDE 3

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

Perspective geometry

How are three-dimensional objects projected onto two-dimensional images? Aim: understand point-of-view, projective geometry.

Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry

slide-4
SLIDE 4

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

Viewing

Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry

slide-5
SLIDE 5

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

Viewport

Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry

slide-6
SLIDE 6

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

Geometry of image formation

Mapping from 3D space to 2D image surface, moving from a higher dimensional image to a lower dimensional image

◮ The X, Y, Z points in the three dimensional world,

sometimes called voxels, are transformed in to x, y pixels in a two-dimensional image.

◮ More specifically, a mapping from 3D directions, rays of

light, to/from the observer.

Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry

slide-7
SLIDE 7

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

Pinhole Camera

  • bject in

3D scene image of object (upside down) for image (maybe light-tight box pinhole in box light ray from object projection screen translucent waxed paper)

Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry

slide-8
SLIDE 8

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

Perspective geometry

(X,Y,Z) O Z x f X

Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry

slide-9
SLIDE 9

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

Perspective geometry

◮ Basically an abstraction of pin-hole camera. ◮ Look at XOZ plane (same thing happens in YOZ plane). ◮ Actual point in 3D space is (X, Y, Z) ◮ 0 is origin (focal point) or centre of projection. ◮ Z is distance from actual point to origin. ◮ f is focal distance (focal length). ◮ x is the image (upside down) with respect to real world.

Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry

slide-10
SLIDE 10

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

Perspective of virtual camera

Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry

slide-11
SLIDE 11

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

Virtual camera geometry

(X,Y,Z) O Z X f x

Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry

slide-12
SLIDE 12

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

Virtual camera geometry

◮ Image projection surface imagined to be in front of

projection centre.

◮ Geometrically equivalent ◮ Often more convenient to think about projection

Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry

slide-13
SLIDE 13

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

Perspective Formulas

Point P = (X, Y, Z) in 3D space has projection (x, y) in the image where x f = X Z y f = Y Z

  • r

x = Xf Z y = Yf Z f being the “focal distance” (sometimes f is called d). Look at similar triangles in the previous diagram.

Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry

slide-14
SLIDE 14

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

Perspective Formulas

◮ Look at perspective projection diagram to convince

yourself of this — triangles xOf and XOZ have the same proportions.

◮ Rearranging gives equations shown on previous slide. ◮ These formulas apply only for camera-centred

coordinates, for which perspective projection has a particularly simple form.

◮ For arbitrarily centred coordinate systems 3D

transformations are necessary (more on this when we tackle 3D transformations using matrices).

Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry

slide-15
SLIDE 15

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

Centre of projection

Projectors Center of projection Projection plane A' A B (a) Projectors Projection plane A' A B (b) B' B' Center of projection at infinity

(Foley, Figure 6.03) Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry

slide-16
SLIDE 16

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

One point perspective projection

y z x y z x z-axis vanishing point z-axis vanishing point

(Foley, Figure 6.04) Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry

slide-17
SLIDE 17

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

One-point perspective projection

Projection plane normal Center of projection Projection plane z x y

(Foley, Figure 6.05) Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry

slide-18
SLIDE 18

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

“Two-point” perspective

Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry

slide-19
SLIDE 19

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

“Three-point” perspective

Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry

slide-20
SLIDE 20

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

Vanishing points

◮ In 3D, parallel lines meet only at infinity, so the vanishing

point can be thought of as the projection of a point at infinity.

◮ If the set of lines is parallel to one of the three principal

axes, the vanishing point is called an axis vanishing point.

◮ So called “one-point”, “two-point”, and “three-point”

perspectives are just special cases of perspective projection, depending on how image plane lines up with significant planes in scene.

◮ In fact, there are an infinity of vanishing points, one for

each of the infinity of directions in which a line can be

  • riented.

Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry

slide-21
SLIDE 21

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

Perspective of the human eye

Human eye effectively uses a kind of “spherical” projection: Retina is curved, though projection centre (in lens) isn’t at centre of the eyeball (therefore not planar geometric projection).

◮ Doesn’t exactly match perspective projection. ◮ Only a problem for very wide fields of view.

Perspective is basically the right projection for putting a 3D scene onto a flat surface for human viewing.

◮ Other projections are possible for special effects, e.g.

“fish-eye” lens.

Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry

slide-22
SLIDE 22

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

Classes of projection

Subclasses of planar geometric projections

Planar geometric projections Front elevation Side elevation Top (plan) Parallel Perspective Orthographic Oblique One-point Cabinet Cavalier Other Two-point Three-point Axonometric Isometric Other

(Foley, Figures 6.21 & 6.22) Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry

slide-23
SLIDE 23

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

House example

y x (8, 16, 30) (16, 10, 30) (16, 0, 30) (0, 10, 54) (16, 0, 54) z

(Foley, Figure 6.4) Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry

slide-24
SLIDE 24

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

One-point, centred perspective projection example

z v u VUP VRP PRP = (8, 6, 30) DOP n CW Window on view plane VPN y x

(Foley, Figures 6.21 & 6.22) Which of the below is the centre of project in the Figure? Is the view plane inbetween the centre of projection and the house or behind the centre of projection?

VRP (view reference point)

PRP (projection reference point)

VPN (view plane normal)

DOP (direction of projection)

VUP (view-up vector) Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry

slide-25
SLIDE 25

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

Two-point perspective projection example

In a two-point projection of a house, left, the viewplane (defined by the view plane normal, VPN), right, cuts both the z and x axes

y x z v u VPN View plane

(Foley Figures 6.17 and 6.25). Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry

slide-26
SLIDE 26

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

Ortographic (parallel) projection

Parallel projection (also known as orthographic projection) is given by x = X y = Y That is, just drop Z coordinate!

Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry

slide-27
SLIDE 27

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

Perspective Geometry Summary

◮ Perspective geometry is based loosely on the pin-hole

camera model that maps 3D points onto a 2D image plane

◮ The image plane may thought of either behind a focal point

  • r in between a vanishing point and the object.

◮ Computer graphics largely concerns planar geometric

projections, generally perspective projection and sometimes parallel projection for specific applications.

◮ One-point, two-point and three-point projection variants

arise according to how many times the viewplane cuts the axis.

Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry

slide-28
SLIDE 28

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

Perspective Geometry in Unity

Unity tutorials (getting started; perspective in Unity): https://unity3d.com/learn/tutorials Roll-a-Ball tutorial (is excellent) https://unity3d.com/learn/tutorials/projects/ roll-ball-tutorial Github for Unity’s official Roll-a-ball tutorial: https://github.com/nicksuch/Roll-a-ball Unity manual(s): https://docs.unity3d.com/Manual/

Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry

slide-29
SLIDE 29

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

Polygonal geometry

In general a polygon is any plane figure bounded by straight line segments and but can comprise these forms

◮ polygonal arcs (polylines) ◮ polygonal boundaries (closed polylines) ◮ and filled polygons

Polygons are very useful, both in themselves and as building blocks for approximating arbitrary curved arcs and regions.

Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry

slide-30
SLIDE 30

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

Representation

◮ Either as a set of

line segments,

◮ or an ordered

sequence of vertices using absolute or relative coordinates,

◮ Walking order

convention often applies, e.g. anti-clockwise for

  • uter and

clockwise for inner

Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry

slide-31
SLIDE 31

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

Polygon mesh: vertex list

P1 P2 V3 V1 V2 V4

V = (V1, V2, V3, V4) = ((x1, y1, z1), . . . , (x4, y4, z4)) P1 = (1, 2, 4) P2 = (4, 2, 3)

Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry

slide-32
SLIDE 32

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

Polygon mesh: edge list

V = (V1, V2, V3, V4) = ((x1, y1, z1) , … , (x4, y4, z4))

E1 = (V1, V2, P1, l) E2 = (V2, V3, P2, l) E3 = (V3, V4, P2, l) E4 = (V4, V2, P1, P2) E5 = (V4, V1, P1, l) P1 = (E1, E4, E5) P2 = (E2, E3, E4) V1 V2 V3 V4 E5 E3 E2 E1 E4 P1 P2

Polygons represented as line segments, edges can make polygon clipping and scan-line filling operations easier.

Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry

slide-33
SLIDE 33

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

Polygon types

◮ Convex ◮ Concave ◮ Non-simple ◮ Multiple-boundary ◮ Star

Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry

slide-34
SLIDE 34

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

Polygon Properties

◮ In a convex polygon no internal angle is greater than 180

degrees

◮ In a concave polygon there are internal angles that can be

greater than 180 degrees

◮ Concave polygons can be represented as a conjunction of

convex polygons (convex polygons have certain properties that simplify geometric operations and tesselations).

Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry

slide-35
SLIDE 35

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

Level of detail

Example from Stanford University Computer Graphics Lab

Programmer provides several different versions of an object for viewing at different distances. The figures (on the left), at a distance (on the right) they appear very similar (in spite of different numbers of polygons)

(Images from Slater text) Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry

slide-36
SLIDE 36

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

Vertex spit method

(Figure from Slater text) Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry

slide-37
SLIDE 37

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

Example of levels of detail

Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry

slide-38
SLIDE 38

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

Polygonal Geometry Summary

◮ Polygons are one of the most widely used models in

computer graphics and are useful for representing both two-dimensional shapes and three-dimensional objects.

◮ The rendering pipeline facilitates the systematic modelling,

transfmation and rendering of polygons.

◮ Level-of-detail achieves higher performance, by adapting

the number of polygons used.

Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry

slide-39
SLIDE 39

Introduction Perspective Geometry Virtual camera Centre of projection Classes of projection Polygonal geometry

Polygonal geometry in Unity & blender

◮ Unity uses the fbx (filmbox) file format ◮ If you click on models in Unity, it will launch Model Viewer

in Visual Studio

◮ blender is more powerful and general ◮ blender uses the blend, file format ◮ You can import blender models into Unity, which invokes

blenders fbx exporter

Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionPerspective & Polygonal Geometry