I have developed a time of day sky simulation, using rough approximations of Rayleigh and Mie scattering plus a pollution variable. All of this can be expressed as the coefficients of a 4x3 matrix. However, the calculations of these coefficients is somewhat complicated, and would probably bring a shader down to a crawl. I'd therefore like to calculate these coefficients outside the shader script on a much longer refresh time.

The vector that goes with these coefficients is dependent on various powers of a sky hemisphere vertex/sun position distance and will have to be calculated within the vertex shader routine. The m4x3 result will be output to the rgb values for each vertex. (I hope that this explaination is not too condensed or obscure!).

As you will see from the above, I'm not actually using material data at this stage, its a pure vertex shader. That said, I'd like to add a cloud simulation at a later stage when material data/pixel shaders would probably have to be used.


Ed