unity camera - kent

Post on 12-Nov-2021

1 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

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

2

Orthogonal Projection

Default projection is orthogonal

clipped out

z=0

2

(0,0,-1)

3

Moving Camera back

frames after translation by –d d > 0

4

LookAt

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

5

Orthogonal Viewing

near and far measured from camera

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

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

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

9

PerspectiveFrustum: a truncated pyramid

10

Using Field of View

fovy – angle in up directionaspect = w/h

front plane

11

Moving the Camera

12

Transformations

Introduce standard transformations Rotation Translation Scaling Shear

Derive homogeneous coordinate transformation matrices

Learn to build arbitrary transformation matrices from simple transformations

Objectives

13

3D Rotations.

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.

15

Texture Mapping

s

t

x

y

z

image

geometry screen

16

Texture Mapping

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

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

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

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

21

Example-Planet Earth

22

Planet Earth-Picture

23

Planet Earth-Wire Frame

top related