ComfyUI Node
BD Depth To Shadow Map
Derive a procedural greyscale shadow map from a depth image. Combines: • N·L lighting from depth-derived surface normal (default top-down) • Cavity ambient occlusion from depth Laplacian (eye sockets, mouth crease) • Ambient floor Output is a greyscale image suitable for u_image3.R in the skin shader, or any downstream node that uses a luma-based shadow multiplier. Geometry-aware: automatically carves shadow into recesses (eye sockets, cheek hollows) and lights upward-facing surfaces (forehead, brow ridge). Designed for the zombie variant of the multi-tone skin pipeline.
BD Depth To Shadow Map
- depth
- mask
- shadow_map
- normal_map
- cavity_map
- measured_max_curvature
◄light_x0.00►
◄light_y-1.00►
◄light_strength0.70►
◄ao_strength0.60►
◄ao_radius8►
◄ambient0.35►
◄depth_blur2.0►
◄invert_depthfalse►
Category🧠BrainDead/Segmentation
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| depth | IMAGE | Depth map image. Brighter = closer to camera. Typically from Lotus2 or a depth estimator. If RGB, the R channel is used. | |
| light_x | FLOAT | 0.00-1–1 | Light direction X (image-space). -1=left, +1=right, 0=centered. |
| light_y | FLOAT | -1.00-1–1 | Light direction Y (image-space). -1=TOP (default, top-down lighting), +1=bottom, 0=horizontal. |
| light_strength | FLOAT | 0.700–2 | How much N·L contributes to final shadow. 0=disable top-light, 1=full Lambertian, >1=exaggerated. |
| ao_strength | FLOAT | 0.600–2 | How much cavity AO contributes. 0=disable, 1=normal, >1=exaggerated darkness in recesses (more zombie). This is what creates the sunken-eye / hollow-cheek look. |
| ao_radius | INT | 81–64 | Pixel radius for cavity detection (Laplacian sigma). 8-16 catches eye sockets / cheek hollows. Smaller = fine creases only. Larger = broad hollows. |
| ambient | FLOAT | 0.350–1 | Minimum output value (ambient floor). Prevents pure-black voids. 0.35 = output never goes below 35% grey. Higher = brighter overall. |
| depth_blur | FLOAT | 2.00–16 | Pre-blur applied to depth before normal computation. Higher = smoother lighting (less noisy). 0 = raw depth. Helps if depth has stair-step quantization or noise. |
| invert_depth | BOOLEAN | false | ON: treat darker pixels as closer (Lotus2 convention is the opposite). Toggle if shadows appear inverted (sockets lit, peaks dark). |
| maskopt | MASK | Optional mask. Pixels outside the mask get the ambient floor value (not the computed shadow). Use a skin mask to limit AO to face. |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| shadow_map | IMAGE | Greyscale shadow map (R=G=B). 1.0=fully lit, 0.0=fully shadowed (clamped by ambient floor). Wire to u_image3.R input (or use as a shadow_mult multiplier in any pipeline). |
| normal_map | IMAGE | Derived surface normal visualized as RGB. R=nx, G=ny, B=nz, encoded [-1,+1] → [0,1] (standard tangent-space normal map). Useful for debugging or downstream lighting nodes. |
| cavity_map | IMAGE | Cavity AO term in isolation (R=G=B). 1.0=open surface, 0.0=deepest cavity. Useful for visualizing what AO is detecting. |
| measured_max_curvature | FLOAT | Peak Laplacian magnitude in the depth — useful for tuning ao_strength across characters with different depth scales. |