         discard;
     }
 
-    gl_FragColor = shade(pointInEllipsoid);
+    czm_ray ray = czm_ray(vec3(0.0), normalize(v_positionEC));  // Ray from eye to fragment in eye coordinates
+    czm_raySegment ellipsoidInterval = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid);
+
+    gl_FragColor = shade(ellipsoidInterval, pointInEllipsoid);
 }

    return czm_equalsEpsilon(t, 1.0, epsilon);
}

vec4 shade(float pointInEllipsoid)
{
    if (u_showIntersection && ellipsoidSensorIntersection(pointInEllipsoid))
    {
        return getIntersectionColor(u_sensorRadius, v_positionEC);
    }

    return czm_phong(normalize(positionToEyeEC), material);
}

bool ellipsoidSensorIntersection(czm_raySegment ellipsoidInterval, float pointInEllipsoid)
{
    if (czm_isEmpty(ellipsoidInterval)) {
        return false;
    }

    float t = pointInEllipsoid;

#ifdef GL_OES_standard_derivatives
    float epsilon = max(abs(dFdx(t)), abs(dFdy(t)));
#else
    // TODO:  Don't hardcode this.
    float epsilon = 1.0 / 500.0;
