Friday, February 15, 2013

Graphics Write-Up #5

This assignment ended up taking longer than I expected it would, but overall it wasn't terribly complex.  Most of the work this time around was just making all the new files, but it was really awesome to see the scene load perfectly after setting all of that up.

Getting the ambient lighting in was simple, but the specular lighting proved to be more challenging.  I got the correct equation in, but the light still wasn't showing up for some reason.  After going into PIX it was revealed that this line in the fragment shader:

float3 specularLight = pow( saturate( dot(R, V) ), specularExponent );

was resulting in 0, which would obviously mean that there's not going to be any specular light.  I talked with Sherly about this issue and she said that the same thing was happening with her 8 vertex cube, but that her 24 vertex cube worked fine.  So I made a new mesh for a 24 vertex cube so that each face could have its own normal and poof, it worked just fine.  I wasn't able to figure out why it doesn't work with the 8 vertex cube, but since it is working on the 24 vertex, at least I know my specular lighting calculations work.

Even though we didn't need a screen shot for this weeks submission, it feels weird to post a blog about a graphics assignment without a picture.  So here's my cubes with specular lighting in.  Unfortunately it's really hard to get a good shot with the rotating cubes.  The front and right side cubes are all using specular lighting, although only the 2nd and 4th are using the 24 vertex mesh.

Link to code: http://www.eng.utah.edu/~jthummel/graphics/ThummelGraphicsAssignment5.zip

No comments:

Post a Comment