  Radiative transfer is a notoriously difficult and computationally demanding
problem. Yet, it is an indispensable ingredient in nearly all astrophysical and
cosmological simulations. Choosing an appropriate discretization scheme is a
crucial part of the simulation, since it not only determines the direct memory
cost of the model but also largely determines the computational cost and the
achievable accuracy. In this paper, we show how an appropriate choice of
directional discretization scheme as well as spatial model mesh can help
alleviate the computational cost, while largely retaining the accuracy. First,
we discuss the adaptive ray-tracing scheme implemented in our 3D radiative
transfer library Magritte, that adapts the rays to the spatial mesh and uses a
hierarchical directional discretization based on HEALPix. Second, we
demonstrate how the free and open-source software library Gmsh can be used to
generate high quality meshes that can be easily tailored for Magritte. In
particular, we show how the local element size distribution of the mesh can be
used to optimise the sampling of both analytically and numerically defined
models. Furthermore, we show that when using the output of hydrodynamics
simulations as input for a radiative transfer simulation, the number of
elements in the input model can often be reduced by an order of magnitude,
without significant loss of accuracy in the radiation field. We demonstrate
this for two models based on a hierarchical octree mesh resulting from adaptive
mesh refinement (AMR), as well as two models based on smoothed-particle
hydrodynamics (SPH) data.
