Phong is a Cool Guy

4/24/2023

Hey! We got lighting that doesn't cost us an arm and a leg that's pretty cool! These past two weeks assignments to get lighting working in WebGL haven't been nearly as bad as I thought they were going to be and I mostly ended up struggling with sort of unrelated issues in the assignments. In the first part of the assignment I had a couple of issues with the reflection vector that caused specular highlights to not show up on the plane, even though they did correct appear on the sphere. I got a little bit of help from Learn OpenGL to fix up the formula and then completed the assignment. Unfortunately, like a fool, I forgot to record any video of any of the issues I had so I don't remember the specifics.

The second part of the assignment also went quite well, although I did have a little bit of trouble changing the shader to use the light position instead of the direction. Initially I had it in my head, for some reason, that in order to get a vector that goes from one point to another you just do to - from. Obviously that's reversed but it took a bit of looking around to figure out wha was going wrong with that one.

Interestingly, mixing up the light direction made light appear only on the bottom of the plane.

Once I figured that out, it was smooth sailing until we got to adding the new, unshaded, geometry to the light position. I had a lot more trouble with this than I really should have, mainly because I tried to take the easy way out which led to things getting all messed up and becoming even more complicated. To begin with I accidentally overrode the entire world matrix into just a translation to the light position. The I tried to do something hacky to just add the light rotation onto an already setup world matrix to avoid reapplying the scale and translation. By this point I was pretty deep down in a rabbit hole so I deleted pretty much the whole thing and just started over. All in all it wasn't that big of a problem but it really shouldn't have taken me as long as it did. My brain was too full of Game Dev stuff I guess haha.

Oops, barrel very too small!
I made a weird skybox!
Oh... goodbye I guess
While trying to figure stuff out I reset the sphere back to the middle and then made it a bit bigger so I could see it.
The End

My partner and I worked ok for this project. I think we both had a fairly strong understanding of the material so there wasn't too much back and forth but we did help each other out a little bit. I ended up doing most of the work for both assignments in class after they were assigned so I was able to provide some nice hints and information about how I went about doing the todos. I didn't end up needing to go to any office hours, although as mentioned above I did seek out a couple additional resources for getting my specular function right.