3D Game Development Intro to Game Engines Jay Urbain, Ph.D. SE3250 OpenGL Programming Guide: http://www.glprogramming.com/red/ http://people.msoe.edu/~urbain/cs421/index.html http://jmonkeyengine.org
Game engine System designed for the creation and development ofvideo games. Software framework for developers. Core functionality: rendering engine for 2D or 3D graphics physics engine for collision detection/response Sound Scripting Animation AI Networking, streaming, memory management, threading, localizationsupport, and ascene graph.
Game engine The process ofgame developmentis often economized, in large part, by reusing/adapting the same game engine to create different games. Select appropriate Game Engine from engine attributes (previous slide). Use Java Monkey (jme3) as exemplar.
jmonkeyengine(jme) Game engine made for 3D development. Usesshadertechnology extensively. jmonkeyengineis written injavaand useslwjglas its default renderer. OpenGL 2 through OpenGL 4 is fully supported. jmonkeyengine is a collection of libraries, making it a lowlevelgame development tool. Coupled with anidelike the officialjmonkeyengine 3 SDKit becomes a higher level game development environment with multiple graphical components (NetBeans).
3D Graphics and Audio OpenGLis the Open Graphics Library, a platform-independent specification for rendering 2D/3D computer graphics. Alternatively, Microsoft XNAis a set of tools and runtime environment for video game development and management. XNA is based on.net Compact Framework2.0 for Xbox 360 development and.net Framework 2.0 on Windows. For Java, there are two implementations of OpenGL-based renderers: Lightweight Java Game Library (LWJGL) jme3 uses lwjgl. Java OpenGL (JOGL) OpenALis the Open Audio Library, a platform-independent 3D audio API.
jme-context, Display, Renderer Contextmakes settings, renderer, timer, input and event listeners, display system, accessible to a game. Display Systemis what draws the custom JME window (instead of Java Swing). TheInput Systemis the component that lets you respond to user input: Mouse clicks and movements, keyboard presses, and joystick motions. TheRendereris what does all the work of calculating how to draw the 3D scenegraphto the 2D screen. TheShaderis a programmable part of the rendering pipeline.
Scene Graph Objects in a virtual space. Virtual space where your game appears. Objects in the scene graph are called spatials. Spacials have a translation (location), rotation, and scale. Locations in the scene graph are defined using X, Y, and Z Locations in the scene graph are defined using X, Y, and Z coordinates.
Three Dimensions
Translation
Rotation
Rotation
Geometry A geometry is the type of spatial that is visible on the screen. A geometry has a mesh to define its form and a material to define its appearance.
Geometry A geometry is the type of spatial that is visible on the screen. A geometry has a mesh to define its form and a material to define its appearance. Geometry with and without material color.
Nodes Spacial that can have other spatials as children, i.e., a collection. Children of the node are moved and rotated relative to their parent node. The scene graph uses a base root node that all spatialsare connected to.
Nodes Spacial that can have other spatials as children, i.e., a collection. Children of the node are moved and rotated relative to their parent node. The scene graph uses a base root node that all spatialsare connected to.
Nodes and Geometries
Translate Geometry
Child Geometry Relative to Node
Translate Node
Translate Node
Rotate Node
Rotate Geometry (child object)
Rotate Geometry
Rotate Node about Z-Axis
Scale Node
Scale Node
Scale Child
Scale Child
Organizing with Nodes
Geometry -Polygon, Mesh, Vertex Most visible objects in a 3D scene are made up of polygon meshes game characters, terrains, buildings, etc. A meshis a grid-like structure that represents a complex shape. Mathematically simple to render in real time, and detailed enough to be recognizable. Every shapeis reduced to a number of connected polygons, usually triangles; including round surfaces. Polygons' corner points are called vertices. Every vertex is positioned at a coordinate, all vertices together describe the outline of the shape. Create 3D meshes in tools called mesh editors, e.g in Blender, Maya. jme can load finished meshes (models) and arrange them in scenes.
Materials: Color, Lighting/Shading Color" is part of an object's light reflection. Our brain uses shading and reflecting properties to infer an object's shape and material. Differentiate chalk & milk, skin & paper, water & plastic. Ambient color The uniform base color of the mesh what it looks like when not influenced by any light source. Usually similar to the Diffuse color. Min. color you need for an object to be visible. Diffuse color Base color of the mesh plus shattered light and shadows that are caused by a light source. Usually similar to the Ambient color.
No light source material color Ambient Lighting
Light Sources -Emissive color Emissive color The color of light emitted by a light source or glowing material. Only glowing materials such as lights have an emissive color, normal objects don't have this property. Often white (sun light).
Light Sources -Reflections Reflections: Shininess Degree of shininess of a surface. Shiny objects have small, clearly outlined specular highlights. (E.g. glass, water, silver) Normal objects have wide, blurry specular highlights. (E.g. metal, plastic, stone, polished materials). Uneven objects are not shiny and have no specularhighlights. (E.g. cloth, paper, wood, snow).
Light Sources -Reflections Reflections: Specular Color If the material is shiny, then the SpecularColor is the color of the reflected highlights. Usually the same as the emissive color of the light source (e.g. white). You can use colors to achieve special speculareffects, such as metallic or iridescent reflections. Non-shiny objects have a black specular color.
Materials: Textures Simplest case: object has one texture, the Color Map, loaded from one image file. The more information you provide to the Color Map, the higher the degree of detail and realism. Whether you want photo-realistic rendering or "toon" rendering (Cel Shading), everything depends on the quality of your materials and textures. Modern 3D graphics use several layers of information to describe one material, each mapped layer is a texture.
Color Map / Diffuse Map A plain image file or a procedural texture that describes an object's visible surface. The image can have alpha channels for transparency. A Color Map is the minimum texture.you can map more textures as optional improvements. Color Maps are unshaded. The same is called Diffuse Map in a Phong-illuminated material, because this texture defines the basic colors of light that are diffused by this object.