Lighting for Tsunami

I managed to get some lighting into Tsunami in the form of point lights, spot lights, and directional lights. Currently it only supports one light, but that will change. The next step I need to do is create a material system because, as of right now, there isn’t one and it’s a serious pain to pass stuff into the shaders manually.

The lighting in this image is vertex shaded lighting with ambient, diffuse, and specularity. The image is just a single spot light emanating from the camera in the direction of the camera, so it acts like a flash light. Wherever I point the camera, the light shines in that direction.

I’m not really sure if this is considered phong lighting/shading. I don’t really care that much since I’ll probably implement it later, but it seems that when people refer to phong lighting, they mean it’s per pixel, and the normals are interpolated and then renormalized on a per-pixel basis. These normals aren’t renormalized, but they are interpolated, since it’s a vertex shader that’s doing the work, but that’s about all. I’ve mentioned before that I planned on implementing a bunch of different lighting algorithms in the vertex shader and then doing the same for pixel shaders and then place them side by side to compare them, so eventually I’ll implement phong.

The next step on this ridiculous quest is to add texture mapping and the material system. For texture mapping, I’m just talking about basic diffuse texture mapping to at least make the ground plane look decent. I want crates too.

Leave a Reply

You must be logged in to post a comment.