Relations between temperature, T , and optical depth, τ , are often used for describing the photospheric transition from optically thick to optically thin in stellar structure models. We show that this is well justified, but also that currently used T (τ )-relations are often inconsistent with their implementation. As an outer boundary condition on the system of stellar structure equations, T (τ )-relations have an undue effect on the overall structure of stars. In this age of precision asteroseismology, we need to reassess both the method for computing and for implementing T (τ )-relations, and the assumptions they rest on.We develop a formulation for proper and consistent evaluation of T (τ )-relations from arbitrary 1D or 3D stellar atmospheres, and for their implementation in stellar structure and evolution models.We extract radiative T (τ )-relations, as described by our new formulation, from 3D simulations of convection in deep stellar atmospheres of late-type stars from dwarfs to giants. These simulations employ realistic opacities and equation of state, and account for line-blanketing. For comparison, we also extract T (τ )-relations from 1D MARCS model atmospheres using the same formulation.T (τ )-relations from our grid of 3D convection simulations display a larger range of behaviours with surface gravity, compared with those of conventional theoretical 1D hydrostatic atmosphere models based on the mixing-length theory for convection. The 1D atmospheres show little dependence on gravity. 1D atmospheres of mainsequence stars also show an abrupt transition to the diffusion approximation at τ ≃ 2.5, whereas the 3D simulations exhibit smooth transitions that occur at the same depth for M ≃ 0.8 M ⊙ , and higher in the atmosphere for both more and less massive main-sequence stars. Based on these results, we recommend no longer to use scaled solar T (τ )-relations.Files with T (τ )-relations for our grid of simulations are made available to the community, together with routines for interpolating in this irregular grid. We also provide matching tables of atmospheric opacity, for consistent implementation in stellar structure models.