New ray tracing algorithm