Thursday, 17 January 2013

Graphics Pipeline and Shaders

The graphics pipeline is the process the GPU goes through to display 3d graphics in a game for example. There are various steps in this process which you don't see since it needs to complete them multiple times a second.

The first process is Vertex Processing also known as Pre-vertex lighting and shading. This is the process where is plots out all the vertices of the shapes in camera view. This is needed for a later stage because it needs to know where each model is to then display them in view.

3D Projection










The second process is clipping. This determines what can be "seen" and what can't. This varies when the game is being played as it changes once a second, maybe even more. To do this the GPU works out the co-ordinates of each of the vertex's and the distance between that and the camera. By doing this it can work out what is behind the other. Since it can't be seen at that precise moment it can hide it and not display it, saving processing power while doing this making the game run smoother overall.

Thirdly is projection transformation. This is a set of complicated calculations to again work out distance from camera. Basically this is achieved by dividing the X and Y co-eds by each of their Z co-ord. The end product of this is that no matter where the camera is, the object will keep its original size which is important for the proportion of them in the game.

Next is a process called rasterization. This is when it converts the image to a raster format. Raster images makes it so it works out each single pixel and doesn't resize it in real time. This makes it so it doesn't lag out the game and cause problems. This starts a whole other process called pixel pipeline.

Next is texturing and fragment shading. This is basically just texturing all the visible objects with the correct texture. This is done so you can tell what each item is and to make the game look better. Lighting is also done in this stage. The type of lighting changes depending how advanced the game is. The types are flat shading , gouraud shading and phong shading.

Finally the last process is display. This displays the view onto the screen for the player to see.It colours the final pixels so it can be displayed on a monitor.

No comments:

Post a Comment