At GDC 2015, ARM and PlayCanvas unveiled the Seemore WebGL demo. If you haven’t seen it yet, it takes WebGL graphics to a whole new level.CLICK HERETO LAUNCH SEEMORESo why did we build this demo? We had two key goals:Put amazing demo content in..…

]]>” The problem I ran into was around these lines:

float X = pow(1 – H2 * cot(theta) * cot(theta)), 0.5);

float illuminance = 0;

if (theta = 0.

However, when the light source gets large, low probability floating-point precision issues end up breaking this assumption at a small number of pixels, resulting in very occasional junk output (because the code takes the path which uses X, but X is undefined).

A minor rewrite, eg

float Xsquared = 1 – H2 * cot(theta) * cot(theta);

float illuminance = 0;

if (Xsquared < 0)

{

[…]

}

else

{

float X = sqrt(Xsquared);

[…]

ensures that the conditional is consistent with the sqrt. This appears to eliminate the marginal instability. (Or at least I’m pretty confident that the issues which remain in my current code are all my own work… J)

As I say, this isn’t much of an issue in practice but I thought you might like to know, just in case no-one else has tracked that one down yet."

]]>