min(pow(sunAmount, 800.0)*1.5, .3);
   
   return clamp(sky, 0.0, 1.0);
}

// Fog routine - original by IQ
vec3 Fog(vec3 rgb, vec3 rd, float distance)   // camera to point distance
{
    const float b = 0.04;
    float fogAmount = 1.0 - exp(-distance*b);
    vec3  fogColor = Sky(rd);
    return mix(rgb, fogColor, fogAmount);
}

// Based on a shading method by Ben Weston.
vec3 Shading(vec3 pos, vec3 rd, vec3 norm, vec3 ro)
{
   vec3 light = lightColour * max(0.0, dot(norm, lightDir));
   ve