Computer simulations are carried out to study the 'sprite' onset mechanism. Both electrostatic and electromagnetic codes are developed to calculate the electric field structure and optical emission intensity between the top of the thundercloud and the ionosphere. The optical emission is composed of two structures. One peaks at 70 km height and its lateral dimension is 50-60 km; the other peaks at 90 km height and the lateral dimension extends beyond 200 km. It is found that the nitrogen first positive band, which has a red colour, dominates over the nitrogen second positive band except at the bottom of the optical emission. The upper part of the optical emission is caused by a horizontally travelling electromagnetic pulse induced by a lightning discharge current. The lower structure is caused by electrostatic effects induced by the unneutralized charge left after the lightning discharge current flows. The electromagnetic codes developed can simulate the self-consistent response of the upper atmosphere to the lightning discharge current. The electrostatic treatment can predict only the optical emission at heights less than similar to 80 km. The optical emission intensity has a strong nonlinear dependence on the electric field strength through the enhanced electron density, and is increased for a long discharge path, a large current, and a short pulse. Also, the higher the lightning discharge is initiated, the brighter the optical emission is, because the electrostatic field is stronger for high altitude lightning. (C) 1998 Elsevier Science Ltd. All rights reserved.