GAM531 DPS931 – Week 5 The Scene. Reviewing the Engine Engine DX11 Device GL 4.3 Device ControllerManagerModel DX11 Object GL 4.3 Object DX 11 API GL.

Slides:



Advertisements
Similar presentations
Graphics Pipeline.
Advertisements

Status – Week 257 Victor Moya. Summary GPU interface. GPU interface. GPU state. GPU state. API/Driver State. API/Driver State. Driver/CPU Proxy. Driver/CPU.
Computer Graphic Creator: Mohsen Asghari Session 2 Fall 2014.
GAM531 DPS931 – Week 11 Render State. The Render State Render State BuffersShadersSamplers Rasterizer State Blend State.
GAM532 DPS932 – Week 7 Introduction to shadows. Shadow Effects Light Surface No Shadows Shadows.
Intro to Java Monkey Engine Download JME loads/ loads/
MAT 594CM S2010Fundamentals of Spatial ComputingAngus Forbes Overview Today: - Make sure everyone is set up with an OpenGL environment - OpenGL basics:
GLSL I May 28, 2007 (Adapted from Ed Angel’s lecture slides)
GLSL I Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University of New Mexico.
Further Programming for 3D applications CE Introduction to Further Programming for 3D application Bob Hobbs Faculty of Computing, Engineering and.
Mohan Sridharan Based on slides created by Edward Angel GLSL I 1 CS4395: Computer Graphics.
Graphical Objects and Scene Graphs CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Models and Architectures Ed Angel Professor of Computer Science, Electrical and Computer.
GAM532 DPS932 – Week 1 Rendering Pipeline and Shaders.
GAM531 DPS931 – Week 1 Introduction. Professors Joseph Hughes Info: scs.senecac.on.ca/~jp.hughes T2104 Roles: Primary Lecturer.
GAM531 DPS931 – Week 9 OpenGL 4.3 and Direct X 11.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
CHAPTER 4 Window Creation and Control © 2008 Cengage Learning EMEA.
Programming Concepts. Derive a new class from Activity of the framework Prepare the data beforehand, e.g., vertices, colours, normal vectors, texture.
CSE 381 – Advanced Game Programming Basic 3D Graphics
Geometric Objects and Transformations. Coordinate systems rial.html.
GAM531 DPS931 – Week 10 Meshes and Buffers. Breaking Down An Image Actors Actors = Mesh + Material Mesh = Shape of the object.
Graphical Objects and Scene Graphs 1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009.
OpenGL Shading Language (Advanced Computer Graphics) Ernest Tatum.
Chris Kerkhoff Matthew Sullivan 10/16/2009.  Shaders are simple programs that describe the traits of either a vertex or a pixel.  Shaders replace a.
CSC 461: Lecture 3 1 CSC461 Lecture 3: Models and Architectures  Objectives –Learn the basic design of a graphics system –Introduce pipeline architecture.
GAM532 DPS932 – Week 8 Texture Shadow Implementation.
CSE Real Time Rendering Week 2. Graphics Processing 2.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Computer Graphics The Rendering Pipeline - Review CO2409 Computer Graphics Week 15.
1Computer Graphics Lecture 4 - Models and Architectures John Shearer Culture Lab – space 2
GAM532 DPS932 – Week 2 Vertex Shaders. The Shader Pipeline Vertex Processing Primitive Assembly / Processing Rasterization Fragment Process Pixel Output.
1 Manage Mesh Data Chapter 8. 2 How to manage Mesh data The most important two objects of mesh are VertexBuffer and IndexBuffer, which can obtained by.
GAM531 DPS931 – Week 2 Into the Engine. Last Time in GAM531… Engine Core Client Interface Operating System API Device API Engine DX11 Device GL 4.3 Device.
Useful Tools for Making Video Games Part II An overview of.
Game Programming 07 OGRE3D Mesh in Action 2010 년 2 학기 디지털콘텐츠전공.
Scene Graph & Game Engines. 2 Limitations of Immediate Mode Graphics  When we define a geometric object in an application, upon execution of the code.
2009 GRAPHICS : PROJECT 1 BASED ON DX9 BASICS. Documented by Dongjoon Kim SNU CS Ph.D Course Student Contact : NOTE.
Geometric Objects and Transformations. Graphics Pipeline How can we render a triangle? High-level description: – Represent the 3D geometry – Transform.
Models & Hierarchies CSE167: Computer Graphics Instructor: Steve Rotenberg UCSD, Fall 2006.
Week 3 Lecture 4: Part 2: GLSL I Based on Interactive Computer Graphics (Angel) - Chapter 9.
1 Angel: Interactive Computer Graphics5E © Addison- Wesley 2009 Image Formation Fundamental imaging notions Fundamental imaging notions Physical basis.
Attack of the Clones Image source:
Graphical Objects and Scene Graphs Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
 Learn some important functions and process in OpenGL ES  Draw some triangles on the screen  Do some transformation on each triangle in each frame.
