implementing raytracing