+
+ // HACK: clamp rf2 to 1.0.
+ // Somehow, rf2 is huge at certain sun angles (around midnight), which results in
+ // rf3 being negative and hence negative fog colors and weird display issues...
+ // Something more fundamental may be wrong with the formulas here...
+ if (rf2>1.0) rf2 = 1.0;
+