Abstract. It is dark in here and you are holding the only lamp. Everything on this page is text, and all of it is solid: it stands in the light and throws a shadow. Nothing was drawn in advance.
The lights are on, so none of that is true at the moment. What follows describes the dark.
Lampblack
1 Ink
For most of the history of writing, the blackest ink anyone had came out of a flame. Hold a cold dish over an oil lamp, scrape off the soot, bind it with gum. Lampblack.1
The large type on this page is set in it. Ink gives nothing back, so you never see it directly. You see the light it took.
“There is no better, there is no more open door by which you can enter into the study of natural philosophy, than by considering the physical phenomena of a candle.”
2 Chalk
Small type is set in chalk, which is the opposite arrangement. It keeps almost nothing, so this paragraph is exactly as bright as you make it.
A line of it is a hedge rather than a wall. Some of the lamp gets through, less with every row.
3 Ember
Some words bring their own light. The colours were not picked. Each is what a black body glows at that temperature, worked out from Planck’s law when the page loads.
- 1100 K
- 1850 K
- 2700 K
- 4100 K
- 5500 K
- 6500 K
- 12 000 K
4 Mark
Highlighting was always meant as light. Here it is taken at its word. Select any sentence on this page: it fluoresces, and whatever stands nearby is lit by it.
5 Company
ClickPress and hold anywhere empty to leave a candle. It burns for ninety seconds, gutters, and goes out.
6 Method
None of this is an image. The text is ordinary HTML: select it, search it, zoom it, hand it to a screen reader.
Once, at load, every glyph is drawn into a coverage map, and a jump-flood pass [3] turns that into a distance field. Every frame, each lamp is ray-marched through the field using Eq. 1, and the glow from embers and selections is gathered with radiance cascades [2], which is why it has no noise. The light is drawn underneath the text. The text is blended over it.
Press D to step through the intermediate buffers.
| Rays cast | — |
|---|---|
| Cascades | — |
| Lamps | — |
| Matter map | — |
| Frame | — |
| Quality | — |
References
- M. Faraday. The Chemical History of a Candle. Griffin, Bohn & Co., 1861. gutenberg.org/ebooks/14474
- A. Sannikov. Radiance Cascades: A Novel Approach to Calculating Global Illumination. 2023. github.com/Raikiri/RadianceCascadesPaper
- G. Rong and T.-S. Tan. Jump flooding in GPU with applications to Voronoi diagram and distance transform. I3D ’06, 109–116. doi.org/10.1145/1111411.1111431
- D. E. Knuth. Computer Modern Typefaces. Addison-Wesley, 1986. Set here in Latin Modern, B. Jackowski and J. M. Nowacki, GUST.
- India ink, Chinese ink sticks and printer’s black are all, underneath, soot. ↑
No frameworks, no bitmaps.