Lighting

API stands for Application Programming Interface, API is a source code interface which is used by operating systems or libraries to supports request for services to be made of it by computer programs. To simplify that an API is a piece of software that sits between the programmer and a program. The program comes already set up with functions but it needs some more code to be entered to perform those functions. To get the functions to work the programmer types the code into the API which places it into the programme which then performs the task. Here are some examples of API’s, OpenGL, DirectX, Google Maps API, Youtube API and MediaWiki API.

 Here is an example of some API coding.

OpenGL offers 3 forms of lighting. The first is per polygon lighting the second is per vertex lighting and the third is per pixel lighting. In vertex lighting you determine how many polygons are touching one of the vertex’s, them take the mean of all the polygons orientations which we call the normal and assign the normal to the vertex.

The advantage of vertex lighting is that the hardware will help complete the task faster by using hardware transform and lighting (T&L). The disadvantages of this is that shadowing will not be produced on the model. For example, both arms on the model will be lit the same way, even if the light is on the right side of the model, the left arm will be lit the same and no body shadow will be cast.

Shaders are a graphic resource that are used to render graphical objects in a 3D world. The shader is actually a part of the renderer, which is used to calculate the colour of an object.

Gouraud is a method of shading that is used to differ the effects of light and colour on a 3D object. Gouraud is used to smooth lighting across low-polygon object without the heavy computational requirements used by calculating the light for each pixel.

Phond shading is a layered version of shading. It begins with an ambient, it then adds a diffuse and specular. This reveals the fully lit 3D model.

I would use the phong method as it is an easier method in my opinion.

Here is an example of some shading.

Leave a Reply