Control flow for interactive applications CSE 3541 Matt Boggus.

Slides:



Advertisements
Similar presentations
Graphics Pipeline.
Advertisements

CS 4363/6353 BASIC RENDERING. THE GRAPHICS PIPELINE OVERVIEW Vertex Processing Coordinate transformations Compute color for each vertex Clipping and Primitive.
Computer Graphic Creator: Mohsen Asghari Session 2 Fall 2014.
Computer Graphics Programming: Matrices and Transformations CSE 3451 Matt Boggus.
INTRODUCTION. Painting with numbers! Aspects Modeling Rendering Animation.
MAT 594CM S2010Fundamentals of Spatial ComputingAngus Forbes Overview Today: - Make sure everyone is set up with an OpenGL environment - OpenGL basics:
1 3D modelling with OpenGL Brian Farrimond Robina Hetherington.
IAT 3551 Computer Graphics Overview Color Displays Drawing Pipeline.
Graphics Systems I-Chen Lin’s CG slides, Doug James’s CG slides Angel, Interactive Computer Graphics, Chap 1 Introduction to Graphics Pipeline.
Informationsteknologi Tuesday, November 6, 2007Computer Graphics - Class 41 Today’s class Input and interaction.
3D Rendering with JOGL Introduction to Java OpenGL Graphic Library By Ricardo Veguilla
19/4/ :32 Graphics II Syllabus Selection and Picking Session 1.
COMP 261 Lecture 14 3D Graphics 2 of 2. Doing better than 3x3? Translation, scaling, rotation are different. Awkward to combine them. Use homogeneous.
Basic Graphics Concepts Day One CSCI 440. Terminology object - the thing being modeled image - view of object(s) on the screen frame buffer - memory that.
COMP SCI 352 Computer Graphics and Animation. Computer Graphics2 My name is … My name is … How to find me How to find me Course Policies Course Policies.
CSE 381 – Advanced Game Programming Basic 3D Graphics
I-1 Steps of Image Generation –Create a model of the objects –Create a model for the illumination of the objects –Create an image (render) the result I.
Week 2 - Wednesday CS361.
Geometric transformations The Pipeline
Computer Graphics An Introduction. What’s this course all about? 06/10/2015 Lecture 1 2 We will cover… Graphics programming and algorithms Graphics data.
Computer Graphics. Requirements Prerequisites Prerequisites CS 255 : Data Structures CS 255 : Data Structures Math 253 Math 253 Experience with C Programming.
C O M P U T E R G R A P H I C S Guoying Zhao 1 / 14 C O M P U T E R G R A P H I C S Guoying Zhao 1 / 14 Going-through.
CS 450: COMPUTER GRAPHICS REVIEW: INTRODUCTION TO COMPUTER GRAPHICS – PART 2 SPRING 2015 DR. MICHAEL J. REALE.
Graphics Systems and OpenGL. Business of Generating Images Images are made up of pixels.
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.
OpenGL Conclusions OpenGL Programming and Reference Guides, other sources CSCI 6360/4360.
Rendering Overview CSE 3541 Matt Boggus. Rendering Algorithmically generating a 2D image from 3D models Raster graphics.
Lecture 6: 3D graphics Concepts 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 718,  ex 2271 
1 Computer Graphics Week2 –Creating a Picture. Steps for creating a picture Creating a model Perform necessary transformation Lighting and rendering the.
COMPUTER GRAPHICS CSCI 375. What do I need to know?  Familiarity with  Trigonometry  Analytic geometry  Linear algebra  Data structures  OOP.
2 COEN Computer Graphics I Evening’s Goals n Discuss application bottleneck determination n Discuss various optimizations for making programs execute.
2008/9/24 Kim, HyungSeok. HyungSeok Kim, Konkuk University Part I: Framework – 1. Windows creation – 2. Renderer – 3. Lights and Objects/Model loading.
Jul 25, 2014IAT 3551 Scene Graphs.  A data structure that stores information about a graphics scene –Each node has information that structures the interpretation.
Computer Graphics Chapter 6 Andreas Savva. 2 Interactive Graphics Graphics provides one of the most natural means of communicating with a computer. Interactive.
Introduction to Processing. 2 What is processing? A simple programming environment that was created to make it easier to develop visually oriented applications.
1 Perception and VR MONT 104S, Fall 2008 Lecture 21 More Graphics for VR.
Introduction to OpenGL  OpenGL is a graphics API  Software library  Layer between programmer and graphics hardware (and software)  OpenGL can fit in.
Program 2 due 02/01  Be sure to document your program  program level doc  your name  what the program does  each function  describe the arguments.
1 A first OpenGL program Brian Farrimond Robina Hetherington.
Jens Krüger & Polina Kondratieva – Computer Graphics and Visualization Group computer graphics & visualization 3D Rendering Praktikum: Shader Gallery The.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
11 General Game Programming Approach. The program is event-driven The program is event-driven –Messages = events –So as all windows system (for example.
CSE 381 – Advanced Game Programming GLSL. Rendering Revisited.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Chapters 5 2 March Classical & Computer Viewing Same elements –objects –viewer –projectors –projection plane.
Geometric Objects and Transformations. Graphics Pipeline How can we render a triangle? High-level description: – Represent the 3D geometry – Transform.
CS COMPUTER GRAPHICS LABORATORY. LIST OF EXPERIMENTS 1.Implementation of Bresenhams Algorithm – Line, Circle, Ellipse. 2.Implementation of Line,
1 Angel: Interactive Computer Graphics5E © Addison- Wesley 2009 Image Formation Fundamental imaging notions Fundamental imaging notions Physical basis.
Attack of the Clones Image source:
Jens Krüger & Polina Kondratieva – Computer Graphics and Visualization Group computer graphics & visualization GameFX C# / DirectX 2005 The Rendering Pipeline.
Lecture 7 Midterm Review. OpenGL Libraries gl: Basic OpenGL library, e.g. primitives. glu: OpenGL Utility library, a set of functions to create texture.
Computer Graphics Lecture 17 Fasih ur Rehman. Last Class 3D Transforms Inverse Rotation.
Graphics Programming. Graphics Functions We can think of the graphics system as a black box whose inputs are function calls from an application program;
Computer Graphics (Fall 2003) COMS 4160, Lecture 5: OpenGL 1 Ravi Ramamoorthi Many slides courtesy Greg Humphreys.
Computer Graphics Overview
Game and animation control flow
Layers in Adobe After Effect
- Introduction - Graphics Pipeline
Draw a Simple Object.
IAT 355 Scene Graphs Feb 23, 2017 IAT 355.
Modeling 101 For the moment assume that all geometry consists of points, lines and faces Line: A segment between two endpoints Face: A planar area bounded.
The Graphics Rendering Pipeline
CS451Real-time Rendering Pipeline
Real-time Computer Graphics Overview
Game and animation control flow
Updating an Animated Scene
Game Programming Algorithms and Techniques
Presentation transcript:

Control flow for interactive applications CSE 3541 Matt Boggus

Overview Graphics pipeline reminder Specifying geometry for OpenGL Specifying geometry for Unity Control flow in a rendering/animation loop

Graphics pipeline

OpenGL programming Initialize OpenGL and drawing window Define the geometry (points, lines, triangles/polygons) Define the vertex attributes (color, normal, …) Transform the geometry (translate, rotate, scale) Set up the camera (position, direction, …) Set up the projection (orthographic or perspective) Set up lighting (light position, color, …) Set up textures Draw

Animation/Rendering loop main(){ init_variables_and_objects(); while(true){ draw_scene(); handle_events(); update_variables_and_objects(); }

init_variables_and_objects() time – Initially 0 – One instance per animation dt – Amount of time between steps of the animation – For each animation step, time += dt Scene objects – Geometric objects – Lights – Camera – Player

update_variables_and_objects() P’(time+dt) = P(time) + displacement(dt) displacement(dt) is the change in position for the given time step (we could do the same thing for orientation/rotation) How is displacement(dt) calculated? – Physics – Behavior – Input – Data Set points absolutely P’ = P[time] where P is an array that stores points

Timeline control What if we want to revert to an earlier time?

Save the Cause or Effect? P(time-dt) = P’(time) - displacement(dt) – Need to save displacement(dt) Or save P() values in a stack

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

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] draw(); [3] counter = (counter + 1)%draw_rate; if(counter == 0) draw();

handle_events() I/O Timers Scripted events Network message