introduction to game programming introduction to game
play

Introduction to Game Programming Introduction to Game Programming - PowerPoint PPT Presentation

Outline Outline Creating and drawing game entities Creating and drawing game entities Introduction to Game Programming Introduction to Game Programming from 2D images ( from 2D images ( from 2D images ( sprites from 2D images (


  1. Outline Outline � Creating and drawing game entities Creating and drawing game entities Introduction to Game Programming Introduction to Game Programming � � from 2D images ( from 2D images ( from 2D images ( sprites from 2D images ( sprites sprites ) to 3D models sprites ) to 3D models ) to 3D models ) to 3D models Autumn 2017 Autumn 2017 Autumn 2017 Autumn 2017 � � the position, dimensions, and visual data of game the position, dimensions, and visual data of game � objects represented for computer graphics objects represented for computer graphics 04. Graphics for games 04. Graphics for games � 3D models ~ triangle meshes ~ geometry/shape 3D models ~ triangle meshes ~ geometry/shape � (plus other info) (plus other info) Juha Vihavainen Juha Vihavainen Juha Vihavainen Juha Vihavainen � On rendering pipeline On rendering pipeline On rendering pipeline On rendering pipeline � University of Helsinki University of Helsinki � Creating and using Creating and using virtual virtual (synthetic) (synthetic) in world camera camera in- -world � 3.3.2017 3.3.2017 Juha Vihavainen / University of Helsinki Juha Vihavainen / University of Helsinki 2 Literature on 3D graphics Literature on 3D graphics 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 � (Madhav, 2014) (Madhav, 2014) Ch. Ch. 2 2D 2D Graphics Graphics , Ch. , Ch. 4 3D 3D Graphics, Graphics, Ch. Ch. 8 8 � � simulated on a computer simulated on a computer Cameras Cameras � 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 � (Gregory, 2014) Ch. (Gregory, 2014) Ch. (Gregory, 2014) Ch. 10 (Gregory, 2014) Ch. 10 10 The Rendering Engine, 10 The Rendering Engine, The Rendering Engine, pp. 443 The Rendering Engine, pp. 443 pp. 443-541; pp. 443-541; 541; 10.2 541; 10.2 10.2 10.2 � � scales of objects, animate them in the game world, and transform scales of objects, animate them in the game world, and transform The Rendering Pipeline, p. 489. The Rendering Pipeline, p. 489. them into screen space so they can be rendered on screen them into screen space so they can be rendered on screen � Dunn Fletcher, Parberry Ian: Dunn Fletcher, Parberry Ian: 3D Math Primer for Graphics and 3D Math Primer for Graphics and � � 3D objects are (almost always) made up of triangles, the vertices of 3D objects are (almost always) made up of triangles, the vertices of Game Development . A K Peters/CRC Press, 2011. Game Development . A K Peters/CRC Press, 2011. � which are represented by vectors/points which are represented by vectors/points � Edward Angel, Dave Shreiner Edward Angel, Dave Shreiner , Interactive Computer Graphics: A , Interactive Computer Graphics: A � � Mathematics pervades everything in game development Mathematics pervades everything in game development Top-Down Approach with Shader Top Down Approach with Shader-Based OpenGL, Based OpenGL, 6th Ed. Addison 6th Ed. Addison- � Wesley, 2011. Wesley, 2011. Wesley, 2011. Wesley, 2011. � 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) � 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. � 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 � 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 3.3.2017 3.3.2017 Juha Vihavainen / University of Helsinki Juha Vihavainen / University of Helsinki 4

  2. ( Joseph Hocking, Unity Types of art assets Types of art assets in Action , 2015, p.70) Some 3D terminology Some 3D terminology � Rasterization Rasterization � � set of algorithms that draw 3D objects into a 2D set of algorithms that draw 3D objects into a 2D color color � buffer (part of buffer buffer (part of buffer (part of frame buffer (part of frame buffer frame buffer with other data) frame buffer with other data) with other data) with other data) � Modern computers use a Modern computers use a graphics processing unit graphics processing unit (GPU) that (GPU) that � can do most rasterization can do most rasterization textures + shaders � but need to tell the GPU but need to tell the GPU what what we want to draw and we want to draw and how how � � Due to limited resources, can't achieve photo Due to limited resources, can't achieve photo Due to limited resources, can't achieve photo-realistic images Due to limited resources, can't achieve photo-realistic images realistic images realistic images � � graphic graphic ( visual visual ) artifact artifact = some unwanted result = some unwanted result � (anomaly) from digital image processing (of using (anomaly) from digital image processing (of using approximate algorithms, or imprecise or corrupted data) approximate algorithms, or imprecise or corrupted data) 3.3.2017 3.3.2017 Juha Vihavainen / University of Helsinki Juha Vihavainen / University of Helsinki 5 3.3.2017 3.3.2017 Juha Vihavainen / University of Helsinki Juha Vihavainen / University of Helsinki 6 CRT monitor basics CRT monitor basics A graphics system (sketch) A graphics system (sketch) � 2D image = an array of 2D image = an array of picture elements picture elements known as known as pixels pixels � � for color displays, each pixel contains a for color displays, each pixel contains a red red , , green green , and , and general � appl. blue blue sub sub- -pixel pixel � an an RGBA an RGBA an RGBA value RGBA value value - for Red, Green, and Blue plus value - for Red, Green, and Blue plus for Red, Green, and Blue plus Alpha for Red, Green, and Blue plus Alpha Alpha Alpha � (alpha = 0 => (alpha = 0 => totally transparent image/part totally transparent image/part ) matrix & other computations � Resolution width x height determines the number of pixels Resolution width x height determines the number of pixels � � 300 x 200 means each row (or scan line) has 300 pixels 300 x 200 means each row (or scan line) has 300 pixels � and there's a total of 200 rows. and there's a total of 200 rows. � Consists of: Consists of: � � input devices, CPU, GPU, memory, frame buffer, output input devices, CPU, GPU, memory, frame buffer, output input devices, CPU, GPU, memory, frame buffer, output input devices, CPU, GPU, memory, frame buffer, output � CRTs used an electron gun to activate the various pixels CRTs used an electron gun to activate the various pixels � � devices devices � Modern display technologies: Modern display technologies: plasma plasma , , LCD LCD ( liquid liquid- -crystal crystal � E.g., PCs, workstations, mobile phones, video game consoles, E.g., PCs, workstations, mobile phones, video game consoles, � � display display ), etc. replaced ), etc. replaced CRT displays in (most) applications CRT displays in (most) applications GPS systems, etc. GPS systems, etc. 3.3.2017 3.3.2017 Juha Vihavainen / University of Helsinki Juha Vihavainen / University of Helsinki 7 3.3.2017 3.3.2017 Juha Vihavainen / University of Helsinki Juha Vihavainen / University of Helsinki 8

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend