Developing theoretical frameworks for vibrational strong coupling (VSC) beyond the single-mode approximation is crucial for a comprehensive understanding of experiments with planar Fabry-Pérot cavities. Herein, a generalized cavity molecular dynamics (CavMD) scheme is developed to simulate VSC of a large ensemble of realistic molecules coupled to an arbitrary 1D or 2D photonic environment. This approach is built upon the Power-Zienau-Woolley Hamiltonian in the normal mode basis and uses a grid representation of the molecular ensembles to reduce the computational cost. When simulating the polariton dispersion relation for a homogeneous distribution of molecules in planar Fabry-Pérot cavities, our data highlight the importance of preserving the in-plane translational symmetry of the molecular distribution. In this homogeneous limit, CavMD yields the consistent polariton dispersion relation as an analytic theory, i.e., incorporating many cavity modes with varying in-plane wave vectors (k∥) produces the same spectrum as the system with a single cavity mode. Furthermore, CavMD reveals that the validity of the single-mode approximation is challenged when nonequilibrium polariton dynamics are considered, as polariton-polariton scattering occurs between modes with the nearest neighbor k∥. The procedure for numerically approaching the macroscopic limit is also demonstrated with CavMD by increasing the system size. Looking forward, our generalized CavMD approach may facilitate understanding vibrational polariton transport and condensation.