UW EXTENSION CERTIFICATE PROGRAM IN GAME DEVELOPMENT 2 ND QUARTER: ADVANCED GRAPHICS Advanced Math.

Slides:



Advertisements
Similar presentations
Today Composing transformations 3D Transformations
Advertisements

Animation in Video Games presented by Jason Gregory
Rigid Body Dynamics Jim Van Verth
Manipulator Dynamics Amirkabir University of Technology Computer Engineering & Information Technology Department.
Animation Following “Advanced Animation and Rendering Techniques” (chapter 15+16) By Agata Przybyszewska.
Chris Hall Aerospace and Ocean Engineering
Computer graphics & visualization Key frame Interpolation.
1 Geometrical Transformation 2 Outline General Transform 3D Objects Quaternion & 3D Track Ball.
Computer Graphics Recitation 2. 2 The plan today Learn about rotations in 2D and 3D. Representing rotations by quaternions.
Chapter 4.1 Mathematical Concepts. 2 Applied Trigonometry Trigonometric functions Defined using right triangle  x y h.
Game Physics Chris Miles. The Goal To learn how to create game objects with realistic physics models To learn how to simulate aspects of reality in order.
3D Coordinate Systems and Transformations Revision 1
3D orientation.
Basic Math Vectors and Scalars Addition/Subtraction of Vectors Unit Vectors Dot Product.
CSCE 689: Computer Animation Rotation Representation and Interpolation
CSCE 441: Computer Graphics Rotation Representation and Interpolation
CSCE 641: Computer Graphics Rotation Representation and Interpolation Jinxiang Chai.
Math for CSLecture 11 Mathematical Methods for Computer Science Lecture 1.
Math for CSLecture 11 Mathematical Methods for Computer Science Lecture 1.
Math for CSTutorial 11 Matrix Multiplication Rule Matrices make linear transformations of vectors.
Orientations Goal: –Convenient representation of orientation of objects & characters in a scene Applications to: – inverse kinematics –rigid body simulation.
3D Graphics Goal: To produce 2D images of a mathematically described 3D environment Issues: –Describing the environment: Modeling (mostly later) –Computing.
MATH – High School Common Core Vs Kansas Standards.
2IV60 Computer Graphics Basic Math for CG
Chapter 5.2 Character Animation. CS Overview Fundamental Concepts Animation Storage Playing Animations Blending Animations Motion Extraction Mesh.
Visualizing Orientation using Quaternions Gideon Ariel; Rudolf Buijs; Ann Penny; Sun Chung.
Rotations and Translations
Mathematical Topics Review of some concepts:  trigonometry  aliasing  coordinate systems  homogeneous coordinates  matrices, quaternions.
CS 450: COMPUTER GRAPHICS QUATERNIONS SPRING 2015 DR. MICHAEL J. REALE.
Physics Midterm Review Terms - Measurements time elapsed = duration of an event – there is a beginning, a middle, and an end to any event. distance.
This Week Week Topic Week 1 Week 2 Week 3 Week 4 Week 5
1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 13, 2002 Day 16.
Geometric Transforms Changing coordinate systems.
CSCE 552 Spring 2011 Math By Jijun Tang. Layered.
Rotations and Translations
UW EXTENSION CERTIFICATE PROGRAM IN GAME DEVELOPMENT 2 ND QUARTER: ADVANCED GRAPHICS D3DX introduction and math.
Week 5 - Wednesday.  What did we talk about last time?  Project 2  Normal transforms  Euler angles  Quaternions.
Rick Parent - CIS681 ORIENTATION Use Quaternions Interpolating rotations is difficult.
Maths and Technologies for Games Quaternions CO3303 Week 1.
1 CS 430/536 Computer Graphics I 3D Transformations World Window to Viewport Transformation Week 2, Lecture 4 David Breen, William Regli and Maxim Peysakhov.
UW EXTENSION CERTIFICATE PROGRAM IN GAME DEVELOPMENT 2 ND QUARTER: ADVANCED GRAPHICS The Geometry Pipeline.
Advanced Computer Graphics Spring 2014
1 Fundamentals of Robotics Linking perception to action 2. Motion of Rigid Bodies 南台科技大學電機工程系謝銘原.
Animating Rotations and Using Quaternions. What We’ll Talk About Animating Translation Animating 2D Rotation Euler Angle representation 3D Angle problems.
Maths & Technologies for Games Animation: Practicalities CO3303 Week 3.
Rotation and Orientation: Fundamentals Jehee Lee Seoul National University.
CGDD 4003 THE MATH LECTURE (BOILED DOWN, YET LIGHTLY SALTED)
CS 551/651 Advanced Graphics Arc Length. Assignment 1 Due Week from Thursday Building a Cubic Bézier curve OpenGL/Glut Insert up to 100 points Render.
COMPUTER GRAPHICS CS 482 – FALL 2015 SEPTEMBER 17, 2015 TRANSFORMATIONS AFFINE TRANSFORMATIONS QUATERNIONS.
UW EXTENSION CERTIFICATE PROGRAM IN GAME DEVELOPMENT 2 ND QUARTER: ADVANCED GRAPHICS Math Review.
Integration for physically based animation CSE 3541 Matt Boggus.
Comparing Two Motions Jehee Lee Seoul National University.
Vectors.
Affine Geometry.
Rick Parent - CIS682 Rigid Body Dynamics simulate basic physics of an object subject to forces Keyframing can be tedious - especially to get ‘realism’
Computer Graphics I, Fall 2010 Transformations.
Week 5 - Monday.  What did we talk about last time?  Lines and planes  Trigonometry  Transforms  Affine transforms  Rotation  Scaling  Shearing.
1 Dr. Scott Schaefer Quaternions and Complex Numbers.
CGDD 4003 Character Animation. The Skeletal Hierarchy (aka the “rig”) Based on the concept of bones Each bone has exactly one parent Each bone has a transform.
Numerical Integration for physically based animation
CPSC 641: Computer Graphics Rotation Representation and Interpolation
UW Extension Certificate Program in Game Development 2nd quarter: Advanced Graphics Animation.
COMPUTER GRAPHICS CHAPTERS CS 482 – Fall 2017 TRANSFORMATIONS
CSC4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University Transformations.
Rotational Kinematics
UMBC Graphics for Games
UNIVERSITY OF ILLINOIS AT URBANA-CHAMPAIGN
Game Programming Algorithms and Techniques
Rotation and Orientation: Fundamentals
Presentation transcript:

UW EXTENSION CERTIFICATE PROGRAM IN GAME DEVELOPMENT 2 ND QUARTER: ADVANCED GRAPHICS Advanced Math

Goals 1. Learn more advanced math concepts 2. Review the basic physics formulas

lerp (Linear intERPolation)  Very common operation, appears everywhere  V a = V 0 *(1-a) + V 1 *a  More complex interpolations often expressed using lerps  For example, Bezier curves are composition of lerps  The problem: lerp doesn’t work with matrices  Resulting matrix is not a rotation  It works, sort of, with quaternions  Need to renormalize afterwards  Speed is not constant

Logarithmic space  What’s halfway between a scale of 1 and a scale of 100?  Translation composes by addition: T ab = T a + T b  Standard lerp works (arithmetic weighted average)  But scaling composes by multiplication: S ab = S a * S b  Lerp should be: S a = S 0 (1-a) * S 1 a (geometric weighted average)  Logarithms to the rescue:  S a = exp( log(S 0 ) * (1-a) + log(S 1 ) * a )  Exp and log can be costly, but so can arbitrary powers

Quaternions  4D vectors used to represent rotations  Always normalized! Q = [Q X Q Y Q Z Q W ]  Two quaternions Q and –Q represent the same rotation  Addition, subtraction: per-component  Scalar product: multiply all components with scalar  Used for linear interpolation, renormalize afterwards  Quaternion product  Follows a pattern similar to complex number multiplication

Quaternions  Often represented as vector and scalar: Q = [Q V Q W ] Q V = [Q X Q Y Q Z ]  Concatenate quaternions: Q 12 = Q 1 * Q 2  Inverse: Q -1 = [-Q V Q W ] ≈ [Q V -Q W ]  Rotate a vertex: V = [V X V Y V Z 0]  Q * V * Q -1  Interpretation: Q W = cos( θ /2) Q V = A * sin( θ /2)  Rotation of θ around axis A  Used because they help make animations smoother

slerp (Spherical LERP)  For rotations, it is done using quaternions  That’s the main reason for their existence, besides the compactness  It is a complex operation:  Extract angle Ω between 4D quaternions  Standard slerp:  Be careful with quaternion duplicity (Q ≈ -Q)  Watch out for math singularities

Quaternion logarithms  Rotations also compose by multiplying  And we do have quaternion logarithms!  Q = [V*sin( θ /2) cos( θ /2)]  log(Q) = [V * θ /2 0]  It can also encode multiple loops  It’s like a 3D rotation “angle”  It can be tricky to use, like angles but worse  log(Q) ≈ log(Q) + K * π  Finding shortest route can be very tricky

Spherical harmonics  It’s like a polynomial, but instead of giving values for values, it gives values for directions  Arbitrary number of coefficients  More coefficients  more detail  Coefficients must be a square: 1, 4, 9, 16, 25, …  Can be rotated by operating on the coefficients  Integrate (average) a function: choose 1 st coefficient  Integrate a product: dot-product of coefficients  Used for lighting

Basic physics  The Newtonian world is continuous  Ballistics: P = P 0 + V 0 * t + A/2 * t 2  We use discrete approximations  Ballistics: P += V * Δ t, V += A * Δ t  We call this “Euler integration”  of the differential equations:  V = P ′, A = P ″  The acceleration changes between frames  A(P, V, t), works well with Euler integration P = position P 0 = initial position V = velocity V 0 = initial velocity A = acceleration t = elapsed time Δ t = time step

Force fields  Acceleration basically same as force  F(P, V, t) = m * A(P, V, t), but the mass is typically constant  Constant force (gravity): A = 9.8 m/s 2, F = m * A  Position-dependent force (spring): F = K * (C - P)  C = spring’s resting position  Velocity-dependent force (drag): F = -K * V 2  Time-dependent force (wind): F = F(t)

Midpoint integration  Euler integration isn’t very precise  It can diverge and misbehave  Midpoint is simple and can behave better:  P += V * Δ t + A * Δ t/2, V += A * Δ t  Perfect results for ballistic trajectories P = position P 0 = initial position V = velocity V 0 = initial velocity A = acceleration t = elapsed time Δ t = time step midpointEuler

Runge-Kutta integration  It’s more complex but better behaved  P += V k * Δ t, V += A k * Δ t  V k = (V a + 2 * V b + 2 * V c + V d ) / 6  A k = (A a + 2 * A b + 2 * A c + A d ) / 6  Where:  P a = P, V a = V, A a = A(P a, V a, t)  P b = P + V a * Δ t/2, V b = V + A a * Δ t/2, A b = A(P b, V b, t + Δ t/2)  P c = P + V b * Δ t/2, V c = V + A b * Δ t/2, A c = A(P c, V c, t + Δ t/2)  P d = P + V c * Δ t, V d = V + A c * Δ t, A d = A(P d, V d, t + Δ t) P = position P 0 = initial position V = velocity V 0 = initial velocity A = acceleration t = elapsed time Δ t = time step