Game Programming Loading assets, Materials, Lighting & Shading, Camera, Game Loop, Input Handling Informatics Engineering University of Brawijaya Eriq.

Slides:



Advertisements
Similar presentations
Exploration of advanced lighting and shading techniques
Advertisements

Game Programming 09 OGRE3D Lighting/shadow in Action
1 Graphics CSCI 343, Fall 2013 Lecture 18 Lighting and Shading.
Lighting and Procedural Textures. Purpose In this chapter, you will learn about the following:  Setting up a camera and lights to really show off your.
Intro to Java Monkey Engine Download JME loads/ loads/
Lighting and Illumination Lighting is the major problem in computer graphics, for either realism or real-time compositions- harder than modeling Consider.
SE 313 – Computer Graphics Lecture 13: Lighting and Materials Practice Lecturer: Gazihan Alankuş 1.
Working with 3Ds Max. 3Ds Max.
1. What is Lighting? 2 Example 1. Find the cubic polynomial or that passes through the four points and satisfies 1.As a photon Metal Insulator.
Chapter 5 Develop a PSA & Commercial Using Premiere Pro & After Effects CS6.
1 of 25 Assignment Orthographic Wireframe Elevation Orthographic Wireframe Plan Orthographic Wireframe End-Elevation Perspective View.
Intro to Blender Alex Hawker. First Steps Download
3D Graphics Continued Chris GauthierDickey CIS Intro to Game Programming.
(conventional Cartesian reference system)
1 CSCE 641: Computer Graphics Lighting Jinxiang Chai.
Graphics Systems I-Chen Lin’s CG slides, Doug James’s CG slides Angel, Interactive Computer Graphics, Chap 1 Introduction to Graphics Pipeline.
Chapter 10 Creating 3D Objects. Objectives Extrude objects Revolve objects Manipulate surface shading and lighting Map artwork to 3D objects Work with.
Scenes, Cameras & Lighting. Outline  Constructing a scene  Using hierarchy  Camera models  Light models.
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.
Week 1 - Friday.  What did we talk about last time?  C#  SharpDX.
CSE 380 – Computer Game Programming Introduction ITS 102 – 3D Modeling for Games Blender's User Interface.
Lecture 5: 3D Rendering Pipeline (II) Prof. Hsien-Hsin Sean Lee School of Electrical and Computer Engineering Georgia Institute of Technology.
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) CS 426 Intro to 3D Computer Graphics © 2003, 2004, 2005 Jason Leigh Electronic.
CS324e - Elements of Graphics and Visualization Checkerboard World.
Chapter 10 Creating 3D Objects. Extruding Objects The Extrude & Bevel effect makes two- dimensional objects three-dimensional. A two-dimensional object.
Rujchai Ung-arunyawee Department of Computer Engineering Khon Kaen University.
Week 2 - Wednesday CS361.
Shading. What is Shading? Assigning of a color to a pixel in the final image. So, everything in shading is about how to select and combine colors to get.
Rendering Overview CSE 3541 Matt Boggus. Rendering Algorithmically generating a 2D image from 3D models Raster graphics.
12/03/10 ANIMASI TEKNOLOGI IF.UB. Eriq Muhammad Adams J. -
Lecture 11: Exam Revision 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 718,  ex 2271  Coursework.
CSE 381 – Advanced Game Programming GLSL Lighting.
Eriq Muhammad Adams J. Informatics Engineering University of Brawijaya.
1 Perception and VR MONT 104S, Fall 2008 Lecture 21 More Graphics for VR.
Eriq Muhammad Adams J. Informatics Engineering University of Brawijaya.
Design Studies 20 ‘Show Off’ Project How to make a computer monitor In Google Sketchup By: Liam Jack.
Course Introduction to virtual engineering Óbuda University John von Neumann Faculty of Informatics Institute of Applied Mathematics Lecture and laboratory.
Sky Boxes and Vector Math 2 Course Information CVG: Programming 4 My Name: Mark Walsh Website:
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Lighting a 3D Scene Guilford County Sci Vis V part 1.
Ray Tracing Fall, Introduction Simple idea  Forward Mapping  Natural phenomenon infinite number of rays from light source to object to viewer.
Graphics Graphics Korea University cgvr.korea.ac.kr Lighting, Fogging, Alpha Blending & Progressive Meshes Byeong-Seon Jeong
Lighting and Shadows CSIS 5838: Graphics and Animation for Gaming.
Local Illumination and Shading
UG/Photo Hong Rujin 15, April. High Quality Image Dialog View Visualization High Quality Image.
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
© 2011 Delmar, Cengage Learning Chapter 10 Creating 3D Objects.
CSE 681 Introduction to Ray Tracing. CSE 681 Ray Tracing Shoot a ray through each pixel; Find first object intersected by ray. Image plane Eye Compute.
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
Unbuffered Input Games generally use unbuffered Input Ogre provides FrameListeners – Ogre's main infinite loop → startRendering – Also called the render.
UNIT 11: 3D AutoCAD Objectives: How to print or plot a drawing How to setup a layout using title blocks and viewports Create and manage new layouts Be.
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
Chapter 5. Lighting Computer Graphics (spring, 2009) School of Computer Science University of Seoul.
Week 2 - Monday CS361.
Computer Graphics Imaging
Rendering, Cameras & Lighting
Introducing Blender.
Game Development Unity3D.
Introduction to Events
Austin Grosel & Aaron Ebbinghaus
Introducing Blender.
Introducing Blender.
Computer Animation Ying Zhu Georgia State University
Lighting.
Working with 3Ds Max. 3Ds Max.
Computer Animation Texture Mapping.
UMBC Graphics for Games
Computer Graphics Imaging Ying Zhu Georgia State University
Frame Buffer Applications
Introduction to Ray Tracing
Presentation transcript:

