I Made Fog (and an Infinite Grid, too)

While my next post was destined to be about the voxely thingies Payback Time's world consists of, I got derailed into fixing a small issue that's been on my TODO for a while now.

So, my map editor has a grid that should work as visual aid to the user. The grid has traditionally been a static mesh with known proportions: vertices, indices, lines and all that jazz - very inflexible and tedious to manage, to say the least. Also, so far the background of the scene has been completely void of color.

Enter new backdrop, with an infinite grid and a subtle, low-frequency textured skydome:

Test Scene

A couple of words about the implementation. While rendering a casual grid on the screen seems very trivial, there's a little more (or less) going on here, actually.

The backdrop as a whole is done by per-pixel raycasting with a single quad. In simple terms:

In case you're interested in some more details on the above approach, have a peeky here:

The shader comments/docs are scarce, so drop me a line in case you'd want to try it out yourself!

Next time it'll be about voxels and meshes. And about how UV-mapping can warp one's mind in ways unexpected.