A novel scheme is developed that computes numerical solutions of Liouville’s equation with a discontinuous Hamiltonian. It is assumed that the underlying Hamiltonian system has well-defined behaviour even when the Hamiltonian is discontinuous. In the case of geometrical optics such a discontinuity yields the familiar Snell’s law or the law of specular reflection. Solutions to Liouville’s equation should be constant along curves defined by the Hamiltonian system when the right-hand side is zero, i.e., no absorption or collisions. This consideration allows us to derive a new jump condition, enabling us to construct a first-order accurate scheme. Essentially, the correct physics is built into the solver. The scheme is tested in a two-dimensional optical setting with two test cases, the first using a single jump in the refractive index and the second a compound parabolic concentrator. For these two situations, the scheme outperforms the more conventional method of Monte Carlo ray tracing.