  The equations governing null and timelike geodesics are derived within the
3+1 formalism of general relativity. In addition to the particle's position,
they encompass an evolution equation for the particle's energy leading to a 3+1
expression of the redshift factor for photons. An important application is the
computation of images and spectra in spacetimes arising from numerical
relativity, via the ray-tracing technique. This is illustrated here by images
of numerically computed stationary neutron stars and dynamical neutron stars
collapsing to a black hole.
