I was late getting home tonight, so there isn’t too much to report. I cleaned up the rendering thread quite a bit, and moved a lot of the random code that I’ve left behind. This leaves about 5 lines of code to actually render everything on the screen. I’m doing this housekeeping because I am writing a second rendering path, which is deferred shading. I’d like to be able to render (potentially) hundreds of lights, and this is the only way I’ll get any sort of performance out of the engine with that sort of lighting. Hopefully I’ll have some cool screenshots to show over the next few days! Until then, I did get a bit of other work done.
Until tonight, all of the terrain fading (fog of war, haze, etc) was calculated via the fragment depth, which means that it was all from the point of view of the camera. This caused clutter and the terrain to fade out/in as you the camera was moved. I’ve now decoupled the haze from the camera, and have bound it instead of the player. This requires sending position data of the player each frame, but it isn’t too bad. Here’s how the new code looks as the world is loaded in:
Once the world is loaded in, and the clutter distance is set, the clutter will stay centered around the main player. This was pretty straight forward to accomplish in the shader with a player position uniform. Here’s a video of the new haze in action!