Principles of Computer Game Design and Implementation. Lecture 5

Similar documents
Principles of Computer Game Design and Implementation. Lecture 7

Content. Building Geometry Appearance Lights Model Loaders

Content. Building Geometry Appearance Lights Model Loaders

Principles of Computer Game Design and Implementation. Lecture 6

Principles of Computer Game Design and Implementation. Lecture 11

3D Programming. 3D Programming Concepts. Outline. 3D Concepts. 3D Concepts -- Coordinate Systems. 3D Concepts Displaying 3D Models

jmonkeyengine 3.0 Beginner's Guide

Introduction to Computer Graphics. Knowledge basic concepts 2D and 3D computer graphics

Game Programming with. presented by Nathan Baur

Java2D/Java3D Graphics

Topic 10: Scene Management, Particle Systems and Normal Mapping. CITS4242: Game Design and Multimedia

Chapter 5 - The Scene Graph

Graphics Programming. Computer Graphics, VT 2016 Lecture 2, Chapter 2. Fredrik Nysjö Centre for Image analysis Uppsala University

Chapter 4. Chapter 4. Computer Graphics 2006/2007 Chapter 4. Introduction to 3D 1

CSE 167: Introduction to Computer Graphics Lecture #11: Visibility Culling

CSE 167: Introduction to Computer Graphics Lecture #10: View Frustum Culling

Introduction to Unreal Engine Blueprints for Beginners. By Chaven R Yenketswamy

CIS 581 Interactive Computer Graphics

Scene Management. Video Game Technologies 11498: MSc in Computer Science and Engineering 11156: MSc in Game Design and Development

Graphics for VEs. Ruth Aylett

Lecturer Athanasios Nikolaidis

Culling. Computer Graphics CSE 167 Lecture 12

Computer Graphics Introduction. Taku Komura

Graphics and Interaction Rendering pipeline & object modelling

CS 4620 Program 3: Pipeline

Computer Graphics (CS 543) Lecture 1 (Part 1): Introduction to Computer Graphics

Open GL Framework For A Computer Graphics Course

INTRODUCTION. Computer Graphics

CSE 167: Introduction to Computer Graphics. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013

CS 465 Program 4: Modeller

Animation & Rendering

MMGD0206 Computer Graphics. Chapter 1 Development of Computer Graphics : History

03 Vector Graphics. Multimedia Systems. 2D and 3D Graphics, Transformations

Introduction to X3D. Roberto Ranon HCI Lab University of Udine, Italy

Chapter 3. Texture mapping. Learning Goals: Assignment Lab 3: Implement a single program, which fulfills the requirements:

0. Introduction: What is Computer Graphics? 1. Basics of scan conversion (line drawing) 2. Representing 2D curves

Graphics for VEs. Ruth Aylett

Some Resources. What won t I learn? What will I learn? Topics

PowerVR Hardware. Architecture Overview for Developers

Review. Stephen J. Guy

CS451Real-time Rendering Pipeline

CIS 581 Interactive Computer Graphics (slides based on Dr. Han-Wei Shen s slides) Requirements. Reference Books. Textbook

the gamedesigninitiative at cornell university Lecture 14 2D Sprite Graphics

Graphical User Interfaces (GUIs)

3D GRAPHICS. design. animate. render

2: Introducing image synthesis. Some orientation how did we get here? Graphics system architecture Overview of OpenGL / GLU / GLUT

CSC Graphics Programming. Budditha Hettige Department of Statistics and Computer Science

1 Preview. Dr. Scott Gordon Computer Science Dept. CSUS. Virtual Cameras, Viewing Transformations: CSc-155 Advanced Computer Graphics

Digital 3D technologies

CSE 167: Introduction to Computer Graphics Lecture #9: Visibility. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2018

CS354 Computer Graphics Introduction. Qixing Huang Januray 17 8h 2017

CSE 167: Introduction to Computer Graphics Lecture 11: Scene Graph 2. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013

Computer Graphics Coursework 1

Topic 0. Introduction: What Is Computer Graphics? CSC 418/2504: Computer Graphics EF432. Today s Topics. What is Computer Graphics?

Problem Max. Points Total 80

C P S C 314 S H A D E R S, O P E N G L, & J S RENDERING PIPELINE. Mikhail Bessmeltsev

How shapes are represented in 3D Graphics. Aims and objectives By the end of the lecture you will be able to describe

the gamedesigninitiative at cornell university Lecture 6 Scene Graphs

MODELING AND HIERARCHY

Class Meeting 05 (Lecture 04) Objectives for this class meeting. Conduct vote on basic style of game for class project

