A reminder for myself — write descriptive and clear commit messages. Just today I had to fix a bug related to a one-year old changelist, which comment said, basically, “fixed the bug”. 5 files and, I don’t know, 100 lines of not-so-obvious changes. What kind of bug? How was it fixed? Anything? The author doesn’t remember this code.

Advertisements

This GBuffer normals encoding deserves more attention than it has:

I did some quick tests and it looks compact, relatively cheap in term of encoding and decoding and (tada!) it’s blendable! 10:10 is not much, of course, but I didn’t notice severe artefacts. Not everything is great — hardware blending support is awesome, for sure, but apparently decals will have to use alpha blending, simply because other blend modes will break the unpacking (we can’t normalize XY correctly). Plus, we need to read the basis bits when rendering decals and I don’t know another way of doing that, except of copying that basis info into a separate texture.

Today I learned.

I kind of knew that usually (always?) there’s no actual pow instruction, at least in HLSL assembly, and that pow is unwrapped as:

pow(a, b) = exp(b * log(a))

However, it shouldn’t work in case a is 0, should it? Because log(0) is NaN? Or something else? And after that I realized that I didn’t know what log(0) would result in. So, the answer is — log(0) is -inf. -inf multiplied by any positive number is still -inf. And, the last but not least! exp(-inf) gives us 0! Kind of amazing if you ask me.

Finally cleared a window to an eye-bleeding green color and submitted the first version of my new pet project, “hikari” or 光, to github. The next steps (a lot of them): pipeline state objects, which assume some basic resource loading and caching (because shaders), meshes loading. Then some basic render graph implementation. At the pace I’m currently working just those simple tasks will take forever =(