     // Finally, scale the Mie and Rayleigh colors and set up the varying variables for the pixel shader
     v_mieColor = frontColor * KmESun;
     v_rayleighColor = frontColor * (InvWavelength * KrESun);
-    v_toCamera = czm_viewerPositionWC - positionV3;
+    v_toCamera = positionWC - positionV3;
     gl_Position = czm_modelViewProjection * position;
 }


    // Get the ray from the camera to the vertex and its length (which is the far point of the ray passing through the atmosphere)
    vec3 positionV3 = position.xyz;
    vec3 ray = positionV3 - czm_viewerPositionWC;
    float far = length(ray);
    ray /= far;
    float atmosphereScale = 1.0 / (outerRadius - innerRadius);

#ifdef SKY_FROM_SPACE
    // Calculate the closest intersection of the ray with the outer atmosphere (which is the near point of the ray passing through the atmosphere)
    float B = 2.0 * dot(czm_viewerPositionWC, ray);
    float C = cameraHeight * cameraHeight - outerRadius * outerRadius;
    float det = max(0.0, B*B - 4.0 * C);
    float near = 0.5 * (-B - sqrt(det));

    // Calculate the ray's starting position, then calculate its scattering offset
    vec3 start = czm_viewerPositionWC + ray * near;
    far -= near;
    float startAngle = dot(ray, start) / outerRadius;
    float startDepth = exp(-1.0 / rayleighScaleDepth );
    float startOffset = startDepth*scale(startAngle);
#else // SKY_FROM_ATMOSPHERE
    // Calculate the ray's starting position, then calculate its scattering offset
    vec3 start = czm_viewerPositionWC;
    float height = length(start);
    float depth = exp((atmosphereScale / rayleighScaleDepth ) * (innerRadius - cameraHeight));
    float startAngle = dot(ray, start) / height;


    float lightEnum = u_cameraAndRadiiAndDynamicAtmosphereColor.w;
    vec3 lightDirection =
        positionWC * float(lightEnum == 0.0) +
        czm_lightDirectionWC * float(lightEnum == 1.0) +
        czm_sunDirectionWC * float(lightEnum == 2.0);
    lightDirection = normalize(lightDirection);
