Log inGet started
Package

sun_flare.shader

Newest version

README.md

sun_flare (shader)

The lens flare the low sun of Sunfall Ridge throws: a post-process pass over the scene's light, in the frame's optics stage before the grade and before the interface is drawn, so the HUD is never flared. SunGlow registers it and writes sunDir whenever the sun moves.

It draws, scaled by how much of the sun the camera sees:

  • six soft ghosts of different sizes and tints along the line from the sun through the frame's centre (ghosts);
  • a faint ring round the sun with its edges split in colour (halo, haloRadius);
  • an anamorphic streak through the sun across the frame, cooler than the sun (streak).

The cover test reads thirteen taps over the sun's disc on screen: a tap counts where the scene's depth is empty sky (the mountain, the wing and the pilot all hide it) and the light that reached the frame there clears gate (a cloud in front, or the deck the sun sinks into, leaves it dim). The share of taps that count is the flare's strength and their colour its tint, so the flare reddens with the sun, fades as the mountain or the wing slides over it and goes out when the sun is under the cloud. nominal is the sun's light the flare is tuned on: a dimmer sun throws a weaker flare. Off screen or behind the camera it draws nothing.

Cost: one full-screen pass at output size, 26 texture reads a pixel (13 depth, 13 colour, all at the same few texels) plus the arithmetic for six ghosts, a ring and a streak.