Game and animation control flow

Slides:



Advertisements
Similar presentations
CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © 1/16 Deferred Lighting Deferred Lighting – 11/18/2014.
Advertisements

P3- Represent how data flows around a computer system
CS 4363/6353 BASIC RENDERING. THE GRAPHICS PIPELINE OVERVIEW Vertex Processing Coordinate transformations Compute color for each vertex Clipping and Primitive.
Computer Graphics Programming: Matrices and Transformations CSE 3451 Matt Boggus.
INTRODUCTION. Painting with numbers! Aspects Modeling Rendering Animation.
Shading Languages By Markus Kummerer. Markus Kummerer 2 / 19 State of the Art Shading.
Computer-Based Animation. ● To animate something – to bring it to life ● Animation covers all changes that have visual effects – Positon (motion dynamic)
Chapter 1 Pseudocode & Flowcharts
2D Physics and Camera Systems For CSE 3902 By: Matt Boggus.
SE 320 – Introduction to Game Development Lecture 11: Animations and GoKit Lecturer: Gazihan Alankuş Please look at the last slides for assignments (marked.
CMSC 104, Version 9/01 1 The Box Problem: Write an interactive program to compute and display the volume and surface area of a box. The program must also.
Course Overview, Introduction to CG Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, September 5, 2003.
Lesson 1: Intro to Animation
MOMA Display Screens K u r t R a l s k e.
CSE 381 – Advanced Game Programming Basic 3D Graphics
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 5 Working with Images Starting Out with Games & Graphics in.
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 7 The Game Loop and Animation Starting Out with Games & Graphics.
Institute for Visualization and Perception Research 1 © Copyright 2000 Haim Levkowitz Introduction (Foley & Van Dam Ch 1) Uses of computer graphics … Some.
CSE Real Time Rendering Week 2. Graphics Processing 2.
1 Computer Graphics Week2 –Creating a Picture. Steps for creating a picture Creating a model Perform necessary transformation Lighting and rendering the.
Advanced Computer Graphics Advanced Shaders CO2409 Computer Graphics Week 16.
2 COEN Computer Graphics I Evening’s Goals n Discuss application bottleneck determination n Discuss various optimizations for making programs execute.
Computer Graphics Chapter 6 Andreas Savva. 2 Interactive Graphics Graphics provides one of the most natural means of communicating with a computer. Interactive.
1 Perception and VR MONT 104S, Fall 2008 Lecture 21 More Graphics for VR.
Control flow for interactive applications CSE 3541 Matt Boggus.
BY CASEY KUCERA Multimedia. Vector Graphics Composed of objects not pixels Object oriented graphics = vector graphics Stores a series of mathematical.
Reference: The Game Loop Animation / Game loop 1. Update variables 2. [Get input from the user] (GameLoop only) 3. Draw (using variables)
CIS 3.5 Lecture 2.2 More programming with "Processing"
Digital Media Dr. Jim Rowan ITEC 2110 Vector Graphics II.
11 General Game Programming Approach. The program is event-driven The program is event-driven –Messages = events –So as all windows system (for example.
CISC 110 Day 3 Introduction to Computer Graphics.
G RAPHICS & I NTERACTIVE P ROGRAMMING Lecture 2 More Programming with Processing.
Fall UI Design and Implementation1 Lecture 13: Animation.
Over the recent years, computer vision has started to play a significant role in the Human Computer Interaction (HCI). With efficient object tracking.
Numerical Integration for physically based animation
Crowds (and research in computer animation and games)
CPT 450 Computer Graphics 12th Lecture – Animation.
Sprites (Images) and Sounds
Reading and Writing Image Files
2D Physics and Camera Systems
Additional Design Patterns for Games
Character Animation Forward and Inverse Kinematics
Part II Reference:
PYGAME.
8. Installing Pygame
Image Segmentation Classify pixels into groups having similar characteristics.
Deferred Lighting.
The Graphics Rendering Pipeline
CS451Real-time Rendering Pipeline
TerraForm3D Plasma Works 3D Engine & USGS Terrain Modeler
Programming Interface Overview
Game and animation control flow
GUIs and Events CSE 3541/5541 Matt Boggus.
Introduction to Object-Oriented Programming
Numerical integration for physically based animation
Crowds (and research in computer animation and games)
Chapter 11-Business and Technology
Updating an Animated Scene
Representing Images 2.6 – Data Representation.
Procedural Animation Introduction to Procedural Methods in 3D Computer Animation Dr. Midori Kitagawa.
8. Starting Pygame Let's Learn Python and Pygame
2.02C Frame-by-Frame Computer Animation Using PowerPoint
More programming with "Processing"
Chapter I Introduction
Rendering – Basic Concepts
Computer Graphics Lecture 15.
Chapter 7 The Game Loop and Animation
Presentation transcript:

Game and animation control flow CSE 3541 Matt Boggus

Overview Pseudocode for a game/animation loop Undo/redo example Tradeoff in saving cause vs. effect Unity transform and hierarchy computations as saving the effect

Game/Animation loop main(){ Initialize(); while(true){ DrawScene(); HandleEvents(); Update(); }

Draw() and HandleEvents() Draw() handled by Unity Types of events I/O Timers Scripted events Network message

Initialize frame time Scene/Hierarchy objects Initially 0, increases by 1 every time the scene is drawn time Initially 0, increases by dt (a.k.a. timestep, Δt) every update Units might be seconds, minutes, or days, etc. Unity Time and Framerate Management Scene/Hierarchy objects Geometric objects Lights Camera

Update() P’(time+dt) = P(time) + Displacement(dt) Displacement(dt) is the change in position over the amount of time, dt, passing Can have similar equation for change in orientation How is Displacement(dt) calculated? Real-time user input Physics Behavior Key-frame data / Interpolation (Motion capture – save positions at each frame instead of computing displacement)

Time control or frame selection Braid (2008) Autodesk MotionBuilder Image from http://www.mobygames.com/game/xbox360/braid/screenshots/ Image from http://www.autodesk.com/products/motionbuilder/overview

Two approaches P(time-dt) = P’(time) - Displacement(dt) Save the cause (of the position change): Displacement(dt) Save the effect or result (of the position change) P’(time)

Timeline control – undo/redo of drawing shapes Ex: see MSPaint Removes the last drawn shape Replace removed shapes, unless a new one is drawn

Undo/Redo – two options Save the cause (the data to draw each shape) Which shape? Starting mouse (x, y) Ending mouse (x, y) Save the effect (the image after drawing the new shape) Image width * image height pixels Each pixel has a red, green, and blue value

Undo/Redo – two options Save the cause (of each drawn shape) Algorithm: to undo, clear the background and redraw shapes Storage cost: 5 ints per shape Save the effect (image after each shape is drawn) Algorithm: to undo, revert to previous image Storage cost: x * y * 3 ints per shape

Tie-in with hierarchical scenes in Unity Storing the result of a series of geometric transformations in an object’s transform is comparable to “saving the effect” Image from https://www.packtpub.com/books/content/unity-3-0-enter-third-dimension

Additional slides

draw_scene() Input: 3D scene + camera Output: 2D image When to redraw? Camera change [1] Object in view moves [1] Every frame [2] Every xth frame [3] [1] if(flag_set){ draw(); flag_set = false; } [2] [3] counter = (counter + 1)%draw_rate; if(counter == 0)

Graphics pipeline