Generalized billiards describe nonequilibrium gas, consisting of finitely many particles, that move in a container, whose walls heat up or cool down. Generalized billiards can be considered both in the framework of the Newtonian mechanics and of the relativity theory. In the Newtonian case, a generalized billiard may possess an invariant measure; the Gibbs entropy with respect to this measure is constant. On the contrary, generalized relativistic billiards are always dissipative,and the Gibbs entropy with respect to the same measure grows under some natural conditions.

In this article, we find the necessary and sufficient conditions for a generalized Newtonian billiard to possess a smooth invariant measure, which is independent of the boundary action: the corresponding classical billiard should have an additional first integral of special type. In particular,the generalized Sinai billiards do not possess a smooth invariant measure. We then consider generalized billiards inside a ball, which is one of the main examples of the Newtonian generalized billiards which does have an invariant measure. We construct explicitly the invariant measure, and find the conditions for the Gibbs entropy growth for the corresponding relativistic billiard both formonotone and periodic action of the boundary.