What are shaders? In the field of computer graphics, a shader is a computer program that runs on the graphics processing unit(GPU) and is used to do shading.
OpenGL Shading Language
3D Objects in WebGL Loading 3D model files. Announcement Midterm exam on 12/2 –No Internet connection. –Example code and exam questions will be on USB.
Programming with OpenGL Part 3: Shaders Ed Angel Professor of Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive.
Chapter 1 Graphics Systems and Models Models and Architectures.
1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Models and Architectures 靜宜大學 資訊工程系 蔡奇偉 副教授 2012.
Computer Science – Game DesignUC Santa Cruz Tile Engine.
COMP 175 | COMPUTER GRAPHICS Remco Chang1/XX13 – GLSL Lecture 13: OpenGL Shading Language (GLSL) COMP 175: Computer Graphics April 12, 2016.
Graphical Objects and Scene Graphs
Understanding Theory and application of 3D
Models and Architectures
Models and Architectures
Models and Architectures
Introduction to Computer Graphics with WebGL
GAM531 DPS931 – Week 9 OpenGL 4.3 and Direct X 11.
GLSL I Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University of New Mexico.
Understanding Theory and application of 3D
Chapter VI OpenGL ES and Shader
Models and Architectures
Models and Architectures
Programming with OpenGL Part 3: Shaders
03 | Creating, Texturing and Moving Objects
CS 480/680 Computer Graphics GLSL Overview.
Frame Buffer Applications
CS 480/680 Fall 2011 Dr. Frederick C Harris, Jr. Computer Graphics
Presentation transcript:

GAM531 DPS931 – Week 5 The Scene

Reviewing the Engine Engine DX11 Device GL 4.3 Device ControllerManagerModel DX11 Object GL 4.3 Object DX 11 API GL 4.3 API DX 11 API GL 4.3 API 1 m 1 1 or 1 1 or 1 1 iEngine iController iModel

Expanding the Engine Engine iEngine Engine Engine iEngine Singleton > class Engine : public iEngine, public Singleton >

Expanding the Controllers Controller iControlleriSceneControlleriResourceController SceneController ResourceController WindowController class ResourceController : public iResourceController class SceneController : public iSceneController class WindowController

Expanding the Managers Manager Singleton > NodeManager BaseManager > class NodeManager : public Singleton >, public BaseManager >

Expanding the Manager Bases BaseManager template class BaseManager { protected: ArrayList objects; ArrayList activeObjects; … } IterativeManager template class IterativeManager : public BaseManager { protected: typename ArrayList ::iterator it; … } template class ResourceManager { protected: HashMap resources; … } ResourceManager BMIM RM

Expanding all Managers S MeshManager S ActorManager IM S SamplerManager S CameraManager IM S TextureManager S LightManager IM S VertexFormatMa nager RM S NodeManager BM S WindowManager BM S BlendStateMana ger S ShaderManager S MaterialManager RM RM RM RM RM

Expanding the Models Model iModel Resource iResource Node iNode SModel iSModel SceneObject

Expanding the Resource Models BlendState BlendState iBlendState Material Material iMaterial Mesh Mesh iMesh Texture Texture iTextureiTextureSampler TextureSampler iVertexFormat VertexFormat Shader VertexShader FragmentShader

Expanding the Scene Models Actor Actor iActor Camera Camera iCamera Light Light iLight Node Node iNode SceneObject iSceneObject

One last look at the simple engine… Engine DX11 Device GL 4.3 Device ControllerManagerModel DX11 Object GL 4.3 Object DX 11 API GL 4.3 API DX 11 API GL 4.3 API 1 m 1 1 or 1 1 or 1 1 iEngine iController iModel

Engine Engine SceneController ResourceController MeshManager ActorManager SamplerManager CameraManager BlendStateManager ShaderManager VertexFormatManag er RM RM MaterialManager RM RM RM TextureManager RM NodeManager BM IM IM LightManager IM DX11 Device GL 4.3 Device Node m Light SO Camera SO Actor SO m m m BlendState m Texture m Mesh m TextureSampler m VertexFormat m Material m m m m Sh Sh VertexShader FragmentShader Interface Singleton Contains (m = many) Either or (only one) Base Class RM = Resource Manager BM = Base Manager IM = Iterative Manager Sh = Shader SO = SceneObject DX/GL API Wrapper DX/GL Uniform Buffer

