update raytracing algorithm