Game Programming Loading assets, Materials, Lighting & Shading, Camera, Game Loop, Input Handling Informatics Engineering University of Brawijaya Eriq Muhammad Adams J. eriq.adams@ub.ac.id

Agenda Loading assets Materials Lighting & Shading Camera Game Loop Input Handling Sky Demo

Loading Assets JME3 comes with a handy asset manager that helps you keep your assets structured. assets/Interface/ assets/MatDefs/ assets/Materials/ assets/Models/ assets/Scenes/ assets/Shaders/ assets/Sounds/ assets/Textures/ build.xml src/... dist/...

Add box image texture “BrickWall.jpg” Loading Assets (cont.) Loading Textures Add box image texture “BrickWall.jpg”

Loading Assets (cont.) Load default font Loading Texts and Fonts

Loading Assets (cont.) Load Ogre Model Loading an Ogre XML Model

Loading Assets (cont.) Loading Assets From Custom Paths Load Local Zip File Loading Assets From Custom Paths Load Zip File via HTTP

.obj model didn’t came with materials Loading Assets (cont.) Ogre XML (.mesh.xml) and JME Binary (.j3o) Model included with Materials included Load models with materials Load models without materials .obj model didn’t came with materials

Loading Assets (cont.) Load Ogre Scene How to export OgreXML scenes from Blender to JME: https://docs.google.com/fileview?id=0B9hhZie2D-fENDBlZDU5MzgtNzlkYi00YmQzLTliNTQtNzZhYTJhYjEzNWNk&hl=en

Materials Default Materials Definition (in jme/core-data/Common)

Create Unshaded Material Materials (cont.) Simple Unshaded Texture Create Unshaded Material

Materials (cont.) Transparent Unshaded Texture Create Unshaded Material Activate Transparency

Materials (cont.) You have to use lit material to get nice looks. n a lit material, the standard texture layer is referred to as Diffuse Map, any material can have it. A lit material can additionally have lighting effects such as Shininess used together with the Specular Map layer, and even a realistically bumpy or cracked surface with help of the Normal Map layer.

Materials (cont.)

Materials (cont.) Create Lighting Material Set Diffuse Map Texture Set Normal Map Texture Set Shininess

Lighting & Shading JME 3 has three types of light : point light, ambient light, directional light, and spot light. A PointLight has a location and shines from there in all directions as far as its radius reaches, like a lamp. The light intensity decreases with increased distance from the light source. Create Point Light

Lighting and Shading (cont.) A DirectionalLight has no position, only a direction. It is considered “infinitely” far away and sends out parallel beams of light. It can cast shadows. You typically use it to simulate sun light. Create Directional Light

