Friday, February 15, 2013

Graphics Assignment 5

This assignment was really easy and I was able to whip it up in a couple of hours.


Changes:
- Changed the format of .scene file a little. You can now set the ambientLight of the scene and the attenuation factor of the point light.

- I calculate the newIntensity of light based on the attenuation factor like this:

float lightDistance = length( pointLight_position - i_position_world );
float newIntensity = saturate( pointLight_intensity - (lightDistance * attenuationFactor ) );

So the attenuation factor should be between 0 and 1. 0 being strongest and 1 being weakest i.e. no light.

- Created new fragment shader for specular lighting and made changes to the old one to add support for the attenuation factor, and created a corresponding effect file.

- Changed the format of .material file. You can now set the specularExponent of each material.

- Added a plane and some more cubes ( half of the cubes have only diffuse lighting and the rest have diffuse and specular lighting ).



Instructions:
- Move the light in the x and y plane using W,A,S,D
- Move the light forward and backward using R,F
- Move the camera using the arrow keys.


Notes:
I had no issues with this assignment but one, where the specular lighting was looking really bright and I realized that I forgot to multiply it by the light intensity.

No comments:

Post a Comment