Thursday, 20 June 2013

3D The Basics Task 2: Displaying 3D Polygon Animations


API

API (Application Program Interface) is a set of protocols, routines, and different tools for building software applications. Very good API’s make it easier to develop a program by providing all the building blocks. A programmer will then put the blocks together.
Most operating environments, such as Microsoft’s-Windows provide an API so that a programmer can write applications that are consistent with the operating environment. APIs are designed for programmers; they are very good for users because they guarantee that all programs using a common API will have similar interfaces. This can make it easier for users to learn new programs.

Direct3D

Direct3D is an API program for manipulating and displaying three-dimensional objects. Which is developed by Microsoft, Direct3D gives programmers a way to develop 3-D programs that can utilize whatever graphics acceleration device is installed on the machine. Virtually mostly 3-D accelerator cards for PCs support Direct3D.

OpenGL

OpenGL is a 3-D graphics language developed by Silicon Graphics. There are two common implementations: Microsoft OpenGL that’s developed by Microsoft and Cosmo OpenGL that is developed by Silicon Graphics. Microsoft OpenGL is already built into Windows NT (Family of operating systems) and has been designed to improve the performance on hardware that supports the OpenGL standard. The Cosmo OpenGL on the other hand is a software-only implementation specifically designed for machines that do not have a graphics accelerator.

Graphics Pipeline

In 3D computer graphics, the terms graphics pipeline or rendering pipeline is most commonly referred to the way in which the 3D mathematical information contained within the scenes and objects are converted into images and video. The graphics pipeline will accept some representation of a three-dimensional primitive as input and results in a 2D raster image as output. Direct3D and OpenGL are two notable 3D graphic standards where both describing very similar graphic pipelines.



Stages of the graphics pipeline:

Per-vertex lighting and shading

Geometry in the complete 3D scene is lit according to the specific locations of reflectance, light sources, and other surface properties. Some older hardware implementations of the graphics pipeline compute lighting only at the vertices of the polygons being rendered. The lighting values between the vertices are then interpolated during rasterization. Per-pixel lighting or Per-fragment, as well as other effects, can be done on modern graphics hardware as a post-rasterization process by means of a shader program. Modern graphics hardware will also support per-vertex shading through the use of vertex shaders.

Clipping

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

Projection Transformation

In the case of a Perspective projection, objects that are distant from the camera are made smaller. This can be 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 will retain their original size regardless of the distance from the camera.

Viewport Transformation

The post-clip vertices are transformed once again to be in the window space. This transformation is very simple: applying a scale (multiplying by the width of the window) and a bias (adding to the offset from the screen origin). At this stage, the vertices have coordinates that are directly related to the pixels in a raster.

Scan Conversion or Rasterisation

Rasterisation is the process where the 2D image space representation of the scene is converted into raster format and the correct resulting pixel values are determined. The operations will be carried out on each single pixel. This stage is very complex, involving multiple steps often referred as a group under the name of pixel pipeline.

Texturing, Fragment Shading

This stage of the individual pipeline fragments or pre-pixels are assigned a colour based on the values interpolated from the vertices during rasterization from a texture in memory or from a shader program.

Display

The final coloured pixels can then be displayed on a computer monitor or any other form of display.

No comments:

Post a Comment