BGE Fast & Dynamic PBR Shader + Preetham Skybox
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 1 ], 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.
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 1 ])
(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 9
Taken from the blenderartist forums