- Docs
- Components
- 3D & Shaders
- Depth Image
Depth Image
Relights a flat photo as if it had depth: a pointer driven light rakes across an estimated height field with surface detail and self cast shadows
Customize
Props
30| Name | Type | Default | Description |
|---|---|---|---|
image | string | — | Photo to relight. |
depthMap | string | — | Optional real depth map, white near and black far. When omitted one is estimated from the photo. |
fit | "cover" | "contain" | "cover" | How the photo fills the container. |
depthFromLight | number | 0.5 | Estimated depth: 0 reads depth from vertical position only, 1 from brightness only. |
depthSmoothing | number | 7 | Blur applied to the height field, in steps of five texels of a 512 wide map. Applies to supplied depth maps too. |
depthContrast | number | 1.2 | Estimated depth: contrast applied to the estimate. |
invertDepth | boolean | false | Flip near and far. |
displacement | number | 1.5 | Height of the relief in scene units; the plane is 2 tall. |
normalStrength | number | 1.5 | Strength of the large scale surface tilt from depth. |
detail | number | 0.8 | Strength of fine surface detail read from the photo. |
shadowIntensity | number | 0.7 | Darkness of self cast shadows, 0 disables them. |
shadowSoftness | number | 0.1 | Penumbra width of the shadows. |
lightColor | string | "#ffffff" | Light colour. |
lightIntensity | number | 6 | Light brightness. |
falloff | number | 2.5 | How quickly the light fades with distance, 0 is even, 4 is a tight pool. |
elevation | number | 1.2 | Height of the light above the surface. |
ambient | number | 0.02 | Flat fill light applied everywhere. |
ambientColor | string | "#ffffff" | Colour of the fill light. |
colorPreserve | number | 0 | How much of the photo's own tone survives in unlit areas, 0 to 1. |
follow | number | 0.12 | How quickly the light follows the pointer, 0 to 1. |
autoOrbit | boolean | true | Move the light on a slow circle when the pointer is away. |
orbitRadius | number | 0.6 | Radius of the idle orbit, 0 to 1. |
orbitDuration | number | 10 | Seconds per idle orbit. |
view | "lit" | "depth" | "normal" | "lit" | Debug view of the estimated depth or the normals. |
backgroundColor | string | "#000000" | Floor colour of the unlit surface, so shadows settle on the page colour rather than pure black. |
fallbackColor | string | "#171717" | Colour shown while the photo loads or if it fails. |
paused | boolean | false | Freeze the light. |
dpr | number | 1.5 | Render scale cap. |
className | string | — | Extra classes for the container. |
children | ReactNode | — | Content layered above the canvas. |
imagestringPhoto to relight.
—depthMapstringOptional real depth map, white near and black far. When omitted one is estimated from the photo.
—fit"cover" | "contain"How the photo fills the container.
"cover"depthFromLightnumberEstimated depth: 0 reads depth from vertical position only, 1 from brightness only.
0.5depthSmoothingnumberBlur applied to the height field, in steps of five texels of a 512 wide map. Applies to supplied depth maps too.
7depthContrastnumberEstimated depth: contrast applied to the estimate.
1.2invertDepthbooleanFlip near and far.
falsedisplacementnumberHeight of the relief in scene units; the plane is 2 tall.
1.5normalStrengthnumberStrength of the large scale surface tilt from depth.
1.5detailnumberStrength of fine surface detail read from the photo.
0.8shadowIntensitynumberDarkness of self cast shadows, 0 disables them.
0.7shadowSoftnessnumberPenumbra width of the shadows.
0.1lightColorstringLight colour.
"#ffffff"lightIntensitynumberLight brightness.
6falloffnumberHow quickly the light fades with distance, 0 is even, 4 is a tight pool.
2.5elevationnumberHeight of the light above the surface.
1.2ambientnumberFlat fill light applied everywhere.
0.02ambientColorstringColour of the fill light.
"#ffffff"colorPreservenumberHow much of the photo's own tone survives in unlit areas, 0 to 1.
0follownumberHow quickly the light follows the pointer, 0 to 1.
0.12autoOrbitbooleanMove the light on a slow circle when the pointer is away.
trueorbitRadiusnumberRadius of the idle orbit, 0 to 1.
0.6orbitDurationnumberSeconds per idle orbit.
10view"lit" | "depth" | "normal"Debug view of the estimated depth or the normals.
"lit"backgroundColorstringFloor colour of the unlit surface, so shadows settle on the page colour rather than pure black.
"#000000"fallbackColorstringColour shown while the photo loads or if it fails.
"#171717"pausedbooleanFreeze the light.
falsedprnumberRender scale cap.
1.5classNamestringExtra classes for the container.
—childrenReactNodeContent layered above the canvas.
—