  The atmospheres of Mars and Titan are loaded with aerosols that impact remote
sensing observations of their surface. Here we present the algorithm and the
first applications of a radiative transfer model in spherical geometry designed
for planetary data analysis. We first describe a fast Monte-Carlo code that
takes advantage of symmetries and geometric redundancies. We then apply this
model to observations of the surface of Mars and Titan at the terminator as
acquired by OMEGA/Mars Express and VIMS/Cassini. These observations are used to
probe the vertical distribution of aerosols down to the surface. On Mars, we
find the scale height of dust particles to vary between 6 km and 12 km
depending on season. Temporal variations in the vertical size distribution of
aerosols are also highlighted. On Titan, an aerosols scale height of 80 \pm 10
km is inferred, and the total optical depth is found to decrease with
wavelength as a power-law with an exponent of -2.0 \pm 0.4 from a value of 2.3
\pm 0.5 at 1.08 {\mu}m. Once the aerosols properties have been constrained, the
model is used to retrieve surface reflectance properties at high solar zenith
angles and just after sunset.
