         discard;
     }
 
-    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);
+    gl_FragColor = shade(pointInEllipsoid);
 }

    vec3 sensorVertexEC = czm_modelView[3].xyz;  // (0.0, 0.0, 0.0) in model coordinates

    czm_ellipsoid ellipsoid = czm_getWgs84EllipsoidEC();

    // Occluded by the ellipsoid?
	if (!u_showThroughEllipsoid)
	{
	    // Discard if in the ellipsoid    
	    // PERFORMANCE_IDEA: A coarse check for ellipsoid intersection could be done on the CPU first.
	    if (czm_pointInEllipsoid(ellipsoid, v_positionWC))
	    {
            discard;
	    }

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

bool ellipsoidSensorIntersection(float pointInEllipsoid)
{
    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;
#endif

    float width = 2.0;  // TODO: Expose as a uniform
    epsilon *= width;           

    return czm_equalsEpsilon(t, 1.0, epsilon);
}

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

float czm_pointInEllipsoid(czm_ellipsoid ellipsoid, vec3 point)
{
    // TODO: Take into account ellipsoid's center; optimize with radii-squared; and move elsewhere
    return (((point.x * point.x) / (ellipsoid.radii.x * ellipsoid.radii.x)) +
            ((point.y * point.y) / (ellipsoid.radii.y * ellipsoid.radii.y)) +
            ((point.z * point.z) / (ellipsoid.radii.z * ellipsoid.radii.z)));
}

void main()
