Realistic atmosphere

Hey TheJamsh!
Thank you for purchasing!

I was considering using the Custom Node…
Simple code implementation of loops would be much cleaner than those long chains of sample nodes…
However, Custom Nodes are platform dependent. Besides, the process of editing code for the CN is currently awful. :stuck_out_tongue:
So, I decided that implementing everything with regular nodes is a more reliable way.

Unfortunately, yes. But I’m afraid this is as much as I can get from the realtime implementation. My first implementation had about twice greater instruction count and I spent some time reducing it as much as possible. Also, I created different material instances with different sets of enabled features. Take a look at the MaterialInstances folder’s content: R = Rayleigh enabled, M = Mie enabled, S = Volumetric Shadow enabled, T = Translucency enabled (skies only). If you want further improve performance, you can decrease number of samples taken in AtmoSampleDensity and AtmoSampleScatter functions, but quality can suffer a bit.

I’ve tested performance on several machines and even got good performance on a laptop with i7 + GT 650 (but with 1366x768 resolution). Never noticed performance changes with static camera. Performance mainly depends on how many pixels on the screen are covered by the material, as the pixel shader is especially computationally-heavy.