ray generation