         return tuple<float,float,float,float,float,float,float,float,float,float,float,float>(intersect.x, intersect.y,intersect.z,reflection.x,reflection.y,reflection.z,normal.x,normal.y,normal.z,alpha,beta, lerpedScalar);
     }
 };
-
-
+/*
+struct ReflectSphrFunctor{
+
+    eavlConstArrayV2<float4> verts;
+
+
+
+    ReflectSphrFunctor(eavlConstArrayV2<float4> *_verts,eavlConstArray<float> *xnorm)
+        :verts(*_verts)
+    {
+        
+    }                                                
+    EAVL_FUNCTOR tuple<float,float,float,float,float, float,float,float, float,float,float, float> operator()( tuple<float,float,float,float,float,float,int, int> rayTuple){
+       
+        
+        int hitIndex=get<6>(rayTuple);//hack for now
+        int primitiveType=get<7>(rayTuple);
+        if(hitIndex==-1 || primitiveType != SPHERE) return tuple<float,float,float,float,float, float,float,float, float,float,float, float>(0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0);
+        
+        eavlVector3 intersect;
+
+        eavlVector3 reflection(0,0,0);
+        eavlVector3 rayOrigin(get<3>(rayTuple),get<4>(rayTuple),get<5>(rayTuple));
+
+        eavlVector3 ray(get<0>(rayTuple),get<1>(rayTuple),get<2>(rayTuple));
+        float alpha=0, beta=0;
+
+        float4 data=verts.getValue(tri_verts_tref, hitIndex);
+        float4 b4=verts.getValue(tri_verts_tref, hitIndex*3+1);
+        float4 c4=verts.getValue(tri_verts_tref, hitIndex*3+2); //scalars are stored in c.yzw
+        eavlVector3 a(a4.x,a4.y,a4.z);
+        eavlVector3 b(a4.w,b4.x,b4.y);
+        eavlVector3 c(b4.z,b4.w,c4.x);
+        intersect= triangleIntersectionABG(ray, rayOrigin, a,b,c,0.0f,alpha,beta);
+        gamma=1-alpha-beta;
+        eavlVector3 normal(999999.f,0,0);
+
+        eavlVector3* normalPtr=(eavlVector3*)(&norms[0]+hitIndex*9);
+        eavlVector3 aNorm=normalPtr[0];
+        eavlVector3 bNorm=normalPtr[1];
+        eavlVector3 cNorm=normalPtr[2];
+        normal=aNorm*alpha+bNorm*beta+cNorm*gamma;
+        float lerpedScalar = c4.y*alpha+c4.z*beta+c4.w*gamma;
+        //reflect the ray
+        ray.normalize();
+        normal.normalize();
+        if ((normal*ray) > 0.0f) normal = -normal; //flip the normal if we hit the back side
+        reflection=ray-normal*2.f*(normal*ray);
+        reflection.normalize();
+        intersect=intersect+(-ray*BARY_TOLE);
+
+
+        return tuple<float,float,float,float,float,float,float,float,float,float,float,float>(intersect.x, intersect.y,intersect.z,reflection.x,reflection.y,reflection.z,normal.x,normal.y,normal.z,alpha,beta, lerpedScalar);
+    }
+};
+
+*/
 struct DepthFunctor{
 
     eavlConstArrayV2<float4> verts;

 distance=minDistance;
 return minIndex;
}



EAVL_HOSTDEVICE float getIntersectionDepth(const eavlVector3 rayDir, const eavlVector3 rayOrigin, bool occlusion, const eavlConstArrayV2<float4> &bvh,const eavlConstArrayV2<float> &tri_bvh_lf_raw,eavlConstArrayV2<float4> &verts,const float &maxDistance)
{


}


EAVL_HOSTDEVICE int getIntersectionSphere(const eavlVector3 rayDir, const eavlVector3 rayOrigin, bool occlusion, const eavlConstArrayV2<float4> &bvh,const eavlConstArrayV2<float> &bvh_lf,eavlConstArrayV2<float4> &verts,const float &maxDistance, float &distance)
{


