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.
BGE_Skybox.blend (852 KB)
OMG, this is your first post and contribution and its already blowing my mind lol welcome to the BA community
Thanks for sharing this, I’m having fun playing and learning this
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
Thanks LieGri! looks fantastic
at first, thanks for all your kind replies
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.
Here are some results:
(Fully lit model, taken from [ http://quixel.se/usermanual/quixelsuite/doku.php?id=ddo_samples
(The single passes generated by the shader)
(GGX approximation of material roughness)
(… other “features” of this shader)
(The material node)
… 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.
Until then, have fun with the .blend-file
File download: http://windofmedia.de/blenderartists/BGE_PbrShader.blend