Week 2 - Monday CS361.

Slides:



Advertisements
Similar presentations
Real-Time Rendering 靜宜大學資工研究所 蔡奇偉副教授 2010©.
Advertisements

COMPUTER GRAPHICS SOFTWARE.
COMPUTER GRAPHICS CS 482 – FALL 2014 NOVEMBER 10, 2014 GRAPHICS HARDWARE GRAPHICS PROCESSING UNITS PARALLELISM.
Graphics Pipeline.
CGDD 4003 THE MASSIVE FIELD OF COMPUTER GRAPHICS.
Tomas Mőller © 2000 Speeding up your game The scene graph Culling techniques Level-of-detail rendering (LODs) Collision detection Resources and pointers.
Introduction to Parallel Rendering: Sorting, Chromium, and MPI Mengxia Zhu Spring 2006.
Graphics Systems I-Chen Lin’s CG slides, Doug James’s CG slides Angel, Interactive Computer Graphics, Chap 1 Introduction to Graphics Pipeline.
Game Engine Design ITCS 4010/5010 Spring 2006 Kalpathi Subramanian Department of Computer Science UNC Charlotte.
Ch 1 Intro to Graphics page 1CS 367 First Day Agenda Best course you have ever had (survey) Info Cards Name, , Nickname C / C++ experience, EOS experience.
Introduction to 3D Graphics John E. Laird. Basic Issues u Given a internal model of a 3D world, with textures and light sources how do you project it.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology Beyond Meshes Spring 2012.
Hidden Surface Removal
Week 1 - Friday.  What did we talk about last time?  C#  SharpDX.
Course Overview, Introduction to CG Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, September 5, 2003.
CSE 381 – Advanced Game Programming 3D Game Architecture.
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.
Computer graphics & visualization REYES Render Everything Your Eyes Ever Saw.
CSE 381 – Advanced Game Programming Basic 3D Graphics
Graphical Objects and Scene Graphs 1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009.
Chapter 1 What is Programming? Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas, E.
Week 2 - Wednesday CS361.
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.
09/09/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Event management Lag Group assignment has happened, like it or not.
CS 450: COMPUTER GRAPHICS REVIEW: INTRODUCTION TO COMPUTER GRAPHICS – PART 2 SPRING 2015 DR. MICHAEL J. REALE.
Week 2 - Friday.  What did we talk about last time?  Graphics rendering pipeline  Geometry Stage.
Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.
1 Advanced Scene Management. 2 This is a game-type-oriented issue Bounding Volume Hierarchies (BVHs) Binary space partition trees (BSP Trees) “Quake”
Introduction to Parallel Rendering Jian Huang, CS 594, Spring 2002.
Stream Processing Main References: “Comparing Reyes and OpenGL on a Stream Architecture”, 2002 “Polygon Rendering on a Stream Architecture”, 2000 Department.
Computer Graphics The Rendering Pipeline - Review CO2409 Computer Graphics Week 15.
1 The Rendering Pipeline. CS788 Topic of HCI 2 Outline  Introduction  The Graphics Rendering Pipeline  Three functional stages  Example  Bottleneck.
2 COEN Computer Graphics I Evening’s Goals n Discuss application bottleneck determination n Discuss various optimizations for making programs execute.
Real-time Graphics for VR Chapter 23. What is it about? In this part of the course we will look at how to render images given the constrains of VR: –we.
GRAPHICS PIPELINE & SHADERS SET09115 Intro to Graphics Programming.
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.
Computer Graphics Chapter 6 Andreas Savva. 2 Interactive Graphics Graphics provides one of the most natural means of communicating with a computer. Interactive.
CSCE 552 Spring D Models By Jijun Tang. Triangles Fundamental primitive of pipelines  Everything else constructed from them  (except lines and.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Maths & Technologies for Games Graphics Optimisation - Batching CO3303 Week 5.
11 Writing Text Session 5.1. Session Overview  Show how fonts are managed in computers  Discover the difference between bitmap fonts and vector fonts.
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.
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.
CHAPTER 5 Text XNA Game Studio 4.0. Objectives Discover how text is drawn using Microsoft XNA. Add some font resources to your XNA program. Draw some.
Applications and Rendering pipeline
GPU Architecture and Its Application
COMPUTER GRAPHICS CHAPTER 38 CS 482 – Fall 2017 GRAPHICS HARDWARE
- Introduction - Graphics Pipeline
Scene Manager Creates and places movable objects like lights and cameras so as to access them efficiently, e.g. for rendering. Loads and assembles world.
Week 7 - Monday CS361.
Photorealistic Rendering vs. Interactive 3D Graphics
Week 2 - Friday CS361.
Chapter 10 Computer Graphics
CSCE 441 Computer Graphics 3-D Viewing
Graphics Processing Unit
Real-Time Ray Tracing Stefan Popov.
The Graphics Rendering Pipeline
CS451Real-time Rendering Pipeline
© University of Wisconsin, CS559 Fall 2004
CSCE 441: Computer Graphics Hidden Surface Removal
CSE 381 – Advanced Game Programming Terrain
Chapter V Vertex Processing
Lecture 13 Clipping & Scan Conversion
Visibility (hidden surface removal)
Computer Graphics Lecture 15.
Games Development Game Architecture: Entities
Clipping University of British Columbia CPSC 314 Computer Graphics
Week 11 - Monday CS361.
Presentation transcript:

Week 2 - Monday CS361

Last time What did we talk about last time? C# MonoGame

Questions?

More MonoGame Examples

Review of MonoGame Program creates a Game1 (or similar) object and starts it running Game1 has: Initialize() LoadContent() Update() Draw() It runs an update-draw loop continuously until told to exit

Drawing text Modern TrueType and OpenType fonts are vector descriptions of the shapes of characters Vector descriptions are good for quality, but bad for speed MonoGame allows us to take a vector-based font and turn it into a picture of characters that can be rendered as a texture Just like everything else

Drawing text continued Inside a MonoGame project, right-click the Content.mgcb file and choose Open with… Select MonoGame Pipeline Tool Right click on Content in the tool, and select Add -> New Item… Choose SpriteFont Description and give your new SpriteFont a name Open the spritefont file, choosing a text editor like Notepad++ By default, the font is Arial at size 12 Edit the XML to pick the font, size, and spacing You will need multiple Sprite Fonts even for different sizes of the same font Repeat the process to make more fonts Note: fonts have complex licensing and distribution requirements

Drawing a font continued Load the font similar to texture content Add a DrawString() call in the Draw() method: font = Content.Load<SpriteFont>("Text"); spriteBatch.Begin(); spriteBatch.DrawString(font, "Hello, World!", new Vector2(100, 100), Color.Black); spriteBatch.End();

Why are they called sprites? They "float" above the background like fairies… Multiple sprites are often stored on one texture It's cheaper to store one big image than a lot of small ones This is an idea borrowed from old video games that rendered characters as sprites

Drawing sprites with rotation It is possible to apply all kinds of 3D transformations to a sprite A sprite can be used for billboarding or other image-based techniques in a fully 3D environment But, we can also simply rotate them using an overloaded call to Draw() spriteBatch.Draw(texture, location, sourceRectangle, Color.White, angle, origin, 1.0f, SpriteEffects.None, 1);

Let's unpack that texture: Texture2D to draw location: Location to draw it sourceRectangle Portion of image Color.White Full brightness angle Angle in radians origin Origin of rotation 1.0f Scaling SpriteEffects.None No effects 1 Float level

Student Lecture: Graphics Rendering Pipeline and Application Stage

Graphics Rendering Pipeline

Rendering What do we have? What do we want? Virtual camera (viewpoint) 3D objects Light sources Shading Textures What do we want? 2D image

Pipelines The idea of a pipeline is to divide a task into independent steps, each of which can be performed by dedicated hardware Example RISC pipeline: Instruction fetch Decode Execute Memory Access Writeback

Pipeline performance If you have an n stage pipeline, what's the maximum speedup you can get? Consider a TV show with the following pipeline Write Rewrite Film Edit Assume each step takes 1 week How much total time does it take to produce a 13 episode season? What if there was no pipelining? Note that a pipeline's speed is limited by its slowest stage, the bottleneck

Graphics rendering pipeline For API design, practical top-down problem solving, and hardware design, and efficiency, rendering is described as a pipeline This pipeline contains three conceptual stages: Produces material to be rendered Application Decides what, how, and where to render Geometry Renders the final image Rasterizer

Architecture These conceptual stages may or may not be running at the same time Each conceptual stage may contain its own internal pipelines or parallel execution

Speed A critical concern of real time rendering is the rendering speed, determined by the slowest stage in the pipeline We can measure speed in frames per second (fps), common for average performance over time We can also measure speed in Hertz (Hz), common for hardware

Rendering speed example Output device has a maximum update frequency of 60 Hz (very common for LCD's) The bottleneck rendering stage is 62.5 ms What's our rendering speed? 1/0.0625 = 16 fps 60/1 = 60 fps 60/2 = 30 fps 60/3 = 20 fps 60/4 = 15 fps 60/5 = 12 fps

Application Stage

Application stage The application stage is the stage completely controlled by the programmer As the application develops, many changes of implementation may be done to improve performance The output of the application stage are rendering primitives Points Lines Triangles

Important jobs of the application stage Reading input Managing non-graphical output Texture animation Animation via transforms Collision detection Updating the state of the world in general

Acceleration The Application Stage also handles a lot of acceleration Most of this acceleration is telling the renderer what NOT to render Acceleration algorithms Hierarchical view frustum culling BSP trees Quadtrees Octrees

Hierarchical view frustum culling An application can remove those objects that are not in the cone of visibility Hierarchies of objects can be used to make these calculations easier

BSP Trees Splitting planes are made through polygons to repeatedly subdivide the polygons in a scene in half Often, BSP Trees are calculated a single time for complex, static scenes

Quadtrees and Octrees Like BSP's, the space can be repeatedly subdivided as long as it contains a number of objects above a certain threshold Octrees divide the space in three dimensions while quadtrees only focus on two

Upcoming

Next time… Rendering pipeline Geometry stage

Reminders Pick your teams today if you haven't already! Keep reading Chapter 2 Focus on 2.3