Looking into the code Engine.hpp template class Engine: public iEngine, public Singleton > { private: … //Controllers SceneController sCont; ResourceController rCont; //Devices Device dev; … } SceneController.hpp template class SceneController : public iSceneController { … public: ActorManager actMan; CameraManager camMan; LightManager lgtMan; NodeManager nodMan; … } Managers.hpp template class LightManager : public Singleton >, public IterativeManager > { … }

Looking into the code… Light.hpp template class Light : public SceneObject { private: LightType type; Color diffuse; Color specular; Vector attenuation; Vector spot; … } SceneObject.hpp template class SceneObject : public I { protected: bool active; Node * node; UniformBuffer buffer; … } Buffers.hpp template class UniformBuffer : public Buffer {…} template class Buffer { protected: APIBuffer * buffer; ArrayList dynamIndex; uint32 byteSize; uint32 indexSize; uint32 padding; … }

Graphics Buffers Struct Light { int type; int state; } Light a; type state Light a System Memory type state Light a Graphics Memory UniformBuffer lb; lb.addType (); lb.addType (); lb.fill((byte*)&a, sizeof(Light));

Engine Engine SceneController ResourceController MeshManager ActorManager SamplerManager CameraManager BlendStateManager ShaderManager VertexFormatManag er RM RM MaterialManager RM RM RM TextureManager RM NodeManager BM IM IM LightManager IM DX11 Device GL 4.3 Device Node m Light SO Camera SO Actor SO m m m BlendState m Texture m Mesh m TextureSampler m VertexFormat m Material m m m m Sh Sh VertexShader FragmentShader Interface Singleton Contains (m = many) Either of (only one) Base Class RM = Resource Manager BM = Base Manager IM = Iterative Manager Sh = Shader DX/GL API Wrapper DX/GL Uniform Buffer The Scene

What is the Scene? Actor NodeID: 1029 MeshID: MaterialID: 212 Light NodeID: 909 Diffuse: Type: Point Camera NodeID: 123 Field of View: 1.2 Aspect: 1.25

Scene Node Node Matrix localT; Scene Object ArrayList *> objects; Node ArrayList children; Node* parent; Node Node Node Scene Object

Scene Node Example [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ]

Scene Node Example [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ]

Node Class template class Node : public iNode { private: Matrix localT; Matrix _tempAbs; uint32 nIndex; Node* parent; ArrayList children; ArrayList *> objects; public: … void _addChild(Node* a); void _removeChild(Node*); void _notifyAttach(SceneObject * a); void _notifyDetach(SceneObject *); }; The local transformation of Node The calculated absolute transformation of the Node for this frame, refreshed before each render The parent of the node, null if the node is a root node All of the nodes to which this node is the parent node All of the scene objects that are attached to this node Adds/Removes a node from the children list Adds/Removes a scene object from the objects list

Scene Node Scene Object Node Node Node Node

SceneObject Class template class SceneObject : public I { protected: bool active; Node * node; UniformBuffer buffer; SceneObject(); virtual ~SceneObject(); public: void attachTo(const iNode* n); const iNode* getNode() const; bool isActive(); inline void _bindVertex(uint32 slot); inline void _bindFragment(uint32 slot); }; Indicates if the object is part of it’s manager’s active objects list The node that the scene object is attached to, null if it is not in the scene A Uniform Buffer which enables the scene object to store information on the graphics card for use when rendering Protected Ctor and Dtor to prevent scene objects from being instantiated Used to attach the scene object to a node Returns the node the object is attached to Binds the data in “buffer” to a specific slot in the graphics card (for vertex and fragment shaders)

Scene Node Scene Object Node Node Node Node Actor

What is an Actor? Everything you see in the game world is an actor! Things that are not actors: - The sky - The HUD (heads up display)

What makes up an Actor? template class Actor : public SceneObject { private: Material * mat; Mesh * mesh; … }; MeshMesh + Material

Scene Node Node Node Node Node Scene Object Actor Light

What is a Light? template class Light : public SceneObject { private: LightType type; Color diffuse; Color specular; Vector attenuation; Vector spot; … }; Directional Light Point LightSpot Light

What does a light do? 1 Actor, 0 Lights 0 Actors, 1 Light 1 Actor, 1 Light 1 Actor, 2 Lights

Scene Node Node Node Node Node Scene Object Actor Light Camera

What is a Camera? template class Camera : public SceneObject { private: Matrix projMatrix; float fov; float aspect; float nearClip; float farClip; RasterizerState rend; … }; Field of View Field of View * Aspect Ratio Near Clipping Plane Far Clipping Plane

How does the camera work? Clipping Planes Field of View & Aspect Ratio Large FOV (1.57 rad) Small FOV (0.39 rad) Wide Aspect Ratio (5.71)

Scene Node Node Node Node Node Scene Object Actor Light Camera

To Do Do some basic research on your team’s enhancement Begin writing your enhancement proposal document (due Oct 18 th ) Read course notes (week 1 – 6) in preparation for Mid-term next week