Templated RayTrace. Added possibility of color cache.