We derive a new cost of information in rational inattention problems, the neighborhood-based cost functions, starting from the observation that many settings involve exogenous states with a topological structure. These cost functions are uniformly posterior separable and capture notions of perceptual distance. This second property ensures that neighborhood-based costs, unlike mutual information, make accurate predictions about behavior in perceptual experiments. We compare the implications of our neighborhood-based cost functions with those of the mutual information in a series of applications: perceptual judgments, the general environment of binary choice, regime-change games, and linear-quadratic-Gaussian settings.