Charge separation. Collisions between graupel and ice crystals in the presence of supercooled water transfer charge (non-inductive mechanism). In the typical picture the result is a tripole: main negative charge near the -15 C level, main positive charge above it, and a smaller lower positive region. The height of the -15 C isotherm follows the lapse rate: z = (T_s + 15) / 6.5 km, so a warmer day lifts the whole charge structure. Charge magnitudes here are typical orders of magnitude (tens of coulombs), not measurements of a specific storm.
Fields. Each region is a uniformly charged sphere: E = kQ/r^2 outside, E = kQ r / R^3 inside, potential kQ/r outside and kQ(3R^2 - r^2)/(2R^3) inside, with k = 1/(4 pi eps0). The ground is a perfect conductor: every charge has an opposite image charge mirrored below the ground. The ground-level field (field-mill reading, sign convention positive = pointing down) is negative under a negative charge centre and changes abruptly at every flash.
Breakdown. Dry air breaks down at about 3 MV/m at sea level (scaling with density, exp(-z/8.4 km)), yet lightning starts at roughly 0.1-0.3 MV/m inside clouds, because ice and water particles locally enhance the field and make streamers possible. The initiation threshold here is 0.2 MV/m x density ratio (illustrative round number; the physics of initiation is still an active research question).
Leader path. The branching channel is grown with the dielectric breakdown model (Niemeyer, Pietronero, Wiesmann 1984): solve laplace(phi) = 0 with the channel at potential 0 and the target (ground, or the upper positive region for in-cloud flashes) at 1, then add a neighbouring cell with probability proportional to phi^eta. This is a 2D slice: it captures branching and tortuosity statistically, not the real stepped-leader physics (steps of tens of metres every tens of microseconds); the animation is slowed by a factor of about 1000.
Flash rate and energy. A flash removes Delta Q; with charging current I the next flash is about Delta Q / I later, so flash rate = I / Delta Q. Energy released ~ (1/2) Delta Q phi_N, with the potential phi_N of the negative region from the model above. In-cloud flashes are drawn more often when the charge centres are high; their Delta Q is set to 60 % of a ground flash (illustrative). Real in-cloud flashes are usually more frequent than ground flashes.
Flash-to-bang. Light is instantaneous; thunder travels at c = 331.3 sqrt(1 + T/273.15) m/s, so the delay gives the distance: about 3 s per km (5 s per mile). Thunder arrival here is timed with that formula; sound path bending, echoes and the real rumble are not simulated.
Safety note: if you hear thunder, you are close enough to be struck; go indoors. Educational model only. Models built in Blender; textures procedural.