Monday 28 March 2016

Simple Light

Simple Light

Description: 

Example program illustrating a simple use of lighting.  Creates six spheres of different fully saturated colors. Adds a white light that slow rotates around the spheres.


USAGE:

Press "r" key to toggle (off and on) running the animation
Press "s" key to single-step animation.
The up arrow key and down array key control the time step used in the animation rate.
This will speed up or slow down the rate at which the light revolves around the spheres.
Press ESCAPE to exit.
This lighting model is build on the basis of phong model,Which supports three types of light material interactions namely Specular, ambient, diffuse. The ambient source color represents the interaction of a light source with surface whereas the specular source color is designed to produce the desired color of a specular highlights.

Lighting model is built by summing the contributions for all the light sources at each point we wish to light. For each light source, have to compute the amount of light reflected for each of the nine terms in the illumination array. The contribution can be computed for each color source by adding the ambient, diffuse, specular components.

There are four vector parameters that can set, the position of light source and amount of ambient, diffuse, specular Light associated with the source.  Both lighting should be enabled and particular source. When small amount of white light is needed, even when all light sources are turned off or disabled  following code can be used.


Glfloat global_ambient[]={0.1,0.1,0.1,0.1};

glLightModelfv(GL_LIGHT_MODEL_AMBIENT,global_ambient);


Future scope

  1. It is the basic model of Simple Move Light.
  2.  It will be used in the fields of animation. 
  3. In future this program can be improved by using of new opengl functions.
Screen Shot:



Download Program Source Code here
Download Report here

No comments:

Post a Comment