What drew me to Denisyuk holograms was the remarkable sense of depth in a thin, flat plate. At first glance, the plate looks like it holds a 2D image. Looking into it, however, feels like looking through a window at a real object on the other side. Being able to explore the object’s depth by changing viewpoint was particularly striking. It feels like looking into a space, rather than simply viewing a flat photograph.
The video below shows the appearance that inspired this article. I wanted to understand how a thin plate can record such depth, then explore how much of that impression I could recreate with a single photo and code.
Watch the original video on YouTube
What is a Denisyuk hologram?
A Denisyuk hologram records a reflection hologram with a single laser beam. Light passes through a transparent recording plate and illuminates an object behind it. Returning object light meets incoming light inside the recording layer, forming interference fringes. MIT’s Denisyuk holography lab explains this arrangement.
The recorded structure selectively reflects wavelengths, so white light from an appropriate direction can reveal a three-dimensional image. This experiment takes the single-color appearance of a single-wavelength recording as its starting point. Principles and reconstruction
Approximating the appearance from one photo
In code, estimated depth creates movement with changing viewpoint, while a selected laser wavelength supplies the color. This is a 2.5D experiment in depth and single-color appearance rather than an optical interference calculation.
Choose a photo below to begin. Your photo and depth map stay in browser memory and are released when you clear the photo or leave the page.
Choose a photo, add depth, and explore it from a new viewpoint.
Your photo and depth map are processed on this device. They are never sent to an AI server or stored on a server.
Choose a photo, then press “Create 3D view”.
Choose a photo to begin
Try it
- Choose a photo with a distinct foreground subject and background, then press Create 3D view. The first run may take longer while the model downloads.
- Switch between Original, Depth map, and 3D result. Brighter depth values represent regions estimated to be nearer; darker values represent regions farther away.
- Move your mouse or touch and drag across the 3D view. Focus the canvas to use arrow keys, or press Home to center the view.
- Increase Depth strength and Viewpoint range gradually. Lower both if edges appear stretched. Change Light direction to reveal the surface shape.
- Select Hologram to reveal Laser color settings. Defaults are 632.8 nm · He–Ne and Laser color correction 100%. Brightness varies with viewpoint and lighting while retaining a red hue. Return to 3D Photo to compare the color image.
Depth estimation and the 2.5D surface
Depth Anything V2 Small estimates relative depth from shapes and context in a photo. It does not measure real distances or dimensions. Glass, reflections, transparent objects, and blurred boundaries can produce incorrect estimates.
This experiment normalizes and gently smooths the prediction, then displaces a dense Three.js plane mesh along its depth axis. The original photo becomes the texture, and the observation camera moves within a small range. Displacement fades near the outer edge, and the color mode uses a flat photo behind the mesh to reduce empty edges.
This first version is 2.5D. It does not reconstruct hidden surfaces or backgrounds absent from the photo, so large viewpoint shifts can stretch the texture. Hologram simulates colors and highlights reminiscent of a reflective hologram; it does not generate optical interference patterns.
Matching the laser color
Choose 405, 473, 532, 632.8, or 650 nm with Wavelength preset, or use Wavelength to adjust continuously between 400 and 700 nm. Compare red at 632.8 nm with green at 532 nm. The swatch and 3D view update immediately without repeating depth estimation.
At Laser color correction 100%, the photo supplies brightness information, while both the surface and highlights retain the selected wavelength’s hue. At 0%, the original rainbow reflection effect returns; intermediate values blend the two. Keep 100% to explore a single-color appearance and adjust Light direction.
The conversion uses Wyman, Sloan, and Shirley’s analytic fit to the CIE 1931 color matching functions to obtain XYZ values, followed by a linear sRGB conversion. Negative channels outside the display gamut are clipped and brightness is normalized. This is an RGB approximation on your monitor, not a reproduction of a laser’s spectrum or power.
A physical hologram’s reconstructed color also depends on recording-layer shrinkage or swelling and illumination angle. Here the selected wavelength remains fixed; these optical wavelength shifts are not calculated. MIT’s observation exercises
Browser support and performance
Transformers.js and ONNX Runtime Web run inference in your browser. WebGPU is preferred when available. GPU initialization or inference failures trigger a CPU/WASM fallback, and CPU compatibility mode can also be selected manually. No separate AI server or paid API is used.
Photos are limited to 20 MB, 40 MP, and an aspect ratio within 8:1. The display image is reduced to a maximum long edge of 1,024 pixels. Model input is bounded to 392 × 392 in normal GPU mode, or 280 × 280 on CPU and in low-power mode; fine details and depth boundaries may be simplified.
Model and runtime files are downloaded from external hosts, and the browser may cache model files. Photos and inference results are never stored in this cache. Initial downloads include about 50 MB for the GPU model (99 MB without half-precision support), or 27 MB for the CPU model, plus runtime files. Falling back from GPU to CPU can require another model download.
Inference runs in a Worker to keep the interface responsive. Cancel terminates the Worker, and model memory is also released after inference finishes. The 3D view renders only during interaction and pauses offscreen or in a hidden tab. Slow rendering automatically reduces display resolution. Recreating the view in Low-power mode also reduces inference resolution and mesh size.
Model sources and open licenses
- Original: Depth Anything V2, Lihe Yang et al., 2024. Small model: Apache 2.0. Other model sizes have different licenses and are not used here.
- ONNX conversion: onnx-community/depth-anything-v2-small, Apache 2.0. Its self-contained ONNX files are used with Transformers.js 3.8.1, pinned to revision 4472b73. The successor ONNX repository stores weights in separate files.
- Transformers.js: Apache 2.0 · ONNX Runtime: MIT · Three.js: MIT.
Copyright in selected photos remains with their respective rights holders.