Light: T – Positive Z; G – Negative Z; F – Negative X; H – Positive X; R – Add Red Light; V – Subtract Red Light; Y – Add Green Light; N – Subtract Green Light;
Camera: I – Positive Y; K – Negative Y; J – Negative X; L – Positive X; U – Positive Z; M – Negative Z; Insert – Rotate in Positive X; Delete – Rotate in Negative X; Right Arrow – Rotate in Positive Y; Left Arrow – Rotate in Negative Y; Up Arrow – Rotate in Positive Z; Down Arrow – Rotate in Negative Z
Objects: WSAD – Move Object
The project has been to add lighting to the game by means of modifying the fragment shader. The type of lighting added is called diffuse. Diffuse lighting treats lighting as a unidirectional field applied to each vertex of the mesh.
The normal to the vertex is interpolated and sent to the fragment shader where color is determined using the cosine of the angle. The cosine is obtained through the dot product since the normal vector and the diffuse lighting vector are both of unit length and the dot product is the magnitude of two vectors multiplied by the cosine of the angle between them. Light color is applied directly to that cosine angle creating a shaded look. An ambient light is also applied to the pixel to prevent the scene from being entirely dark.
The aim of the tenth assignment was to implement diffuse lighting and familiarize with PIX pixel debugging.
My implementation required updating scene files for lights. I had lingering bugs from the prior version that also needed squishing. I am nearly done with bugs, but there is a rendering bug in release where objects are not being shown. I will be investigating the issue using output to a log file. The application no longer crashes while in release. That issue was related to not building assets and not checking to see if there was a scene file.
I made some improvements to the scene file. The light type has been added to the scene file. I also fixed issues with order of the actors. If non-renderable actors were placed before renderable actors the indexing was off for scene files. I have fixed the indexing issue.
Ambient light is currently not an actor in the scene file. In fact the ambient light has been hard-coded. I have a screenshot with line number information included that does not give away any code. The line number is 209 in Graphics.cpp.
The project is currently being rendered better. I changed the indices output from Maya from 1,2,3 to 1,3,2. The shapes now look rounded with the addition of light.
I added much more information to the mesh. The data I currently have for each vertex is the XYZ coordinates, UV coordinates for texturing, normal XYZ coordinates for lighting, tangent and bitangent XYZ values for curvature related functions and the coloring information for RGBA values.
PIX is worthwhile for debugging. I was able to debug a pixel. The pixel information is shown below.
I am still having trouble with the release build. The image is black. I am going to dump information to a log file to track down the issue.
I have also been trying to figure out the math behind some of the work we have been doing for the project. I will need to read text on the matter to really understand the math. My understanding presently is that we are operating in a projected space. I am excited to figure out more about the math behind graphics.
The workload for the project was about 12 hours.
|Tracking down bugs from assignment 09||3 hours|
|Implementing lighting||4 hours|
|Adding lighting to the rest of the systems i.e. scene||4 hours|
|Write up||1 hour|