CS148: Maya Lecture. October 9th, 2017 David Hyde

Chapter 17: The Truth about Normals

Introduction to OpenGL. CS 4620 Balazs Kovacs, 2014 Daniel Schroeder, 2013 Pramook Khungurn, 2012

Rendering a 3-Dimensional Cube Applet Using Light Weight Java Graphing Library (LWJGL) with Java Swing with NetBeans IDE 6.1

EF432. Introduction to spagetti and meatballs

COS 116 The Computational Universe Laboratory 10: Computer Graphics

Computer Graphics Fundamentals. Jon Macey

EECE 478. Learning Objectives. Learning Objectives. Rasterization & Scenes. Rasterization. Compositing

Visual HTML5. Human Information Interaction for Knowledge Extraction, Interaction, Utilization, Decision making HI-I-KEIUD

Binghamton University. EngiNet. Thomas J. Watson. School of Engineering and Applied Science. State University of New York. EngiNet WARNING CS 560

EF432. Introduction to spagetti and meatballs

Computer Graphics CS 543 Lecture 1 (Part I) Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

CS4621/5621 Fall Computer Graphics Practicum Intro to OpenGL/GLSL

CHAPTER 1 Graphics Systems and Models 3

Introduction and Overview

Ch 10: Game Event Management. Quiz # 4 Discussion

Modeling Objects. Modeling. Symbol-Instance Table. Instance Transformation. Each appearance of the object in the model is an instance

This lecture. Introduction to VRT. Hardware. Implementation levels. Scene-Graph libraries. Computer Graphic libraries

Introduction to 2D Graphics

Viewport 2.0 API Porting Guide for Locators

Introduction to the Graphics Module Framework

OpenGL shaders and programming models that provide object persistence

Computer Graphics: Introduction to the Visualisation Toolkit

CGDD 4113 Final Review. Chapter 7: Maya Shading and Texturing

Computer Graphics. Anders Hast. måndag 25 mars 13

Rendering. Converting a 3D scene to a 2D image. Camera. Light. Rendering. View Plane

Principles of Computer Game Design and Implementation. Revision Lecture

Speeding up your game

CSE 167: Introduction to Computer Graphics Lecture #8: Scene Graph. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2015

Introduction to 3D Concepts

The Application Stage. The Game Loop, Resource Management and Renderer Design

Module Contact: Dr Stephen Laycock, CMP Copyright of the University of East Anglia Version 1

General Syntax. jmonkeyengine3 materials

Optimisation. CS7GV3 Real-time Rendering

the gamedesigninitiative at cornell university Lecture 12 Scene Graphs

Ciril Bohak. - INTRODUCTION TO WEBGL

CS450/550. Pipeline Architecture. Adapted From: Angel and Shreiner: Interactive Computer Graphics6E Addison-Wesley 2012

Using the PowerVR SDK to Optimize your Renderer

Outline. Introduction Surface of Revolution Hierarchical Modeling Blinn-Phong Shader Custom Shader(s)

Render-To-Texture Caching. D. Sim Dietrich Jr.

Transcription:

Principles of Computer Game Design and Implementation Lecture 5

We already knew Introduction to this module History of video High-level information of a game Designing information for a game Execution of a game (Game loop) 2

jmonkeyengine Architecture and Mathematical Concepts

jmonkeyengine graphics jmonkeyengine A high performance scene graph based graphics API Completely open source (BSD License) Written in pure Java 4

jmonkeengine History Started in 2003 by Mark Powell inspired by a C++ book 3D Game Engine Design 2008 jmonkeyengive v. 2.0 2009 Development stalled. Project forked. jmonkeengine v. 3.0 Community-driven project New people joint Integration with free tools Ardor 3D Commercial development Neater but less features 5

Version Differences jme v2.0 Stable Uses OpenGL 1. Runs on any hardware jme v2.1 Final release in the 2.x branch jme v3.0 Uses OpenGL 2. Runs well on modern hardware Shader based Physics engine integrated jmonkeyplatform Supports Android devices 6

jme Documentation Official site: http://www.jmonkeyengine.org 7

jme Architecture the picture is largely out-dated, but it still conveys the idea 8

Where Will It Run? jme is 100% Java. It depends on a JNI platform. LWJGL is currently the only supported JNI platform. LWJGL runs on Linux, OSX, and Win32. Implemented over OpenGL 9

Image Synthesis Modeling Viewing Rendering Separation of Scene Specification, Viewing and Rendering Scene is modelled independent of any view Views are unconstrained There are many possible rendering methods given a scene and a view 10

