We shall describe the problem of approximating functions by regular ones in the context of energy expressed by some variational functional. Such approximation is possible upon imposing certain structural conditions on the functional's integrand. We shall briefly overview those conditions in special instances of functionals, such as ones of double phase or variable exponent type, and then proceed with explaining new, general ones. The talk shall describe joint work with Pierre Bousquet, Iwona Chlebicka, Benjamin Lledos, and Błażej Miasojedow.