this is a very fast & efficient implementation of the Preetham Sky Model into the BGE.
Through the use of the material nodes, this shader will work both in-game and in your viewport.
To use it, just link/append the “Skybox” object into your own .blend file and select your sun object in the “Lamp Data” node. The rotation of the selected sun will then be used for the sky’s sun.
The shader uses two pre-baked data images similar to the approach from [ http://csc.lsu.edu/~kooima/misc/cs594/final/part2.html ], but with a much more accurate baseline data. This saves the computational cost of a complete Preetham calculation by only losing a small bit of accuracy.
Looks fantastic, The sun takes up too much space in the sky though (for my liking). Sun flaring should usually be left for post processing. Just my opinion
So after seeing how well the used method worked for creating the sky itself, I wanted to try if it would be useful for “baking” the diffuse pass of the sky’s HDR illumination. As this produced very nice results, I just packed it together with a few of my earlier experiments to this PBR shader, which also works both in the viewport and in-game.
… and much more, like e.g. the PBR arealight algorithm form [ https://eheitzresearch.wordpress.com/415-2/ ], PBR sphere lights or height-dependent fog, which I’ll explain in another post in more detail.