Introduction to Game Programming Introduction to Game Programming Autumn 2017 Autumn 2017 Autumn 2017 Autumn 2017
- 04. Graphics for games
- 04. Graphics for games
Juha Vihavainen Juha Vihavainen Juha Vihavainen Juha Vihavainen University of Helsinki University of Helsinki
Outline Outline
- Creating and drawing game entities
Creating and drawing game entities from 2D images ( from 2D images (sprites sprites) to 3D models ) to 3D models
- from 2D images (
from 2D images (sprites sprites) to 3D models ) to 3D models
- the position, dimensions, and visual data of game
the position, dimensions, and visual data of game
- bjects represented for computer graphics
- bjects represented for computer graphics
- 3D models ~ triangle meshes ~ geometry/shape
3D models ~ triangle meshes ~ geometry/shape (plus other info) (plus other info) On rendering pipeline On rendering pipeline
- On rendering pipeline
On rendering pipeline
- Creating and using
Creating and using virtual virtual (synthetic) (synthetic) in in-
- world
world camera camera
2 3.3.2017 3.3.2017 Juha Vihavainen / University of Helsinki Juha Vihavainen / University of Helsinki
Literature on 3D graphics Literature on 3D graphics
- (Madhav, 2014)
(Madhav, 2014) Ch.
- Ch. 2 2D
2D Graphics Graphics, Ch. , Ch. 4 3D 3D Graphics, Graphics, Ch.
- Ch. 8
8 Cameras Cameras (Gregory, 2014) Ch. (Gregory, 2014) Ch. 10 10 The Rendering Engine, The Rendering Engine, pp. 443
- pp. 443-541;
541; 10.2 10.2
- (Gregory, 2014) Ch.
(Gregory, 2014) Ch. 10 10 The Rendering Engine, The Rendering Engine, pp. 443
- pp. 443-541;
541; 10.2 10.2 The Rendering Pipeline, p. 489. The Rendering Pipeline, p. 489.
- Dunn Fletcher, Parberry Ian:
Dunn Fletcher, Parberry Ian: 3D Math Primer for Graphics and 3D Math Primer for Graphics and Game Development Game Development. A K Peters/CRC Press, 2011. . A K Peters/CRC Press, 2011.
- Edward Angel, Dave Shreiner
Edward Angel, Dave Shreiner, Interactive Computer Graphics: A , Interactive Computer Graphics: A Top Top-Down Approach with Shader Down Approach with Shader-Based OpenGL, Based OpenGL, 6th Ed. Addison 6th Ed. Addison- Wesley, 2011. Wesley, 2011. Wesley, 2011. Wesley, 2011.
- Tomas Akenine
Tomas Akenine-Moller, Eric Haines, Naty Hoffman, Moller, Eric Haines, Naty Hoffman, Real Real-Time Time Rendering Rendering, 3rd Ed. A K Peters/CRC Press, 2008. , 3rd Ed. A K Peters/CRC Press, 2008.
- Junghyan Han,
Junghyan Han, 3D Graphics for Game Programming 3D Graphics for Game Programming. CRC, 2011 . CRC, 2011
3.3.2017 3.3.2017 Juha Vihavainen / University of Helsinki Juha Vihavainen / University of Helsinki 3
Motivation for linear algebra Motivation for linear algebra
- A game is (essentially) a mathematical model of a virtual world
A game is (essentially) a mathematical model of a virtual world simulated on a computer simulated on a computer a game engine needs to keep track of the positions, orientations, and a game engine needs to keep track of the positions, orientations, and
- a game engine needs to keep track of the positions, orientations, and
a game engine needs to keep track of the positions, orientations, and scales of objects, animate them in the game world, and transform scales of objects, animate them in the game world, and transform them into screen space so they can be rendered on screen them into screen space so they can be rendered on screen
- 3D objects are (almost always) made up of triangles, the vertices of
3D objects are (almost always) made up of triangles, the vertices of which are represented by vectors/points which are represented by vectors/points
- Mathematics pervades everything in game development
Mathematics pervades everything in game development games make use many branches of mathematics, e.g., trigonometry, games make use many branches of mathematics, e.g., trigonometry,
- games make use many branches of mathematics, e.g., trigonometry,
games make use many branches of mathematics, e.g., trigonometry, algebra, and calculus (often probability, too) algebra, and calculus (often probability, too)
- the most important kind of mathematics for a game programmer is
the most important kind of mathematics for a game programmer is vector vector and and matrix matrix math math, i.e., , i.e., linear algebra linear algebra
3.3.2017 3.3.2017 Juha Vihavainen / University of Helsinki Juha Vihavainen / University of Helsinki 4