Wednesday, 15 October 2014

Blog 2: Coordinate Spaces

There are six coordinate spaces used in games and computer graphics when transforming geometry which are: object space, world space, view space, clip space, normalized device space, and screen space.

-          Object Space: Object space is the position of the object’s vertices specified relative to a Cartesian coordinate system. The object space origin is usually placed at the centre of the object. Object space is also known as model space or local space. Objects will have three axis along object space origin called front, up, and left/right.
o   Front: This axis points in the direction that the object is travelling or facing.
o   Up: This axis points towards the top of the object.
o   Left/Right: This axis points towards the left or right depending on whether the game engine uses left-handed or right-handed coordinates.

-          World Space: World space is a fixed coordinate space, where the positions, orientations and scales of all objects in the game world are expressed. World space ties all the individual objects together into the game world. The world space origin can be at any location the developers decide, but is often near the centre of the playable game space.

-          View Space: View space is a coordinate frame fixed to the camera. View space is the world relative to the location of the viewer. The view space origin is located at the focal point of the camera. View space is also known as eye space or camera space. The camera faces in the opposite direction between the left-handed and right-handed coordinate system.
o   Left-Handed Coordinate: The camera is facing towards positive Z.
o   Right-Handed Coordinate: The camera is facing towards negative Z.

-          Clip Space: Clip space is where entities are projected before projecting objects to the screen. The clip space will decide whether the vertex will be culled or not outside the frustum. Applying a projection will get the entities from view space to clip space.

-          Normalized Device Coordinates (NDC): Normalized device coordinates creates a coordinate system that define positions of the objects in view. After applying a projection to clip space, the points will not be normalized. This can be fixed by dividing all components of the vertex by ‘w’.

-          Screen Space: Screen space is where all objects are rendered to screen space. The screen space is a 2D space. The screen space origin is in the middle of the screen. The screen space is also known as window space.


http://www.gamerendering.com/wp-content/uploads/geometrypipeline.jpg

Friday, 26 September 2014

Blog 1: Terms and ECS


On the first week of Game Engine Design our professor, Saad R. Khattak, stated that there are certain terms and concepts that every student must know and must be familiar with.

Terms you must know:
-          Stack: A stack is an area of the computer’s memory that temporary stores variables, and automatically manages memory for you. The size of the stack changes as functions push and pop local variables, but the stack does have a size limit on the variables that it can store. The stack can access variables faster than the heap, but can only access local variables.

-          Heap: A heap is an area of the computer’s memory that temporary stores variables, but does not automatically manage memory for you. The heap does not have a limit on memory size and can be accessed globally, but it is slower to access those variables due to the use of pointers to access the memory on the heap. The heap can cause memory leaks in your program if you do not allocate and deallocate memory properly.

Concepts you must be familiar with:
-          Pointers: The value of a pointer is the value of another object that is stored elsewhere in the computer’s memory using its address.
-          Containers: Containers are classes, data structures, or abstract data type that are used to store objects in an organized way.
-          Iterators: An iterator is an object that enables a programmer to navigate a container.
-          Templates: Template is a feature that allows functions and classes to operate with any data type.
-          Template Inheritance: Template inheritance is a method to manage templates. Template inheritance can inherit contents of one template to another, and can change certain contents.
-          Callback Functions: Callback is part of a code that is passed as an argument to another code, which is then expected to execute in a different point in time.
-          Macros: Macros are a set of instruction that tells how certain inputs should be mapped in order to a replacement output.
-          Algorithms: Algorithms are a list of procedures for calculations.
-          String Manipulation: String manipulation is how to manage or handle a sequence of characters.

Our professor also introduced a topic called "Entity Component System (ECS)".


Entity Component System (ECS)
-          An engine is a data driven design that needs a component and a system to operate. There are three components to the ECS are the entity, the component, and the system.
o   Entity: The entity is a general purpose object, usually only consists of a unique ID.  The entity can be thought to be like a key without a purpose.
o   Component: The component is the raw data for the object, and how it interacts with the world. The component can be thought to be like the characteristics to give a key a purpose.
o   System: Each system runs and performs actions continuously on every entity that possess the same component with that system. The system can be thought to be like a lock that only works with correct key.