ludic/changes/a-lens-and-an-edge.md
Orkuncakilkaya ae52e9c4da feat(render3d): anti-aliasing that exists, and a lens for the viewfinder
The shipping default had NO anti-aliasing at all: the temporal resolve was removed, the
setting's first option went on saying "Temporal", and MSAA defaults to one sample, so
every machine without DLSS drew grass and needle cards with nothing smoothing an edge.

FXAA in the sharpen pass, which already reads the neighbourhood and runs last on the LDR
image. No history, so it cannot drag or smear a reflection. 25.5% less single-pixel
staircase on edge pixels.

The trap, recorded because it inverted the result: the unsharp delta must be computed
from the RAW image and only then applied to the anti-aliased colour. Centre from FXAA and
neighbours from the raw texture measures half smoothing and half signal, so the mask
sharpens precisely what FXAA softened - 29% WORSE than no anti-aliasing at all.

Depth of field for the photo mode: a disc whose radius is the circle of confusion,
normalised by focus distance so a landscape shot is not a macro, with taps rejected
unless they are at least as out of focus as the pixel they blur into - which is what
stops a sharp foreground haloing into a blurred background. Between the scene and the
bloom, so a blurred highlight still blooms. Skipped whole when the aperture is shut.

400 frames in ordinary play: GL 7.1 s, VK 7.2 s - the lens does not draw there.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-19 17:38:25 +03:00

1.8 KiB

bump: minor type: feat Anti-aliasing that exists, and a lens for the viewfinder.

THE SHIPPING DEFAULT HAD NO ANTI-ALIASING AT ALL. The temporal resolve was removed (for good reasons - it reprojected water through the surface plane and dragged the mirror image behind the camera), the setting's first option went on saying "Temporal", and MSAA defaults to one sample. Every machine without DLSS - which is every Mac - drew a frame full of grass blades and needle cards with nothing smoothing a single edge.

FXAA now, in the sharpen pass, because that pass already reads this pixel's neighbourhood and runs last on the LDR image. It has no history, so it cannot drag or smear a reflection. Measured on edge pixels: 25.5% less single-pixel staircase.

One trap worth recording. The unsharp mask's delta is computed from the RAW image and only then applied to the anti-aliased colour. Taking the centre from the FXAA result and the neighbours from the raw texture measures a difference that is half smoothing and half signal, so the mask sharpens exactly the edges FXAA just softened - measured, that first version was 29% WORSE than no anti-aliasing at all.

And depth of field, for the photo mode: a disc of taps whose radius is the pixel's circle of confusion, signed so the two sides of the focal plane differ and normalised by the focus distance, because a lens focused at two metres throws a background out far harder than one focused at two hundred. A tap only counts if it is at least as out of focus as the pixel it is blurring into, which is what keeps a sharp foreground from haloing into a blurred background. It runs between the scene and the bloom so a blurred highlight still blooms, and the whole pass is skipped when the aperture is shut - in ordinary play there is no lens and this never draws.