3.1. G RAPHICS I The use of images within games. Reflections and advice on the games proposed in the Week 2 Hand-in.

Slides:



Advertisements
Similar presentations
2000 Prentice Hall, Inc. All rights reserved. 1 Outline 3.1Introduction 3.2Game Loop Components 3.3How to Implement in C# 3.4Adding Image to XNA Project.
Advertisements

CSE 380 – Computer Game Programming Tile Based Graphics Legend of Zelda, by Nintendo, released 1987.
Using 2D sprite with OpenGL 2003 team Koguyue. Overview Motivation and basic concepts Advantages with using OpenGL Basic requirements of implementation.
4.2. G RAPHICS II Image Ribbons and Image Tiles. Building a scrollable background using several ‘joined’ images.
Sprites, User Input, and Collision COSC 315 Fall 2014 Bridget M. Blodgett.
Graphics Pipeline.
Using effects within a SpriteBatch or as a post render effect
1 Computer Graphics Chapter 9 Rendering. [9]-2RM Rendering Three dimensional object rendering is the set of collective processes which make the object.
Introduction to Multimedia
Introduction to Computer Graphics
Perspective, Scene Design, and Basic Animation
Text. Graphics Images – photos Animation Video Audio Text Copyright issues.
SET09115 Intro Graphics Programming
1 Creating Web Graphics Outline 2.1 Graphics Types 2.2 Vector Graphics 2.3Bitmapped Graphics 2.4Graphics for the Web 2.5 GIF (Graphics Interchange Format)
Prepared by George Holt Digital Photography BITMAP GRAPHIC ESSENTIALS.
COMP Bitmapped and Vector Graphics Pages Using Qwizdom.
CHAPTER 4 Images XNA Game Studio 4.0. Objectives Find out how the Content Manager lets you add pictures to Microsoft XNA games. Discover how pictures.
MOMA Display Screens K u r t R a l s k e.
Lecture 4 - Introduction to Computer Graphics
Image Storage Bitmapped Graphics – in which an image is represented as a collection of dots Vector Graphics – in which an image is represented as a set.
Getting the Basics Graphics for the Web McIntyre, Period 2 Kellogg, Period 5.
Computer Graphics Texture Mapping
11 A First Game Program Session Session Overview  Begin the creation of an arcade game  Learn software design techniques that apply to any form.
Getting Started. XNA Game Studio 4.0 To download XNA Game Studio 4.0 itself, go to XNA Game.
CSE 219 Computer Science III Images. HW1 Has been posted on Blackboard Making a Game of Life with limited options.
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 5 Working with Images Starting Out with Games & Graphics in.
Advanced Computer Graphics Depth & Stencil Buffers / Rendering to Textures CO2409 Computer Graphics Week 19.
9.3. P ARTICLE S YSTEMS Development of a particle system.
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.
Emerging Technologies for Games Alpha Sorting and “Soft” Particles CO3303 Week 15.
Computer Graphics Bitmaps & Sprites CO2409 Computer Graphics Week 3.
3.2. G RAPHICS I Alpha blending within games. An exploration of the use of alpha blending within games.
Computer Graphics The Rendering Pipeline - Review CO2409 Computer Graphics Week 15.
Advanced Computer Graphics Advanced Shaders CO2409 Computer Graphics Week 16.
By Millie and Ellece. D IFFERENT T YPES OF G RAPHICS Bitmap Formats JPEG GIF PNG PSD TIFF.
11 Making a Sprite Session 4.2. Session Overview  Describe the principle of a game sprite, and see how to create a sprite in an XNA game  Learn more.
Shader Study 이동현. Vision engine   Games Helldorado The Show Warlord.
Mobile Communication Extented-EMS. Mobile Communication The Bitmap format is not always the most resource efficient way of representing images, A better.
Representation of Images You need to know: (k) explain the representation of an image as a series of pixels represented in binary (l) explain the need.
Sprites, User Input, and Collision COSC 315 Fall 2014 Bridget M. Blodgett.
09/16/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Environment mapping Light mapping Project Goals for Stage 1.
Computer Graphics Blending CO2409 Computer Graphics Week 14.
Module 4- Build a Game Understanding Pictures Compression – Making things smaller.
Fall UI Design and Implementation1 Lecture 6: Output.
COMPUTER GRAPHICS CS 482 – FALL 2015 OCTOBER 6, 2015 IMAGE MANIPULATION COMPRESSION COMPOSITING.
11 Writing Text Session 5.1. Session Overview  Show how fonts are managed in computers  Discover the difference between bitmap fonts and vector fonts.
TRANSPARENCY USING ALPHA CHANNELS. IN PHOTOSHOP MAKE AN IMAGE 512 X 512 RGB, WITH WHITE BACKGROUND ADD AN ALPHA CHANNEL.
Image File Formats By Dr. Rajeev Srivastava 1. Image File Formats Header and Image data. A typical image file format contains two fields namely Dr. Rajeev.
Overview  Basic requirements of implementation  Image resource  Texture mapping  Advanced requirements of implementation  KGL sprite class.
Playing with Sprites. XNA Game Lifecycle In the faceBall demo program we bounced a smiley face around the graphical display against a background image.
XNA ● Proprietary Microsoft framework ● C#. Interface.
XNA Tutorial 1 For CS134 Lecture. Overview Some of the hard work has already been done for you. If you build and run your game now, the GraphicsDeviceManager.
Mohammed AM Dwikat CIS Department Digital Image.
Build your own 2D Game Engine and Create Great Web Games using HTML5, JavaScript, and WebGL. Sung, Pavleas, Arnez, and Pace, Chapter 5 Examples 1.
2D Graphics CMT3311. This covers... How to make a transparent sprite How to add a sprite to your project and draw it Properties of sprites and how to.
Unit 2.6 Data Representation Lesson 3 ‒ Images
Graphical Output Basic Images.
David Meredith Aalborg University
Textures, Sprites, and Fonts
Digital imaging.
Raster Images CPSC 1030.
Look at Me Mod 4 Lesson 3 Graphics Module 4- Build a Game.
Data Representation.
Representing Images 2.6 – Data Representation.
Alpha blending within games
2.2. Architectural Design I
Animated image sequences, fonts and image transforms
Multimedia System Image
Game Programming Algorithms and Techniques
Game Programming Algorithms and Techniques
Presentation transcript:

