 	return (t < INFINITY);
 }
 
-bool hitSphere(in vec3 position, out int sphere)
+bool countHits(in vec3 position)
 {
     float t;
 
     for(int i = 0; i < SIZE; ++i)
 	{
-        if(getDistance(position, i, t) && (t <= 0.003))
-        {
-            sphere = i;
+        if(getDistance(position, i, t) && (t <= blobs[i].radius/2))
+        {
+            spheresHit[hitcount] = i;
+            hitcount++;
             return true;
         }
 	}
     return false;
+}
+
+bool foundborder(in vec3 position)
+{
+    float energySum = .0f;
+    for(int i = 0; i < hitcount; i++)
+    {
+        energySum += energy(position, spheresHit[i]);
+    }
+}
+
+float energy(in vec3 position, in int sphere)
+{
+    return smoothstep(blobs[i].radius, 2*blobs[i].radius, );
 }
 
 bool trace(in Ray ray, out vec3 normal, out Material material, out float t)

    return true;
}

bool nearestDistance(in vec3 position, out float t)
{
    t = INFINITY;


	// find nearest and farthest intersection for all metaballs
	// hint: use for loop, INFINITE, SIZE, intersect, min and max...
	hitcount = 0;

	float tmin;
	float tmax;
