Local SpaceLocal space, or model space, is used here as the space that defines the graphical representation of an object in the game world. In this space, the origin is conventionally at the center of the object, with their vertices defined relevant to this origin. This is the space that we define the look of the cube and plane. World SpaceWorld space is the coordinate system such that there is a specific point in the world that is defined as the “origin” of the world. In our case, this origin is in the center of the screen, some space away from where our camera begins. We define the location of objects, relevant to one another, in this space. For the purposes of this assignment, the cube is located at the world origin with the plane being down a few units. Camera SpaceCamera space, is now the system where the objects are relevant to the notion that the camera itself is at the origin. This is particularly important in the last two steps of rendering an image on screen because it’s this space that helps us determine which is within the view of the camera. We begin to ask questions here like, does a given object lie within the field of view within a camera? While Field of View is more important in the final space, projected, the data in Camera space specifically tells us how the objects are located relevant to the camera’s location in the world. Projected SpaceThis is the final step to moving from a 3D world to the 2D image that we see on our monitor. This space is defined as the 2D plane that is finally rendered out of the camera based on the objects it is able to see. Questions asked here may include “Is the object in front of the camera?” or “How far away is the object from the camera?” That last one in particular is important because it will determine scale and at what size to render an object on screen, and whether or not a given object is “in front” or “behind” an object. Transitioning from Local -> World SpaceIn this example, i_position is a position defined in World Space. We can do the proper matrix math to perform the transformation by using the float4 constructor to give it a fourth field. We’ll just insert a 1 into this spot so that the math still lines up. This data is then set within the o_position parameter and used further in the rest of the file to reach the final Projected space required to render the scene out to the camera. ControlsThe Camera: [Key : Action][W : Move Forwards] [A : Move to the Left] [S : Move to the Right] [D: Move Backwards] [Space: Move UP] [Left / Right Ctrl: Move DOWN] The Cube: [Key : Action][Arrow UP : Move Forwards] [Arrow LEFT: Move to the Left] [Arrow RIGHT : Move to the Right] [Arrow DOWN: Move Backwards] [Page UP: Move UP] [Page DOWN: Move DOWN] DownloadsYou can try out these games via the below links. The only difference is that Direct3D will be used in the x64 version, with OpenGL in the other. They have been built and verified to work on Windows. ![]()
![]()
- Garin
0 Comments
Your comment will be posted after it is approved.
Leave a Reply. |
Categories |