3.1. G RAPHICS I The use of images within games

Reflections and advice on the games proposed in the Week 2 Hand-in

Brief exploration of the different roles images serve within games

Images play many roles within 2 D games, including: Character sheets Special Effects GUI/HUD elements Background tiles / elements Animations Game objects

Images also play an important role in 3D games in terms of texturing 3D surfaces, providing information driving the rendering process. The roles of image include (but are not limited to): diffuse, specular, normal, height, emissive maps etc. Specular Diffuse Normal Height

A repository of images (including GUI/HUD elements, fonts, sprite and tile sheets, animations, etc. is available to help you source graphics for your game. You can also source images from other sources such as Google Images, etc. Important: Infringing copyright is wrong. It is your responsibility to ensure you have adequate usage permission. To do: Explore Images

Properties defining an image and common image types

● Type (e.g. bitmap, vector) ● Dimension (pixel width and height) ● Channels (e.g. Red,Green,Blue,Alpha) ● Colour depth (8/16/24 bits per channel etc.) ● Compression type An image can be defined in terms of: Bitmap, 768x512 pixel image Four channels (red, green, blue, alpha) 8-bits per channel (32 bits/pixel)

● If an image does not have an alpha channel it is opaque See GraphicAssetDemos of the Javacode repository: ● ImageTypeTest ● Images with an alpha channel may be either transparent or translucent. Aside: Combining a transparent or translucent image with another image is a process known as compositing. Explored next lecture. OpaqueTransparentTranslucent

There are lots of different image formats. Four of the most common are BMP, JPG, GIF and PNG. DDS is also available in XNA. Suggestion: For hassle free development in this module, store your graphics in PNG format.

Loading and storing images in XNA and Java and associated performance issues

Load image into Asset Manager Obtain image from Asset Manager AssetManager. addImageAsset (name, URL); graphicalAsset = AssetManager. retrieveGraphicalAsset (name); Texture2D texture = Game. Content.Load (name); Load image from (+into) the Game’s ContentManager When possible images will be automatically stored in graphics memory. Load request Image data

Aside: The XNA ContentManager Load method loads and caches assets, returning a reference on subsequent calls. Memory space on graphics cards is a limiting factor (for most games), i.e. all assets cannot be kept in graphics memory at the same time. Most games repeatedly use the same set of assets. Within games it is common to have some form of asset/space management, capable of: Providing game objects with references to requested assets Loading/unloading assets (per level, dynamically, etc.) Aside: Asset Management is explored in a later lecture. To do: Plan your image needs

SpriteSortMode determines how textures are sorted before rendered BlendState determines how textures are blended together Aside: On the surface both approaches look somewhat different – although the Java implementation can be viewed as an instance of one higher-level implementation of a SpriteBatch Call the game layer draw method to draw all visible game objects in a layer (thereby invoking the draw method of game objects as needed) Begin a SpriteBatch, draw textures, and then end the SpriteBatch GameLayer.draw (graphics2D) GameObject.draw(graphics2D) SpriteBatch.Begin ( spriteSortMode, blendState ); SpriteBatch.Draw ( texture, position, colour); SpriteBatch.End ();

The importance of maintaining a correct draw order was introduced in 2.2. Architectural Design I – Design Basics Castle wall drawn in front of background scenery Hud drawn on top of everything Player drawn in front of background and castle wall, but behind rope bridge. To do: Plan your draw order Update the GameObject. drawOrder property (the GameLayer’s draw automatically draws in an ordered sequence) Either: use several SpriteBatch (drawing up in ‘layers’ containing objects of equal depth) or use a SpriteBatch sprite sort mode/draw method supporting layer depth). GameObject. setDrawOrder (int drawOrder) SpriteBatch. Draw(..., float layerDepth )

In some games you can only display one bit of your game world on the screen (viewport) at any one time. There is no point in spending effort ‘drawing’ objects that fall outside of the viewport.

In order to draw an image (XNA/Java) the graphics card must configure itself, e.g. setup for texture, etc. Excellent performance occurs when the graphics card draws the same image lots of different times in one batch (i.e. only a single setup cost) Poor performance occurs when the graphics card needs to setup a new image each draw request. Hint: Store multiple images on a single image sheet and then select draw regions is often useful. Aside: Sorting by texture (for performance) and sorting by draw order conflict with one another!

To do: Based on feedback on Week 2 hand-in, revise design if needed Think about types of images in your game, and how they might be ordered during a draw Explore image repository (and other sources) for suitable source art Today we explored: Use of images within games and common image characteristics Loading, storing and drawing images alongside common design issues