Journal Entry 57 – Character Centered Haze

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:

This is how the terrain looks when it is only partially loaded in.  The character is now centered in the haze, which is a lot more convincing.  The fog is then pushes back as more chunks are loaded (which takes only a few seconds).
This is how the terrain looks when it is only partially loaded in. The character is now centered in the haze, which is a lot more convincing. The fog is then pushes back as more chunks are loaded (which takes only a few seconds).

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!

Cheers,

Giawa

2 thoughts on “Journal Entry 57 – Character Centered Haze

  1. Hi,
    I am actually not commenting on this engine. I m interested in ur NAudio tutorials. As that previous site is not opening that’s why I m commenting here. I have seen these and found very helpful as I was looking for such tutorials. I have read somewhere that instead of playing audio file, a sound generator can be developed but unable to find information about it. I have seen tone generator tutorial its good but I actually want a complete sound generator instead of single frequency tone generator for my project. The generator should be able to generate sounds of things like fan, fishes, helicopter, etc. Is it possible and if yes then how.

    1. Hi Anzar. You can definitely generate all sorts of custom sounds. You’ll just need to work out how that sounds will be built (probably out of a sum of sine waves, or something similar). You can also add effects like echo/etc to custom tune the effect. Most of these were covered in those NAudio tutorials. The biggest task will be figuring out how to make a mathematical formula that sounds like the sound effect you would like to achieve.

Leave a Reply