 #define SAMPLE_STEPS            10
 #define DENSITY_STEPS           10
 #define SUN_INTENSITY           25.0
-#define MOON_INTENSITY          1.5
-#define DENSITY_SCALAR_M        0.1
-#define DENSITY_SCALAR_R        0.8
+#define MOON_INTENSITY          2.0
+#define DENSITY_SCALAR_M        0.3
+#define DENSITY_SCALAR_R        1.3
 
 float ray_scphere_exit(vec3 orig, vec3 dir, float radius) {
     float a = dot(dir, dir);

const float E = 0.02;
const float F = 0.30;

vec3 uncharted2_tonemap( vec3 x ) {
   return ((x * (A * x + C * B) + D * E) / (x * (A * x + B) + D * F)) - E / F;
}

void main() {
    vec2 uv = gl_FragCoord.xy / resolution;
    vec3 position = vec3(uv * 2.0 - 1.0, -1.0);
    position.y += 1.0;
    position.x += 0.3;

    vec3 color = vec3(0.0);
    vec3 sun_position = vec3(0.0, -0.3 + 0.5*cos(time * 0.3), -1.0);
    //vec3 sun_position = vec3(0.0, 0.3, -1.0);
    vec3 sun_light = atmosphere(normalize(position), vec3(0.0, PLANET_RADIUS, 0), sun_position, SUN_INTENSITY);
    vec3 moon_light = vec3(0.0);
    if (sun_position.y < 0.0) {
        moon_light = atmosphere(normalize(position), vec3(0.0, PLANET_RADIUS, 0), vec3(0.0, 1.0, 0.0), MOON_INTENSITY);
        color = mix(sun_light, moon_light, -sun_position.y);
    } else {
        color = sun_light;
    }

    // Apply exposure.
    float luminance = 0.01;
    float white_scale = 1.0748724675633854;
    color = uncharted2_tonemap((log2(2.0 / pow(luminance, 4.0))) * color) * white_scale;

    gl_FragColor = vec4(color, 1.0);
}

    float phase_m = phase_mie(cos_angle);

    // Calculate light color
    float turbidity = 2.0;
    vec3 rayleigh_color_tint = vec3(1.0); //vec3(0.9, .8, .8);
    vec3 beta_m = BETA_M * turbidity;
    vec3 beta_r = BETA_R * rayleigh_color_tint;
    vec3 out_color = (scatter_r * phase_r * beta_r + scatter_m * phase_m * beta_m) * sun_intensity;

    const float sun_angular_diameter = 0.9998;
    float sundisk = smoothstep(sun_angular_diameter, sun_angular_diameter + 0.00002, cos_angle);

    out_color = mix(out_color, vec3(sundisk), 0.5);
