     const vec3 ambientColor = vec3( 0.05, 0.05, 0.1 );
     while( true ) {
         hit.hit = false;
-        mindist(pos, hit);
+        mindist(0, pos, hit);
         float d = hit.distance;
 
         if( hit.hit ) {

            {
                vec3 vispos = pos + hit.normal * 0.5 * float(i);
                /* float d = mindist( vispos, hit, dummyNormal, dummyColor ); */
                mindist( vispos, dummyHit );
                float occl = clamp( dummyHit.distance, 0.0, 1.0 );
                vis += occl / float(i+1);
                maxvis += 1.0 / float(i+1);

    float distance;
    vec3 normal;
    vec3 color;
    int meshId;
};

void mindistSphere(
    int meshId, int ignoreMeshId, inout HitInfo hit, vec3 pos,
    vec3 spherePos, float sphereSize, bool deform)
{
    if( meshId == ignoreMeshId )
        return;

    vec3 localSpherePos = pos - spherePos;
    if( deform )
    {
