 
 const vec4 sphere1 = vec4(0,405,-900,405);
 
+float length_squared(const vec3 v)
+{
+    return dot(v, v);
+}
+
 // Return first hit of ray with sphere surface.
-float isect_sphere(const vec3 ray_origin, const vec3 ray_dir_unit, const float t_min, const vec3 sphere_centre, const float sphere_radius)
+float isect_sphere1(const vec3 ray_origin, const vec3 ray_dir_unit, const float t_min, const vec3 sphere_centre, const float sphere_radius)
 {
     const vec3 sphere_to_ray = ray_origin - sphere_centre;
     float t = MISS;

                t = root2;
            }
        }
    }
    return t;
}

        const float e = sqrt(discriminator);
        const float denominator = 2.0f * a;
        const float root1 = (-b-e) / denominator;
        if(root1 > t_min){
            t = root1;
        } else {