Lighting and Shading (cont.) An AmbientLight influences the brightness of the whole scene globally. It has no direction and no location, and does not cast any shadow. SpotLight is WIP (Work In Progress) … Create Ambient Light

Lighting and Shading (cont.) BasicShadowRenderer, Use the Shadow Renderer to make textured scene nodes cast and receive shadows. http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/test/jme3test/light/TestShadow.java Switch Off default Shadow and Add BasicShadowRenderer Scene Processor

Lighting and Shading (cont.) Then you need set shadows for every scene that need shadows

Lighting and Shading (cont.) PSSM shadow renderer, The PSSM shadow renderer can cast real-time shadows on curved surfaces. To activate it, add a jME SceneProcessor named com.jme3.shadow.PssmShadowRenderer to the viewPort

Lighting and Shading (cont.) You can set the following properties on the pssmRenderer object: setDirection(Vector3f) – the direction of the light setLambda(0.65f) – Factor to use to reduce the split size setShadowIntensity(0.7f) – shadow darkness (1 black, 0 invisible) setShadowZextend() – distance how far away from camera shadows will still be computed Then you need set shadows for every scene that need shadows http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/test/jme3test/light/TestPssmShadow.java

Camera JME 3 have 3 types of built-in camera : Default Camera, FlyBy Camera, Chase Camera. Default Camera, The default com.jme3.renderer.Camera object is cam in com.jme3.app.Application. Has default settings. Width and height are set to the current Application's settings.getWidth() and settings.getHeight() values. Frustum Perspective: Frame of view angle of 45° along the Y axis Aspect ratio of width divided by height Near view plane of 1 wu Far view plane of 1000 wu Start location at (0f, 0f, 10f). Start direction is looking at the origin.

Camera (cont.)

Camera (cont.) FlyBy Camera, The flyby camera is an extension of the default camera in com.jme3.app.SimpleApplication. It is preconfigured to respond to the WASD keys for walking forwards and backwards, and for strafing to the sides. Move the mouse to rotate the camera, scroll the mouse wheel for zooming in or out. The QZ keys raise or lower the camera.

Camera (cont.)

Camera (cont.) Chase Camera, jME3 also supports a Chase Cam that can follow a moving target Spatial (com.jme3.input.ChaseCamera).

Camera (cont.) Multiple Camera Views, You can split the screen and look into the 3D scene from different camera angles at the same time. In this example, we create four views (2×2) with the same aspect ratio as the normal view, but half the size.

Camera (cont.) Setup first view Setup 2nd – 4th view

Camera (cont.) Resizing and positioning viewport. See TestMultiViews.java

Game Loop Initialization (simpleInit()) If exit is requested, then cleanup and destroy Input handling (listeners) Update game state Application States update User update (simpleUpdate() method) Entity logical update (Custom Controls) render Application States rendering Scene rendering User rendering (simpleRender() method) Repeat (goto 2)

Input Handling 3 types input handling that JME 3 support : Keyboard, Mouse, and Joystick. Type of Trigger :

Input Handling (cont.)

Input Handling (cont.) Add trigger mapping One trigger One Action Multiple Trigger One Action

Input Handling (cont.) Create Listeners, JME 3 has 2 type of listeners : com.jme3.input.controls.AnalogListener Use for continuous and gradual actions. Examples: Walk, run, rotate, accelerate vehicle, strafe, (semi-)automatic weapon shot JME gives you access to: the name of the triggered action. a gradual value between 0-9 how long the key has been pressed. com.jme3.input.controls.ActionListener Use for absolute “pressed or released?”, “on or off?” actions. Examples: Pause/unpause, a rifle or revolver shot, jump, click to select. a boolean whether the key is still pressed or has just been released.

Input Handling (cont.) Register Mappings to Listeners, To activate the mappings, you must register them to the Listener.

Input Handling (cont.) Implements Action

To Create Sky Box set sphere boolean value to false You can use any Node as sky, even complex sets of geometries and quads with animated clouds, blinking stars, city skylines, etc. But, if you want a simple method use SkyFactory in JME 3. To Create Sky Box set sphere boolean value to false

Demo DemoScene.zip