Video Game Rendering Mathematics - PowerPoint PPT Presentation

1 / 54
About This Presentation
Title:

Video Game Rendering Mathematics

Description:

Break each object up into lots of triangles. Each 'face' is ... an artist. The programmers get. this vertex list and tell the. computer to connect the dots. ... – PowerPoint PPT presentation

Number of Views:25
Avg rating:3.0/5.0
Slides: 55
Provided by: mineco1
Category:

less

Transcript and Presenter's Notes

Title: Video Game Rendering Mathematics


1
Video Game Rendering Mathematics
  • Zack Booth Simpson

2
How to we model a body?
  • Break each object up into lots of triangles.
    Each face is connected to a mesh of vertices
  • Make each part of a body rigid
  • Connect the rigid parts together with joints
  • Let the joints rotate

From unrealtechnology.com
3
Rendering Meshes
  • Each vertex is positioned byan artist. The
    programmers getthis vertex list and tell
    thecomputer to connect the dots.
  • But the vertices are in 3D?!
  • How do we get from a 3D model to a 2D view on the
    screen?
  • Create a virtual camera

4
Pretend Cameras
  • What does the camera see of this box?
  • Two problems to solve
  • Relative position and orientation of the box
    versus the camera
  • The perspective distortion

5
PerspectiveThings further away appear smaller
Create a pretend projection plane that
represents the computer screen
6
Exercise The Perspectometer
7
Answers The Perspectometer
  • The length of the line on the board is 3 feet.
  • The units are feet, because the distance from
    your eye to the board was measured in feet.
  • Note that the length of your arm and the apparent
    height of the line were both measured in inches.

8
Position and Orientation
  • Meet vector
  • From Latin vehere to carry same root as
    vehicle
  • Each object in the world is placed and oriented.
  • Vectors let us get from place to place and orient
    ourselves.

Where are the vertices of the box from the point
of view of the camera? (Never mind perspective
for now)
9
Translate Move without rotate
  • Relative position is easy
  • Vector addition and subtraction!
  • a b - c d
  • d is relative to the camera we sayd is the
    position of the vertex in camera space

10
Rotation
  • Now things get harder
  • From the cameras point of view the box is
    rotated
  • From the boxs point of view the camera is rotated
  • Coping with differing points of view is always a
    challenge!

11
(No Transcript)
12
(No Transcript)
13
(No Transcript)
14
(No Transcript)
15
Whos point of view is right?
16
Both / Neither side is right
  • We need a way to measure each vector using the
    other one as the unit ruler.
  • In other words we need tools to convert from one
    point of view to the other.

17
Projection
  • a/b from bs perspective b/a from as
    perspective
  • Remember alwaysa/b means measure a against
    b orusing b as the ruler, how long is a?
  • It is easy to forget/get confused about this I
    wish a teacher had beaten this into my head with
    a stick!

18
Oh boy, here we go again
19
Projection from different directions
  • Each side can be projected onto the other.

20
  • As a is rotated away from b, the projection
    diminishes until at 90 degrees it is zero
  • Perpendicular vectors can not measure each other
    they have zero relative projections!

21
Projection with Cosine
  • We dont want no stinking cosines theyre a
    pain!
  • Heres a great trick

22
Ever seen this lovely proof of the Pythagorean
theorem?
23
Rectangular Version of the Pythagorean Theorem
Dot product graphic removed pending publication
  • Cool! We can compute the projection with just two
    multiplies and add! Games have millions of
    vertices so this is very important! Considering
    speed is the difference between mathematics and
    computation!

24
Projection with the dot productfrom bs point of
view
  • TADA! p can be computed without angles or
    cosines!

25
More Dot Product Goodness
  • Dot product sign tells you about the relationship
    of the vectors.
  • Same general direction
  • Orthogonal
  • Opposite directions

26
Exercise Dot Products
27
Answers Dot Products
28
Back to Rotations
  • Ok, so now we can project a vector onto another
  • Whats this got to do with rotations again?
  • Represent the cameras POV as aligned vectors.
    Call these basis vectors as in base
  • The projection onto thesevectors gives us the
    rotationwe want! i.e. the boxfrom the POV of
    camera

29
Basis Vector Demo
  • Run demo app
  • Skew, rotation, scale, reflection, projection
  • Orthogonal basis vectors create a rotation or
    reflection

30
The Matrix
  • A cool way to organize basis vectors The Matrix
  • The default basis vectors are one unit in each
    direction.
  • Write each basis vector as a column in the matrix
  • Write a block of numbers but visualize vectors!
  • The matrix encodes any linear transformation

31
The Power of The Matrix
32
The Matrix as a Teleporter
  • The matrix is a teleportation machine which
    moves points from one space to another

33
A Teleporter inside a Teleporter?!
  • What happens if you put a teleporter inside a
    teleporter?
  • Compounding teleportations!

34
Matrix Concatenation
  • Map the basis vectors of one space into the
    another

35
Matrix ConcatenationUsing Dot product
36
Matrix ConcatenationUsing Dot product
37
Matrix ConcatenationUsing Dot product
38
Matrix ConcatenationUsing Dot product
39
Exercise Matrix Arithmetic
40
Answers Matrix Arithmetic
41
Rotate, Scale, and Translate?
  • So now we can rotate, scale, etc. but what ever
    happened to translations?
  • The ugly way
  • Would be nice to matrixify it!

42
Stuffin the Matrix
  • Make up a pretend dimension for the translation
  • Hardwire 1 unit of this extra dimension in all
    vertices to be transformed.
  • Where is this extra dimension exactly?
  • Who cares! It works! Math is so cool

43
Moving to 3D
  • Just add a dimension again.
  • Now matrices are 4x4
  • Right-hand rule

From math.montana.edu
44
Exercise Matrix Transforms
45
Answers Matrix Transformations
46
Game Matrix Mine Sweeper
  • Theres a bomb in a house
  • Theres two rounds
  • You must move the bomb with one of the three
    given matrices in each round
  • You can not go off the map
  • Plan ahead!!

47
Game Matrix Mine Sweeper
  • Theres a bomb in a house
  • Theres two rounds
  • You must move the bomb with one of the three
    given matrices in each round
  • You can not go off the map
  • Plan ahead!!
  • GO!

48
Answers Matrix Mine SweeperRound 1
49
Game Matrix Mine Sweeper
Round 2. GO!!
50
Answers Matrix Mine SweeperRound 2
51
Answers Matrix Mine SweeperBonus Round!!
  • If you are outside a building, youre a hero!

52
Answers Matrix Mine SweeperBonus Round!!
  • If you are outside a building, youre a hero!
  • If you are inside, this is your last chance! You
    are almost dead! Quick! Make up your
    own matrix!
  • You have 20 seconds! GO!

53
BOOM!
From www.prostunts.net
54
A final desperate solution!The zero matrix!
  • Collapse all paths to a singularity!
Write a Comment
User Comments (0)
About PowerShow.com