/// <summary> /// Calculates the maximum luminance for the supplied turbidity and sun theta /// </summary> public static float MaximumLuminance(float turbidity, float sunTheta, xyYColor zenith, xyYCoeffs coeffs) { float theta = sunTheta; if (sunTheta >= HALF_PI) theta = HALF_PI - 0.01f; return Distribution(coeffs.Y, theta, zenith.Y, 0f) * 1.5f; }
/// <summary> /// Calculates the RGB atmospheric color (fog + lightning use this in sunrise/sunset) /// </summary> public static float[] AtmosphereColor(float turbidity, float sunTheta, xyYColor zenith, xyYCoeffs coeffs) { float theta = Math.Min(sunTheta + 0.15f, HALF_PI - 0.01f); xyYColor skyColor; // Sky color distribution (using the Perez Function) skyColor.x = Distribution(coeffs.x, theta, zenith.x, 0.2f); skyColor.y = Distribution(coeffs.y, theta, zenith.y, 0.2f); skyColor.Y = 0.5f; float[] ret = xyYtoRGB(skyColor); return ret; }