May 19th, 2018

Math for Game Programmers – Talks from GDC – Notes

GDC 2015 – Math for Game Programmers: Fast and Funky 1D Nonlinear Transformations

Presenter: Squirrel Eiserloh

Youtube link to presentation

Notes:

  • Other names used for these concepts in other fields:
    • Easing functions
    • Filter functions
    • Lerping functions
    • Tweening functions
  • Implicit vs. Parametric Equations
    • Implicit: Ex. x^2 + y^2 = R^2
    • Parametric: Ex. Px = R * cos(2*pi*t); Py = R * sin(2*pi*t)
  • Parametric Equations use a single variable (usually a float) as input
  • Opportunities to Use Parametric Transformations
    • Anywhere you have a single float to change
    • Anywhere that could be expressed as a single float
    • Anytime you use time
  • The two most important number ranges in mathematics and computer science are:
    • 0 to 1: Good for fractions and percentages
    • -1 to 1: Good for deviations from some original value
  • These functions are normalized
    • Input of 0 has output of 0, and input of 1 has output of 1
    • The in-between values are those that vary function to function
  • Types of functions
    • Smooth Start: exponential functions with various orders
    • Ex: t^2
    • Smooth Stop: gives opposite feel of smooth start
    • Ex: 1 – (1-t)^2
    • Mix functions
    • Crossfade: mix but “blend weight” is the t parameter itself
    • Scale: multiply something by t; can also multiply functions together
    • Bezier Curves
Other suggested talks:

Juice it or Lose it – by: Martin Jonasson and Petri Purho
The art of screen shake – by: jan willem Nijman vlambeer

Math for Game Programmers – Talks from GDC – Notes

GDC 2013 – Math for Game Programmers: Interaction With 3D Geometry

Presenter: Stan Melax

Youtube link to presentation

Notes:

  • Basic Vector Math
    • Dot product
    • Cross product
    • Outer product
    • Jacobian
    • Determinants
  • Geometry Building Blocks
    • Traingles and planes
    • In games, triangles and planes need to know above and below
    • Triangles use normals
    • Planes use Ax + By + Cz + D == 0
  • Ray-Triangle Intersections
  • Ray-Mesh Intersection
    • Could check against all triangles, but there are ways to remove some for efficiency
    • Need to check if you’ve hit the nearest triangle
    • Mesh must be intact, can have issues if there are holes
  • Convex Mesh
    • Neighboring face normals tilt away
    • Volume bounded by number of planes
    • Every vertex lies at/below every other face
    • Convex used because it makes a lot of tests/calculations simpler
    • If point lies under every plane, it is inside
    • Can move rays as they intersect triangles
  • Convex Hulls
    • Techniques for converting meshes into convex meshes
    • There are two main techniques:
    • Expand Outward – start with small mesh and expand out until all vertices are accounted for
    • Reduce Inward – start with a large mesh and shrink it down to fit all vertices
  • Convex Decomposition: breaking down complex shapes into separate convex meshes
  • Objects in Motion – Spatial Properties
    • Find the center of triangles, then the center of tetrahedrons
    • Find the area of triangles and the volumes of tetrahedrons
    • These properties can be used for basic accurate physics simulations of objects
  • Time Integration without Numerical Drift
    • Forward Euler update versus Runge Kutta update
    • Forward Euler applies derivative at every step, which can give inaccurate results in too large of time steps
    • Runge Kutta looks at multiple time steps and their derivatives and takes a weighted average to make steps more consistent
  • Soft Body Meshes
    • Connect points/vertices of mesh with spring-like connections
    • Two main techniques:
    • Kinematic: can have issues with stressed state oscillating as it will not come to rest, forces continue to act
    • Dynamic: has better resting stressed states that will settle down
  • How to learn more
    • Practice tinkering with your own physics engine code
    • Write gjk algorithm
    • Help understand physics engines and their limitations