Dielectric resonators are open systems particularly interesting due to their wide range of applications in optics and photonics. In a recent paper [Phys. Rev. E 78, 056202 (2008)] the trace formula for both the smooth and the oscillating parts of the resonance density was proposed and checked for the circular cavity. The present paper deals with numerous shapes which would be integrable (square, rectangle, and ellipse), pseudointegrable (pentagon), and chaotic (stadium), if the cavities were closed (billiard case). A good agreement is found between the theoretical predictions, the numerical simulations, and experiments based on organic microlasers.