project-surface-dot-grids
Create perspective-correct dotted scans on windows, walls and floors in Three.js or tracked footage. Use for an AR reveal that stays attached to the environment during camera motion.
Try your first task
A source-grounded starter task has not been verified for this skill yet.
SKILL.md
name: project-surface-dot-gridsdescription: Create perspective-correct dotted scans on windows, walls and floors in Three.js or tracked footage. Use for an AR reveal that stays attached to the environment during camera motion.Project dotted grids onto surfaces
Choose the surface that owns the pattern. A cabin window, the pavement beyond it and a pair of moving spectacles all have different motion and occlusion. Define the grid in pane UVs or physical surface coordinates. Preserve one origin and spacing for the entire shot so dots do not crawl when the camera pans.
Generate and project
- On a mesh, repeat a cell in surface coordinates. A distance field around the cell center gives a round dot on the surface that naturally foreshortens on screen. Estimate the pixel footprint before taking the fractional part. As a cell approaches one pixel across, fade it toward the intended average coverage to suppress moiré.
- On a filmed planar pane, follow four well-spaced, stationary corners. Map the original plane into each new frame with a homography. Project each dot center plus one offset along each grid axis. These two projected vectors describe the screen ellipse. Use their lengths and orientation for small perspective footprints, or project and rasterize the entire disc when seen at a steep angle.
- Mask to the inside of the gasket and subtract foreground silhouettes. Clip again to the moving lens if the dots are initially visible only through spectacles. Keep separate tracks for panes that occupy different planes.
A starting fragment for mesh UVs in a derivatives-capable shader:
vec2 grid = uv * cellCount;
vec2 pixel = max(fwidth(grid), vec2(0.0001));
float radius = 0.085; // in cell units
float d = length(fract(grid) - 0.5);
float aa = 0.5 * max(pixel.x, pixel.y);
float dotMask = 1.0 - smoothstep(radius-aa, radius+aa, d);
float unresolved = smoothstep(0.35, 1.0, max(pixel.x, pixel.y));
dotMask = mix(dotMask, 3.14159 * radius * radius, unresolved);
Time the reveal
Gate opacity against the story cue. For a two-second opening at 24 fps, frames 0–47 are available. A short fade over the last twelve frames lets the eye return to the subject. Compare the first, fastest and final frames against the unmarked shot. Watch the export for dots swimming across mullions, leaking onto a hand or forming stripes in the distance.