# Record
**Author:** @cameron.stream (`did:plc:gfrmhdmjvxn2sjedzboeudef`)

## `3n2fgsjqs6s2b`
**Collection:** `site.standard.document`
**AT URI:** `at://did:plc:gfrmhdmjvxn2sjedzboeudef/site.standard.document/3n2fgsjqs6s2b`

**Title:** Photographic prism rings
**Published:** Mon, 16 Nov 2026 01:30:16 GMT
**Updated:** Mon, 16 Nov 2026 00:00:00 GMT
**Description:** How the Cameron.stream homepage refracts its photograph inside a ring using rotated sampling, separated color channels, and a transparent canvas.
**Publication:** `at://did:plc:gfrmhdmjvxn2sjedzboeudef/site.standard.publication/3mr4py6clps2f`
**Path:** /photographic-prism-ring
**Tags:** knowledge, practice, design, visual-style, web-design, graphics

**Content:**
```json
{
  "text": "A photographic prism ring is a ring-shaped image distortion that resembles chromatic glass. On the [homepage](https://cameron.stream/), the ring copies the photograph beneath it, rotates the sampled detail, and separates the red and blue samples. The center and exterior remain transparent. The photograph supplies the colors and recognizable features that make the band look refractive.\n\nThis case study follows the [renderer](https://cameron.stream/public/home-prism.js) used on Cameron.stream. The effect uses a transparent Canvas 2D layer, with no WebGL dependency or continuous animation. Its parameters are visual approximations rather than measurements of physical glass.\n\n![A synthetic grid before and after rotated, color-separated sampling inside a ring.](/public/images/photographic-prism-ring.png)\n\nThe illustration uses a synthetic grid to expose the sampling changes: source image on the left, ring output on the right. The homepage applies the same method to a photograph.\n\n## Match the photograph first\n\nThe renderer draws the background photograph into a second, offscreen canvas. Its scale and crop must match the visible CSS background. A different crop makes the ring look like an unrelated image pasted over the page.\n\nFor a `cover` background, the scale is the larger of the viewport-to-image width and height ratios. For an explicit background width, the renderer derives the height from the image's aspect ratio. [Background position](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/background-position) sets the offset within the remaining space. At a 50% horizontal position, that offset is half the difference between viewport width and scaled image width.\n\nThe script waits for image decoding and font loading before drawing. Font readiness matters because the greeting's measured position helps locate the ring. It then uses [drawImage](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawImage) to reproduce the crop and [getImageData](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/getImageData) to read the source pixels.\n\n## Restrict the effect to an annulus\n\nAn annulus is the region between two concentric circles. For a pixel at distance $d$ from the ring's center, a centerline radius $r$, and a half-width $h$, the renderer computes:\n\n$$\ne = h - |d-r|.\n$$\n\nOnly pixels with $e>0$ receive color. The alpha value increases from zero at either edge to full opacity over 1.5 CSS pixels:\n\n$$\n\\alpha = \\min(1,e/1.5).\n$$\n\nThe output buffer starts transparent. That preserves the ordinary photograph inside and outside the ring without a separate cutout or painted center. A final [putImageData](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/putImageData) writes the ring onto the overlay canvas.\n\n## Rotate detail and separate color samples\n\nEach output pixel looks up its color at a different location in the source photograph. This inverse-sampling approach keeps the output ring fixed while changing the image seen through it.\n\nLet $(dx,dy)$ be the output pixel's offset from the ring center. For channel index $c$, where red is 0, green is 1, and blue is 2, the renderer shifts the horizontal coordinate by $(1-c)s$. Red and blue therefore move in opposite directions; green stays unshifted. The source lookup applies a 5-degree rotation around the center:\n\n$$\nu = c_x + \\cos(\\theta)(dx+(1-c)s) + \\sin(\\theta)dy,\n$$\n\n$$\nv = c_y - \\sin(\\theta)(dx+(1-c)s) + \\cos(\\theta)dy.\n$$\n\nHere $(c_x,c_y)$ is the ring center, $s$ is the channel shift, and $\\theta$ is 5 degrees. The rotated scene detail produces the displacement; the separated channels produce colored fringes. The shift occurs before rotation, so it does not model wavelength-dependent radial refraction.\n\nThe lookup usually lands between source pixels. Bilinear interpolation blends the four surrounding pixels using their horizontal and vertical distances. That interpolation prevents the rotated detail from becoming a staircase of nearest-neighbor samples.\n\nThe homepage multiplies sampled color channels by 1.18 and clips at 255. That brightness adjustment helps the glass band stand apart from the photograph. It operates on encoded channel values rather than a physical light-transport calculation.\n\n## Size the band for portrait and landscape\n\nThe shipped settings use CSS-pixel-sized canvas buffers:\n\n| Setting | Desktop | Phone below 680 px wide |\n| --- | --- | --- |\n| Full band width | 96 px | 48 px |\n| Channel shift magnitude | 4 px | 2.4 px |\n| Source rotation | 5 degrees | 5 degrees |\n| Brightness multiplier | 1.18 | 1.18 |\n\nPhone radius is the smaller of 43% of viewport width and 30% of viewport height. That height limit constrains the ring on landscape phones. Desktop radius uses the smaller of 30% of width and 37% of height. The greeting anchors the preferred vertical placement, with additional space reserved for the navigation. A second clamp uses the full outer edge to keep the band inside short viewports when the diameter fits.\n\nThe responsive helper also selects the channel shift. Passing its complete geometry object to the pixel renderer preserves the phone's 2.4-pixel shift; omitting that property uses the renderer's 4-pixel desktop default. For a container smaller than the ring's outer diameter, shrink the ring or omit the decoration rather than relying on the placement clamp.\n\nCanvas dimensions, source pixels, and ring geometry use the same coordinate system. A higher-density backing buffer requires scaling every radius, offset, and feather distance together. Changing only the canvas resolution changes the apparent effect.\n\n## Keep the effect separate from interaction\n\nThe overlay sits above the photograph and below the greeting. It ignores pointer events and is hidden from assistive technology because it adds no information. The underlying photograph and links remain usable if drawing fails.\n\nThe script draws once after decoding, then redraws on resize. A single animation-frame callback coalesces resize events; no idle loop changes the image. The ring and photograph share entrance timing. Reduced motion removes the ring's fade and shortens the photograph's transition to 10 milliseconds. Establishing the ring's hidden state before the first draw prevents a bright band from appearing before the photograph.\n\nThe surrounding navigation uses a static glass treatment. Keeping its labels outside the distortion separates the decorative surface from the controls, consistent with the site's [design system](https://cameron.stream/knowledge/archival-liturgical-modernism).\n\n## Reuse the technique\n\nDownload the [skill](/public/downloads/creating-photographic-prisms.skill), or read its [instructions](/public/downloads/creating-photographic-prisms.md). The package contains a pure pixel renderer, the responsive sizing recipe, and offline synthetic tests. It includes no photograph and makes no network calls during its tests.\n\nThe tests check the transparent center and exterior, edge feathering, unshifted sampling, color-channel displacement, rotation, rejected inputs, and portrait/landscape sizing. Browser checks remain necessary for background alignment, text placement, reduced motion, and click targets. Those checks prove different properties from the pixel tests.\n\nThe renderer expects opaque source imagery and writes its own annulus alpha. Cross-origin images require suitable permission headers before their pixels can be read. Full-size source and output buffers also consume memory proportional to the viewport area. The implementation has no measured frame-rate claim and does not simulate refractive indices, Fresnel reflection, or wavelength-dependent light transport.\n\n## Sources\n\n- [Cameron\\.stream homepage](<https://cameron.stream/>)\n- [Homepage prism renderer](<https://cameron.stream/public/home-prism.js>)\n- [MDN drawImage](<https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawImage>)\n- [MDN getImageData](<https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/getImageData>)\n- [MDN putImageData](<https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/putImageData>)\n- [MDN background\\-position](<https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/background-position>)",
  "$type": "site.standard.content.markdown",
  "version": "1.0"
}
```

---
*Fetched from https://enoki.us-east.host.bsky.network via `com.atproto.repo.getRecord`*