This post is the first in a series to follow-up on my 2012 GPU Pro 3 article about atmospheric scattering . What I showed there was a full single-scattering solution for a planetary atmosphere running in a pixel shader, dynamic and in real time, without pre-computation or simplifying assumptions. The key to this achievement was a novel and efficient way to evaluate the Chapman function , hence the title. In the time since then I have improved on the algorithm and extended it to include aspects of multiple scattering. The latter causes horizontal diffusion (twilight situations) and vertical diffusion (deep atmospheres), and neither can be ignored for a general atmosphere renderer in a space game, for example.
I have written a Shadertoy that reflects the current state of affairs. It’s a mini flight simulator that also features clouds, and other rendering goodies. A WebGL2 capable browser is needed to run it. Under Windows, the ANGLE/Direct3D translator may take a long time to compile it (up to a minute is nothing unusual, but it runs fast afterwards). When successfully compiled it should look like this:
This post is a follow-up to my 2006 ShaderX5 article  about normal mapping without a pre-computed tangent basis. In the time since then I have refined this technique with lessons learned in real life. For those unfamiliar with the topic, the motivation was to construct the tangent frame on the fly in the pixel shader, which ironically is the exact opposite of the motivation from :
Since it is not 1997 anymore, doing the tangent space on-the-fly has some potential benefits, such as reduced complexity of asset tools, per-vertex bandwidth and storage, attribute interpolators, transform work for skinned meshes and last but not least, the possibility to apply normal maps to any procedurally generated texture coordinates or non-linear deformations. Continue reading
(EDIT: This article is a more in-depth writeup of an algorithm that I developed around 2005, and first posted to Martin Baker’s Euclidean Space website. That time was the height of the Intel NetBurst architecture, which was notorious for its deep pipeline and high branch misprediction penalty. Hence the motivation to develop a branch-free matrix to quaternion conversion routine. What follows is the complete derivation and analysis of this idea.)
The original routine to convert a matrix to a quaternion was given by Ken Shoemake  and is very branchy. There is a way to eliminate these branches and arrive at a completely branch-free and highly parallelizable code. The trade off is the introduction of 3 additional square roots. Jump to the analysis section and the end of this article, or continue fist with the math bits.
Here are some philosophical and rendering-related questions that I took home from the last vacation. What’s the color of clouds? The standard answer would be, white.
What’s the color of snow? Again, white. Ok, then look at the following picture, where the snow seems considerably whiter. This is the case in almost all photos that I took.
There is an image on Wikipedia from the same general area on which the brightness difference between clouds vs snow is even more pronounced. If you look at the directly lit parts of the snow and consider it white (#ffffff), then the directly lit parts of the clouds are at most 50% grey (#bbbbbb). Is that an evidence of air pollution? Unlikely! (At least not in Tyrol).