# Camera–light recipes

A recipe should produce a visible relationship between movement, geometry and
light, with a small runnable study before a world maker integrates it. The first
recipe is **specular reveal**: a procedural rosette becomes legible in reflected
light near an authored viewpoint, then breaks up and fades as the visitor moves.
Every facet has the same material. There is no motif texture or camera-facing
image overlay in the shader.

## Basis and scope

The facet normal is chosen halfway between the direction to the light and the
direction to the authored eye. Reflection then aims toward that eye. See the
half-direction construction in [PBRT's microfacet chapter](https://www.pbr-book.org/4ed/Reflection_Models/Roughness_Using_Microfacet_Theory).
The preview evaluates a direct-light GGX model with separable Smith masking and
Schlick Fresnel. The metallic colour and incident radiance are authored, not a
measured brass calibration.

Matthew Brand's [Specular holography](https://arxiv.org/abs/1101.0301) is relevant
prior work on controlling moving glints through surface design. This recipe is
a narrower, discrete camera/light alignment study. It does not solve Brand's
continuous holographic surface equations or reconstruct a general 3D hologram.
No novelty priority, diffraction, spectral interference or voxel GI is claimed.

## What the tool produces

The recipe accepts a world-space host frame, camera, directional light, relief
depth, material roughness, deterministic seed and motif. The built-in motif is a
procedural rosette; a caller can instead supply one binary mask value per facet.

It returns actual tilted quad geometry and normals, triangle indices, a portable
GLSL BRDF function, reflection-law diagnostics and a standalone interactive page.
Centres are displaced along authored camera rays, retaining their designed
projection while placing them at different real depths. Subsequent camera motion
therefore changes both parallax and specular alignment. The seed is consumed by
background deflection and facet depth.

The shader receives positions and normals, never the motif classification.
The classification is retained only in CPU diagnostics. A flat-facet control
retains centres, light, camera and material while replacing orientations.

## Jerusalem handoff

Try a bounded panel in a cedar screen, thin metal inlay or a new decorative
surface, with an authored resting viewpoint. Keep the original stone and its
lighting intact. Use the city's actual sun direction and world-space camera;
changing either invalidates the original optical alignment. The city material
must evaluate a view-dependent specular response for this effect to appear.

The recipe supplies an optical arrangement, not a manufactured screen. The maker
must design supports, thickness, stone clearance, self-shadowing and the actual
material path. The preview has depth testing but no inter-facet shadow solution,
scene reflections or indirect transport. A numerically correct alignment does
not establish an attractive result in the city.

Compare authored view, both sidesteps, detuned light and flat-facet control. Return
to the authored state and require restoration. Start still; do not add automatic
camera movement or flashing. Inspect actual images and motion before promoting
the recipe. GPU timing remains absent unless measured by supported timestamps.

## Run and recover

Open `/specular-reveal.html` from the FMVisual app. Drag the image horizontally
to sidestep, or use Reveal pattern, Step aside and Move light. The status line
shows camera displacement, light angle and roughness. Return to authored view
restores the original setup. From any working directory:

```sh
fmvisual recipes list
fmvisual recipes generate specular-reveal --out artifacts/my-reveal
fmvisual recipes inspect --input artifacts/my-reveal
cd artifacts/my-reveal
python3 -m http.server 8091
```

Then open `http://127.0.0.1:8091`. Use `--spec FILE.json` to supply a custom setup;
`recipe.json` in the generated directory is a complete editable example. Generate
into a new directory after editing. Existing directories are refused. Receipts
record hashes, output sizes and measured CPU generation wall time. The portable
viewer uses no package install, network assets or downloaded evidence archives.
The little-endian buffers are interleaved float32 position/normal (24-byte stride)
and uint32 triangle indices. The viewer rebuilds the same geometry from the spec;
inspection requires the stored buffers to match that reconstruction exactly.

Initial commissioning on 24 October 2026 passed reflection/projection/winding,
determinism, invalid-input and tamper-detection tests. A real WebGL2 browser run
verified camera and light changes, flat normals, direct-light removal, exact reset,
idle rendering and mobile layout without page errors. The authored rosette and
its dissolution under a 1.1 metre sidestep were visually inspected. This remains
an isolated recipe; Jerusalem integration has not been evaluated.

Local evidence: `artifacts/specular-reveal-proof/`; portable recovery copy:
`artifacts/specular-reveal-v1/`. These are local paths, not an R2 preservation claim.

## Make and hand off a variation

Expand **Make this illusion yours** on the page. Choose flower petals and tile
detail, then change relief or coverage. Each edit regenerates real geometry and
returns to its authored camera/light alignment so the result is immediately
visible. **Save recipe** downloads JSON with the current design and roughness;
**Open saved recipe** validates it before replacing the current work. A failed
import leaves the previous design usable. Changing the viewing camera or light
is an experiment, not a redesign of the authored alignment.

**Download 3D tiles (.obj)** exports world-space metre geometry and normals.
It deliberately leaves material assignment to the receiving renderer. Every tile
should share the same reflective material. Use the camera/light in the saved
JSON and the exported BRDF contract; a diffuse material will not reconstruct this
view-dependent effect. The CLI also includes `panel.obj` beside its binary buffers.

A tested handoff is: save JSON in the page, generate a new directory using that
file with `--spec`, inspect the directory, then open its standalone viewer. This
carries the visual experiment to another maker without asking them to reconstruct
the settings by hand. The relief is an optical arrangement, not construction-ready
fabrication geometry.

The authoring workbench and a fresh standalone export passed browser editing,
recipe/OBJ downloads, exact canvas-pixel restoration, invalid-file recovery,
non-square custom masks and mobile checks. The commissioning record and source
hashes are at `public/research/specular-reveal-validation.json`. The current
portable local copy is `artifacts/specular-reveal-workbench-v1/`.

## The rotating sphere

Open `/specular-sphere.html`. The original single-alignment sphere revealed a
flower near just one pose, so free spherical dragging lost the effect. The current
recipe addresses this with **14 authored reveal directions**, including eight
diagonals, and a view-following direct-light rig. The default has 10,310 tiles
and 20,620 triangles. All tiles still share one BRDF.

Each tile belongs to a cardinal or diagonal region. Its motif membership and
normal are baked into the generated mesh. Camera/light half-directions are solved
in that region's authored frame. The shader receives no motif mask or face label.
Both positions and normals rotate rigidly about Y and then X; the camera stays
fixed. New flowers rotate into view rather than one flower staying unchanged.

**Lighting follows the reveal** steers directional lights using the rotated
regions' central optical normals. Each light direction reflects toward the eye
at that region's centre. Front-facing weights blend continuously and sum to one;
lights approaching the inside of the globe are excluded. The shader also applies
an analytic sphere-horizon illumination guard. This is an authored, moving light
rig, not a claim that fixed environmental illumination preserves the effect.
Disable it for the fixed-light comparison. The rig does not mutate mesh geometry.

Off-centre facets are an approximation: a region-centre light cannot perfectly
align every facet at every angle. Foreshortening, partial reveals, real tile
occlusion and highlight changes remain. Sampled angular brightness tests measure
signal presence, not beauty or universal all-angle invariance. Horizontal,
vertical and diagonal views have also been visually inspected.

**Return to flower** pauses, resets the orientation and restores the recipe's
lighting mode. **Ordinary sphere control** replaces special normals with radial
normals, while **Light off** removes the direct response. An opaque inner sphere
hides the far hemisphere with real depth testing. The preview does not model
inter-tile shadows, multiple reflections or indirect light.

Motion starts slowly unless reduced motion is requested. Pause, rotation sliders
and two-direction drag give manual control. Motion suspends when the document is
hidden and retires on disposal. Geometry uploads remain static; rotation and
lighting change uniforms. No GPU elapsed time is reported.

```sh
fmvisual recipes generate specular-sphere --out artifacts/my-sphere
fmvisual recipes inspect --input artifacts/my-sphere
```

Save a JSON recipe or OBJ from the page. The CLI also bundles the buildless viewer,
shader, binary buffers and a hashed receipt. OBJ/binary geometry contains the tiles;
receiving scenes must add an opaque inner sphere of radius `0.965 * recipe.radius`.
The `sphereLightRig(spec, yaw, pitch)` helper returns the light directions and
weights for the authored rig. Recreating the effect needs the material, camera
and lighting policy as well as the mesh. OBJ exports the authored orientation.

Version 2 recipes select `all-around`, `six-faces` or `single` layout, and
`following` or `fixed` lighting. Version 1 recipes retain their original single
reveal and fixed lighting; the old vertex buffer identity is regression checked.
Existing portable archives stay unchanged. These are optical prototypes, not
fabrication-ready assemblies or qualified city integrations.
