I Think I Broke It!  Free online help for your everyday computer problems

How a Graphics Card Works - Page 11

The Rendering Process - An Overview

Since some of this article might not have seemed 'in order' with respect to the complete process of producing a 3D image from start to finish, there will now be a simplified overview of the whole process. Hopefully this will bring a lot of the information you've learned together, allowing you to better visualise what's going on.

First we start with the game engine, this is a software component which is running on the computer. When you do anything in the 3D world of the game, the engine interprets this, and using the CPU/system memory, sends the relevant changes (new geometry data, textures etc...) to the graphics hardware (via the graphics card drivers) ready for the next frame to be rendered.

To build a three dimensional image, a wireframe representation of the world and all its objects must be created. These wireframes are made up from a mesh of triangles (since enough triangles of varying sizes can create any 3D object), with each point of each triangle referenced using coordinates called vertices. These triangles also have extra data associated with them (a 'normal' value which is perpendicular to the surface of the triangle). These normals can be used when making curved surfaces (to smooth out the triangles), surfaces with slight irregularities (bump mapping), surfaces with more realistic lighting effects, and many other things.

Obviously at this stage, doing any operations on parts of the world would be a bit silly, since only a small proportion of it will actually be seen by the 'virtual camera' - the viewpoint of the player (the viewing frustum). To reduce the amount of information substantially, a culling process removes any objects that aren't visible through the camera (frustum culling).

The remaining triangles and their associated data are submitted to the vertex processing stage, this converts the triangles from 3D to 2D. The first part of this process, uses details of the camera location and the location of the current object to transform the vertices of each triangle (this bit is aptly named the 'transformation'). Once this is complete, the normals of each triangle, and the locations of any light sources are used to perform real-time, per-vertex lighting.

 

Transform and lighting
In modern 3D games with complex scenes and detailed lighting effects, the high number of points to be transformed and lit can be computationally demanding. Modern graphics cards now feature something called hardware transform and lighting (most commonly referred to as 'Hardware T&L'). This accelerates the two key stages of the rendering process.

Transform refers to the task of converting spatial coordinates, (such as moving 3D objects in a virtual world) to a two-dimensional view. Lighting refers to the task of using the normals to calculate the resulting colour of surrounding objects as light falls upon them.

 

Next up is some further culling which removes the backs of any objects (backface culling), as well as clipping partially visible triangles into smaller ones. The vertices are then mapped to the correct positions on the 2D screen, before the whole scene is rasterised into pixels.

During rasterisation, colour values for each pixel are calculated for further effects (lighting/fog etc..). Then texture maps (such as 'skin/wood/metal' and whatever other materials are in the game) are then sampled and applied to every pixel in the 2D triangle. This whole time filtering is being applied to prevent texture distortion, as well as MIP mapping (to both speed up rendering and reduce shimmering when textures are scaled) and bump mapping (which makes surfaces look more realistic, giving them a visible texture).

Lastly we have some texture blending, and functions like Z-buffering (which is simply the removal of the portions of objects that are hidden by other objects from the cameras viewpoint), followed by a little frame buffer blending (this process simply determines how the pixel being worked on blends with those already in the frame buffer, as well as providing a way for developers to add effects like 'motion blur' easily).

Once the rasterisation process is complete, all of the triangles in the current frame will have been converted into pixels and stored in the frame buffer. This digital representation of the scene is then either sent digitally, from the frame buffer directly, to a suitable DVI-I output/monitor combination, or to the RAMDAC, which converts the digital signal into varying analogue voltages, which are then sent via the VGA output to a suitable monitor.

In either case, the 2D raster frame is recreated on the monitor screen, pixel by pixel, with each pixel displaying varying amounts of red/blue/green to produce the desired colour.

As you can see, if I had attempted to start this article from 'the beginning', a few concepts might have been a little overwhelming without knowing some of the basics first!


<<< Previous 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 Next >>>

Article Navigation:

Latest Question

Stop Automatic Restarts after Automatic Windows Updates - After leaving my computer to encode a large video the other day, I was surprised to come back and find it sitting at the login screen. ...

View Full Question & Answer
 

Search
To search the site, enter your search string in the box below: