 void calculateRayScatteringFromSpace(in vec3 positionWC, in vec3 ray, in float innerRadius, in float outerRadius, inout float far, out vec3 start, out float startOffset)
 {
     // Calculate the closest intersection of the ray with the outer atmosphere (which is the near point of the ray passing through the atmosphere)
-    float cameraHeight = czm_eyeHeight + innerRadius;
-    vec3 adjustedPositionWC = normalize(positionWC) * cameraHeight;
-
-    float B = 2.0 * dot(adjustedPositionWC, ray);
+    float cameraHeight = length(positionWC);
+    float B = 2.0 * dot(positionWC, 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
-    start = adjustedPositionWC + ray * near;
+    start = positionWC + ray * near;
     far -= near;
     float startAngle = dot(ray, start) / outerRadius;
     float startDepth = exp(-1.0 / rayleighScaleDepth);

void calculateRayScatteringFromGround(in vec3 positionWC, in vec3 ray, in float atmosphereScale, in float innerRadius, out vec3 start, out float startOffset)
{
    // Calculate the ray's starting position, then calculate its scattering offset
    float cameraHeight = czm_eyeHeight + innerRadius;
    start = normalize(positionWC) * cameraHeight;
    float height = length(start);
    float depth = exp((atmosphereScale / rayleighScaleDepth ) * (innerRadius - cameraHeight));
    float startAngle = dot(ray, start) / height;

    float innerRadius = u_radiiAndDynamicAtmosphereColor.y;

#ifdef GLOBE_TRANSLUCENT
    bool intersectsEllipsoid = false;
    vec3 startPositionWC = getTranslucentPosition(czm_viewerPositionWC, outerPositionWC, innerRadius, intersectsEllipsoid);
#else
    vec3 startPositionWC = getAdjustedPosition(czm_viewerPositionWC, innerRadius);
#endif

    vec3 lightDirection = getLightDirection(startPositionWC);
