             {
                 vec3 vispos = pos + hit.normal * 0.5 * float(i);
                 /* float d = mindist( vispos, hit, dummyNormal, dummyColor ); */
-                mindist( vispos, dummyHit );
+                mindist( hit.meshId, 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;
};

void mindistSphere(vec3 spherePos, float sphereSize, bool deform, vec3 pos, inout HitInfo hit)
{
    vec3 localSpherePos = pos - spherePos;
    if( deform )
    {

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

        if( hit.hit ) {
