The formation of pillars of dense gas at the boundaries of H ii regions is investigated with hydrodynamical numerical simulations including ionizing radiation from a point source. We show that shadowing of ionizing radiation by an inhomogeneous density field is capable of forming so-called elephant trunks (pillars of dense gas as in e.g. M16) without the assistance of self-gravity or of ionization front and cooling instabilities. A large simulation of a density field containing randomly generated clumps of gas is shown to naturally generate elephant trunks with certain clump configurations. These configurations are simulated in isolation and analysed in detail to show the formation mechanism and determine possible observational signatures. Pillars formed by the shadowing mechanism are shown to have rather different velocity profiles depending on the initial gas configuration, but asymmetries mean that the profiles also vary significantly with perspective, limiting their ability to discriminate between formation scenarios. Neutral and molecular gas cooling are shown to have a strong effect on these results.