2. Displaying 3D Polygon Animations



How are 3D models displayed?
A 3D model is basically  done by a process of developing mathematical representation of any three-dimensional surface of an object. This is because 3D models use a collection off Points in 3D Space, connected by various geometric entities such as triangles, lines, curved surfaces, etc. Being a collection of data. 3D models can be created by hand, algorithmically (procedural modelling), or scanned. Their surfaces may be further defined with texture mapping.The basic idea of 3D graphics is to turn a mathematical description of a world into a picture of what that world would look like to someone inside the world. The mathematical description could be in the form of a list, For instance: If there is a Chair someone in the game will be able to see the chair from the side, back and front of the chair. Just Like we will be able to in real life. The only difference is, Computers dont see it as a chair they see it as a chair full of triangles and colours. For example, to the right is a box. In that box is several triangles and colours, This is how the computer will create any object using maths although it can be alot more difficult for instance In the picture below of a viking helmet.


What is a application programming interface (API)?
API means application programming interface. This is a application which passes information onto other applications for instance If I am on Microsoft word and I copy something and paste it onto google chrome, API is usually what structures and responses to that request. APIs do all this by “exposing” some of a program’s internal functions to the outside world in a certain way. That makes it possible for applications to share data and take actions on one another’s behalf without requiring developers to share all of their software’s code.Almost every application depends on the APIs of the underlying operating system to perform such basic functions as accessing the file system.This is done by sets of routines, protocols, and tools for building software applications. Although API isnt that nessacry, For instance if their was a app for the weather; If it had API, the API will message a weather website which is then replied with a structured response and the website is then updated regularly. However without a API, the app will have to go on to a weather website to see what the current weather is in a certain location almost read it like a human would do. Doing this can be risky because if there is any change to the website then the app may get confused and become unresponsive simply because the app will not understand the website. 

OpenGL
Open Graphics Library (OpenGL) is a cross-language, cross-platform application programming interface (API) for rendering 2D and 3D vector graphics. The API is typically used to interact with a graphics processing unit (GPU), to achieve hardware-accelerated rendering.

Open Inventor
Open Inventor is a high-performance 3D software development toolkit (SDK) for professional applications in Medical, CAD & Engineering, Oil & Gas and Mining.

Its object-oriented API, its extensible architecture, and its large set of advanced components provide software developers with a high-level platform for rapid integration of 2D/3D data visualization and processing capabilities into industrial and scientific applications.

Direct3D
Direct3D uses hardware acceleration if it is available on the graphics card, allowing for hardware acceleration of the entire 3D rendering pipeline or even only partial acceleration. 


What is a graphic Pipeline? 
A graphic Pipeline is basically when a 3D model has been created and is being put into a video game. Pipeline is the progress of when a 3D model is being turned into what the computer displays. Graphic Pipe line has many different stages involved in it; 

Stages

Firstly the scene is created which is done by geometric primitives which is usually a triangle. Next the Transform from the local coordinate system to the 3d world coordinate system. For instance A model of a Car in abstract is placed in the coordinate system of the 3d world.Once that is done the graphic pipeline starts to Transform the 3d world coordinate system into the 3d camera coordinate system, using the camera as the orgin. The next stage is then lighting which the graphic pipeline Illuminates according to lighting and reflectance. For example If the Car is a Bright Red color, but in a black room, then the camera sees it as black. In this step the effect of lighting and reflections are calculated by the graphic pipeline to stop this from happening. Projection transformation is the next stage, This is when the graphic pipe line Transforms the 3d world coordinates into the 2d view of the camera, for instance the object the camera is centered on would be in the center of the 2d view of the camera.In the case of a Perspective projection, objects which are distant from the camera are made smaller. This is achieved by dividing the X and Y coordinates of each vertex of each primitive by its Z coordinate(which represents its distance from the camera). In an orthographic projection, objects retain their original size regardless of distance from the camera. The next stage which is called clipping is quite simple for instance clipping is when the graphic pipeline basically stops Geometric primitives that can no longer be seen in the viewing frustum become invisible.  Scan conversion or rasterization is the next stage and this is where 2D image space representation of the scene is converted into raster format and the correct resulting pixel values are determined. From now on, operations will be carried out on each single pixel. This stage is rather complex, involving multiple steps often referred as a group under the name of pixel pipeline. Texturing and fragment shading is the final stage and this is where the pipeline individual fragments (or pre-pixels) are assigned a color based on values interpolated from the vertices during rasterization, from a texture in memory, or from a shader program.


1: 3D geometric primitives
First, the scene is created out of geometric primitives. Traditionally this is done using triangles, which are particularly well suited to this as they always exist on a single plane.

2: Modelling and transformation
Transform from the local coordinate system to the 3d world coordinate system. A model of a Car in abstract is placed in the coordinate system of the 3d world.

3: Camera transformation
Transform the 3d world coordinate system into the 3d camera coordinate system, with the camera as the origin.

4: Lighting
Illuminate according to lighting and reflectance. If the car is a bright red  color, but in a totally black room, then the camera sees it as black. In this step the effect of lighting and reflections are calculated.

5: Projection transformation
Transform the 3d world coordinates into the 2d view of the camera, for instance the object the camera is centered on would be in the center of the 2d view of the camera. In the case of a Perspective projection, objects which are distant from the camera are made smaller. This is achieved by dividing the X and Y coordinates of each vertex of each primitive by its Z coordinate(which represents its distance from the camera). In an orthographic projection, objects retain their original size regardless of distance from the camera.

6: Clipping
Geometric primitives that now fall completely outside of the viewing frustum will not be visible and are discarded at this stage.

7: Scan conversion or rasterization
Rasterization is the process by which the 2D image space representation of the scene is converted into raster format and the correct resulting pixel values are determined. From now on, operations will be carried out on each single pixel. This stage is rather complex, involving multiple steps often referred as a group under the name of pixel pipeline.

8: Texturing, fragment shading
At this stage of the pipeline individual fragments (or pre-pixels) are assigned a color based on values interpolated from the vertices during rasterization, from a texture in memory, or from a shader program.