Transformation Pipeline

0.0(0)
studied byStudied by 0 people
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/36

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

37 Terms

1
New cards

Why do we use triangles so much in polygon models/meshes?

Because they are always flat!

2
New cards

What is a 3D scene?

A set of 3D models, each modeled on their own independent coordinate system (local coordinate system) but, to support rendering, and transformed under the same “world” coordinate system.

3
New cards

What are transformations?

Mathematical operations used to project geometry from one space to another.

4
New cards

What is the transformation pipeline?

  • Local Space

    • Model Transform

  • World Space

    • View Transform

  • View Space

    • Projection Transform

  • Clip Space

    • Perspective Divide

  • NDC

    • Viewport Transform

  • Pixel Coordinates on Screen

5
New cards

What is the local space?

A coordinate system for each object.

6
New cards

What is the world space?

A coordinate system for all objects in a scene.

7
New cards

What is a model transform?

The object does not move, but the transform assigns coordinates that are shared by all objects (the world coordinates) to each object. This reduces complication in 3D scene construction.

8
New cards

What is the model transform in WebGl context?

Transforms like rotate(), translate() and scale(), which move objects in local space before placing them in world space.

9
New cards

In what order should you write these?

setIdentity()
scale
rotate
translate
So that scale and rotate are operations done in local space not world space.

10
New cards

What does modelMatrix.rotate(?, ?, ?, ?) do?

It takes arguments in the format (angle, x, y, z), the coordinates being the axis around which to rotate - with (angle, 0, 1, 0) being the y-axis for instance - and the angle being the number of degrees by which to rotate.

11
New cards

What does modelMatrix.translate(?, ?, ?) do?

It takes arguments in the format (tx, ty, tz) where these represent how far to move the object along the x, y, and z axis.

12
New cards

What does modelMatrix.scale(?, ?, ?) do?

It takes arguments in the format (sx, sy, sz) where these represent the scaling factors for each axis. A scaling factor greater than 1 for one side and not the others will stretch that side, and smaller will flatten that side.

13
New cards

What will modelMatrix.scale(-1.0, 1.0, 1.0) do?

Mirror the object along the X axis.

14
New cards

We should do model transforms in the following order:

setX, then whatever other functions you wish to do. This is because we don’t want to overwrite the modelMatrix over and over again.

15
New cards

What is the view space?

A coordinate system centered around the view origin, which is where the virtual camera is located with respect to the world origin.

16
New cards

What is a view transform?

The shifting of the world coordinates origin to the coordinates of the virtual camera, allowing the user to specify from what angle the 3D scene will be viewed at.

17
New cards

What does the view transform look like in terms of WebGl?

The function viewMatrix.setLookAt.

18
New cards

What are the arguements of setLookAt? There are 9!

eye x, eye y, eye z - Where the camera is in world space.
centre x, centre y, centre z - the point where the camera is looking in world space.
up x, up y, up z - the up-direction of the camera (basically, an arrow pointing upwards out of the head of the cameraman). This is usually (0, 1, 0).

19
New cards

What is the clip space?

The clip coordinates are the coordinates by which the view frustrum is established, which is the projection type that changes how the perspective is perceived on the 3D scene.

20
New cards

What does a project transform involve?

Establishing the view frustrum, which determines which objects (or parts thereof) will be clipped out and discarded from processing. It defines the 6 clip planes - near, far, top, bottom, right and left.

21
New cards

What are the two view frustrums a projection transform can map?

Perspective projection - where the view frustrum is a trapezoid shape and retains perspective, producing the visible region.

Orthographic projection - where the view frustrum is a cuboid shape and preserves shape properties, producing object appearance.

22
New cards

What does a projection transform look like in WebGL, for perspective projection?

projMatrix.setPerspective

23
New cards

What does a projection transform look like in WebGl for orthographic projection?

projMatrix.setOrtho(left, right, bottom, up, near, far), where each plane is established by the x and y values where those faces are located.

24
New cards

What are the arguments of projMatrix.setPerspective(?, ?, ?, ?)?

(field of view, aspect ratio, distance from virtual camera to near plane, distance from virtual camera to far plane).
These are usually (30, canvas.width/canvas.height, 1, 100).

25
New cards

If you increase the FoV, what will this do to the final rendered image?

You will be looking at a broader, more expansive scene, so objects appear smaller and the frame of the scene wider so you can see more.

26
New cards

What happens to the near plane of the viewing frustrum when you increase FoV?

It gets larger.

27
New cards

The aspect ratio is usually canvas.width/canvas.height. You can adjust the ratio between these by multiplying values to each variable - what happens if you make width > height?

The aspect ratio is greater than one - the canvas is wider than it is tall. The projection “compresses” the y-axis more than the x-axis, so objects appear wider horizontally and compressed vertically.

28
New cards

Which way does the camera usually face (in terms of x, y and z)? This is useful for calculating where the coordinates of the near frustrum actually are.

-z
So if you have established through your setPerspective() that the distance from the virtual camera to the near plane is 1, then z = -1.

29
New cards

What is another name for the near plane?

The projection plane!

30
New cards

What is the equation to find the distance from the virtual camera to the projection plane?

1/tan(FoV/2) x NEAR variable [in .setPerspective (usually 1)] = distance to projection plane

31
New cards

How do we use this to find the coordinates of the projection plane?

distance to projection plane x aspect ratio (1 if 1:1) - top-right coordinate.

32
New cards

If you want to clip out the front-most object in your 3D scene, where should the near/projection plane sit?

It should move beyond the front-most object by 1.

33
New cards

If you want to clip out the back-most object in your 3D scene, where should the far plane sit?

Directly on top of the back-most object.

34
New cards

What are NDCs?

Normalised Device coordinates

35
New cards

How do we find the NDCs?

Perspective divide - By dividing each coordinate by the ‘w’ variable in the vec4(x, y, z, w) data structure used to store information about the coordinate of vertices, specifically defining ‘perspective’.

36
New cards

What do the NDC’s x and y coordinates represent?

The location of vertices of the object on a normalised 2D space.

37
New cards

What is the viewport transform?

After the projection transform, the 3D scene gets squashed into the NDC cube of +1 to -1. The viewport transform then takes these coordinates and maps them to actual pixel coordinates on the canvas.