Model to Screen View Window (showing pixels) 11

Renderer Transforms geometry from world space to screen space Eliminates hidden objects Draws the transformed scene More to follow 12

Scene Graph A hierarchical data structure used to group data Simplifies management Groups objects into the same spatial region Facilitates transformations & rotations of compound objects 13

Geometry Geometry Geometric data for rendering objects GUI Widgets Sound Similar to renderer 3D effects 14

Setting Up jme 3.0 Download the appropriate version of the jmonkeyengine SDK http://jmonkeyengine.org/downloads/ Run the installer (already available in the labs) File -> New Project -> BasicGame 15

Simplest jme Program package mygame; import com.jme3.app.simpleapplication; public class Main extends SimpleApplication { public static void main(string[] args) { Main app = new Main(); app.start(); } } public void simpleinitapp() { } 16

A Default Blue Box package mygame; import com.jme3.app.simpleapplication; import com.jme3.material.material; import com.jme3.math.colorrgba; import com.jme3.scene.geometry; import com.jme3.scene.shape.box; public void simpleinitapp() { Box b = new Box(1, 1, 1); Geometry geom = new Geometry("Box", b); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setcolor("color", ColorRGBA.Blue); geom.setmaterial(mat); } rootnode.attachchild(geom); public class Main extends SimpleApplication { } public static void main(string[] args) { Main app = new Main(); app.start(); } 17

Let s Run It Demo 18

Game Loop Start package mygame; import com.jme3.app.simpleapplication; import com.jme3.material.material; import com.jme3.math.colorrgba; import com.jme3.scene.geometry; import com.jme3.scene.shape.box; public void simpleinitapp() { Box b = new Box(1, 1, 1); Geometry geom = new Geometry("Box", b); } Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setcolor("color", ColorRGBA.Blue); geom.setmaterial(mat); rootnode.attachchild(geom); public class Main extends SimpleApplication { } public static void main(string[] args) { Main app = new Main(); app.start(); } Initialise Update Game Draw Scene Are we done? Cleanup End 19

SimpleApplication Provides Options dialog (when you first run it) Can ask for it to be always on Input handler Standard camera A timer to compute the frame rate and provide smooth movements rootnode 20

Scene Graph The scene graph represents the 3D world Leaf nodes (Geometry) represent data Internal nodes (Nodes) group and manage data 21

Two Geometries public void simpleinitapp() { Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setcolor("color", ColorRGBA.Blue); Box b = new Box(1, 1, 1); Geometry geom = new Geometry("Box", b); geom.setmaterial(mat); Sphere s = new Sphere(60, 60, 1.5f); Geometry sgeom = new Geometry("Sphere", s); sgeom.setmaterial(mat); } rootnode.attachchild(geom); rootnode.attachchild(sgeom); 22

Graphical Model Items arranged spatially (grouped together) Placing something (e.g. a light) in a branch affects all branch elements A node is a reference point to its children Simplifies rendering Simplifies manipulation Simplifies importing models 23

Rendering Scene Graph Every node (Nodes and Geometry) defines Transform(ation)s orientation, location and scale BoundingVolume An area containing all sub-nodes Render state Defines how geometry is displayed 24

Meaningful Game Loop Start protected Geometry g; public void simpleupdate(float tpf) { geom.move (0.001f, 0, 0)); } Initialise Update Game Draw Scene Are we done? Cleanup Changes the scene graph End 25

Let s Run It Demo 26

Meshes and Geometries A collection of polygons that can be drawn Everything that is rendered Box mesh = new Box(1, 1, 1); Geometry geom = new Geometry("Box", mesh); But how is it rendered 27

Meshes, Geometries and Materials All Geometries must have Materials that defines colour or texture. Each Material is based on a Material Definition file (.j3md) Lighting.j3md, Unshaded.j3md All Materials (except "Unshaded" ones) are invisible without a light source. 28

Example public void simpleinitapp() { Box b = new Box(1, 1, 1); geom = new Geometry("Box", b); rootnode.attachchild(geom); Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md"); geom.setmaterial(mat); DirectionalLight sun = new DirectionalLight(); sun.setdirection(new Vector3f(1, 0, -2)); sun.setcolor(colorrgba.white); rootnode.addlight(sun); } 29

3D Models and Games While it is possible to specify the geometry based on basic shapes (we do it), most games import scene graphs from a 3D modelling tool Maya 3D Max Blender 30

Summary jmonkeyengine is a simple yet powerful Java game engine Basic shapes can be combined in a scene graph to create a 3D model We need some Maths to manipulate entities 31