unity camera - kent

23
1 Synthetic Camera Model center of projection image plane projector p projection of p Image formed on the back of the camara Image plane moved in front of the camera

Upload: others

Post on 12-Nov-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Unity Camera - Kent

1

Synthetic Camera Model

center of projection

image plane

projector

p

projection of p

Image formed on the back of the camara

Image plane moved in front of the camera

Page 2: Unity Camera - Kent

2

Orthogonal Projection

Default projection is orthogonal

clipped out

z=0

2

(0,0,-1)

Page 3: Unity Camera - Kent

3

Moving Camera back

frames after translation by –d d > 0

Page 4: Unity Camera - Kent

4

LookAt

glLookAt(eyex, eyey, eyez, atx, aty, atz, upx, upy, upz)

Page 5: Unity Camera - Kent

5

Orthogonal Viewing

near and far measured from camera

Page 6: Unity Camera - Kent

6

Projection Projection: from 3D objects to 2D image

Perspective projections: all projectors meet at the center of projection

Parallel (orthogonal) projection: projectors are parallel, center of projection is replaced by a direction of projection

Page 7: Unity Camera - Kent

7

Clipping

Just as a real camera cannot “see” the whole world, the virtual camera can only see part of the world or object space Objects that are not within this view

volume are said to be clipped out of the scene

Page 8: Unity Camera - Kent

8

Camera Specification

Six degrees of freedom Position of center of lens (COP) Orientation

Lens – focal length Film size (h,w) Orientation of film plane

Page 9: Unity Camera - Kent

9

PerspectiveFrustum: a truncated pyramid

Page 10: Unity Camera - Kent

10

Using Field of View

fovy – angle in up directionaspect = w/h

front plane

Page 11: Unity Camera - Kent

11

Moving the Camera

Page 12: Unity Camera - Kent

12

Transformations

Introduce standard transformations Rotation Translation Scaling Shear

Derive homogeneous coordinate transformation matrices

Learn to build arbitrary transformation matrices from simple transformations

Objectives

Page 13: Unity Camera - Kent

13

3D Rotations.

Page 14: Unity Camera - Kent

14

Scene Graph

In unity each object has a transformation and can include other objects and meshes. Together these produce the scene graph for the scene.

Page 15: Unity Camera - Kent

15

Texture Mapping

s

t

x

y

z

image

geometry screen

Page 16: Unity Camera - Kent

16

Texture Mapping

Page 17: Unity Camera - Kent

17

Texture Example

The texture (below) is a 256 x 256 image that has been mapped to a rectangular polygon which is viewed in perspective

Page 18: Unity Camera - Kent

18

Texture Mapping and the OpenGL Pipeline

geometry pipelinevertices

pixel pipelineimage

rasterizer

Images and geometry flow through separate pipelines that join at the rasterizer “complex” textures do not affect geometric

complexity

Page 19: Unity Camera - Kent

19

Define a texture image from an array of texels (texture elements) in CPU memory Glubyte my_texels[512][512];

Define as any other pixel map Scan Via application code

Enable texture mapping glEnable(GL_TEXTURE_2D) OpenGL supports 1-4 dimensional texture

maps

Specify Texture Image

Page 20: Unity Camera - Kent

20

Based on parametric texture coordinates

s

t1, 1

0, 1

0, 0 1, 0

(s, t) = (0.2, 0.8)

(0.4, 0.2)

(0.8, 0.4)

A

B C

a

bc

Texture Space Object Space

Mapping a Texture

Page 21: Unity Camera - Kent

21

Example-Planet Earth

Page 22: Unity Camera - Kent

22

Planet Earth-Picture

Page 23: Unity Camera - Kent

23

Planet Earth-Wire Frame