     }
     else if (endPoint0Distance < 0.0 && abs(denominator) > czm_epsilon7)
     {
-        float t = (-plane.w - dot(plane.xyz, positionEC)) / denominator;
+        // t = (-plane distance - dot(plane normal, ray origin)) / dot(plane normal, ray direction)
+        float t = (czm_currentFrustum.x + positionEC.z) / denominator;
         if (t < 0.0 || t > magnitude)
         {
             culledByNearPlane = true;

    vec4 p0, p1;
    vec2 direction, nextWC, prevWC;
    
    if (czm_equalsEpsilon(prevDir, -nextDir, czm_epsilon7))
    {
        if (usePrevDirection || !clipped)
        {

    culledByNearPlane = false;
    clipped = false;
    
    float endPoint0Distance =  -(czm_currentFrustum.x + positionEC.z);
    float denominator = -directionEC.z;
    
    if (endPoint0Distance < 0.0 && abs(denominator) < czm_epsilon7)
    {
