Panda3dLoadDepthModel
Turn a depth map into real 3D geometry in your scene
- base
- loader
- parent
- depthimg
- textureimg
- base
- model
Depth estimation in the ComfyUI world usually means one of two things: a ControlNet preprocessor, or the raw data for a "living photo" parallax effect. Panda3dLoadDepthModel is squarely in the second camp, and it takes a more literal route than most. Instead of just warping pixels, it builds an actual 3D mesh from your depth map and drops it into the Panda3D scene graph as real geometry you can move, rotate, and render from the engine's camera. When the pack was posted to r/StableDiffusion in early 2024, the top comment was someone asking for exactly this: a depth-pass render option. So this is the node the community asked for.
How it works
The mechanism is old-school but effective. Feed it two images - a texture and a depth map - and it does this:
- Converts both tensors to PNGs and writes them to
custom_nodes/ComfyUI-Panda3d/models/output/with a timestamped name. - Reads the depth image as grayscale and treats each pixel's brightness as height, generating a per-pixel grid of vertices - a classic heightfield.
- Writes that grid out as a Wavefront
.objfile, plus an.mtlmaterial file that references the texture image. - Loads the OBJ with
loader.loadModel()and parents it into the scene at the position you set.
The p (pitch) input defaults to 90, which rotates the flat mesh to face the camera - that's the parallax trick in a single default. Feed it the output of a DepthAnythingPreprocessor (the pack's own workflow_depth.json chains exactly that way) and you get a gently displaceable surface instead of a flat card.
The inputs that matter
- depthimg (IMAGE) - the grayscale depth map. Whiter = closer, which is the standard convention.
- textureimg (IMAGE) - the color image that gets mapped onto the mesh. This is the one you'll recognize in the output.
- parent (Panda3dModel) - the scene-graph parent;
renderfromPanda3dBasefor world space. - x / y / z, h / p / r, sx / sy / sz - same position/orientation/scale controls as the other transform nodes.
pdefaults to 90 for a reason.
It also requires base and loader from Panda3dBase, like every loader in the pack. Outputs are base (passthrough) and model, which you wire into Panda3dTest to render.
Installing it
One pack, all nodes. ComfyUI Manager, search ComfyUI-Panda3d, or:
cd ComfyUI/custom_nodes
git clone https://github.com/chaojie/ComfyUI-Panda3d
cd ComfyUI-Panda3d
pip install -r requirements.txt
Restart ComfyUI. You'll also want a depth preprocessor - DepthAnythingPreprocessor works out of the box and pairs naturally.
Gotchas
- Mesh size scales with image resolution. The node creates a vertex per pixel, then two triangles per pixel cell. A 512×512 depth map is ~260k vertices and half a million triangles - fine for a one-off, but don't feed it a 4K image and expect speed.
- It writes files. Every run dumps PNGs, an OBJ and an MTL into
models/output/. It cleans up nothing, so that folder accumulates junk over time. Deleting it is safe. - There's a built-in one-second sleep after writing the mesh - presumably to let the files flush before the engine reads them. It makes runs feel laggy, but it's intentional.
- Depth inversion. The node passes
depthInvert=Trueto its mesh builder, so dark-near/bright-far maps still work - just be aware that the inversion is hardcoded, not a toggle.
It's the most interesting node in the pack, and the one that actually does something no other ComfyUI node does out of the box: real geometry from a depth map, inside a real engine, rendered to frames.
Inputs (14)
| Name | Type | Default | Description |
|---|---|---|---|
| base | Panda3dBase | — | |
| loader | Panda3dLoader | — | |
| parent | Panda3dModel | — | |
| depthimg | IMAGE | — | |
| textureimg | IMAGE | — | |
| x | FLOAT | 0.00 | — |
| y | FLOAT | 0.00 | — |
| z | FLOAT | 0.00 | — |
| h | FLOAT | 0.00 | — |
| p | FLOAT | 90.00 | — |
| r | FLOAT | 0.00 | — |
| sx | FLOAT | 1.00 | — |
| sy | FLOAT | 1.00 | — |
| sz | FLOAT | 1.00 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| base | Panda3dBase | — |
| model | Panda3dModel | — |