  We present a method to infer reddenings and distances to stars, based only on
their broad-band photometry, and show how this method can be used to produce a
three-dimensional dust map of the Galaxy. Our method samples from the full
probability density function of distance, reddening and stellar type for
individual stars, as well as the full uncertainty in reddening as a function of
distance in the 3D dust map. We incorporate prior knowledge of the distribution
of stars in the Galaxy and the detection limits of the survey. For stars in the
Pan-STARRS 1 (PS1) 3 pi survey, we demonstrate that our reddening estimates are
unbiased, and accurate to ~0.13 mag in E(B-V) for the typical star. Based on
comparisons with mock catalogs, we expect distances for main-sequence stars to
be constrained to within ~20% - 60%, although this range can vary, depending on
the reddening of the star, the precise stellar type and its position on the
sky. A further paper will present a 3D map of dust over the three quarters of
the sky surveyed by PS1. Both the individual stellar inferences and the 3D dust
map will enable a wealth of Galactic science in the plane. The method we
present is not limited to the passbands of the PS1 survey, but may be extended
to incorporate photometry from other surveys, such as 2MASS, SDSS (where
available), and in the future, LSST and Gaia.
