Convert 2D images or videos into 3D side-by-side (SBS) formats
Two custom ComfyUI nodes that convert 2D images or videos into 3D stereoscopic side-by-side (SBS) format, viewable on a variety of VR headsets like the Meta Quest, Apple Vision Pro, HTC Vive, and other compatible devices. But if you don't have any of those, there's always Cross-eyed mode ;)
ComfyUI Manager
Custom Nodes Manager
Y7
or Y7Nodes
.Clone this repository into your ComfyUI custom_nodes directory:
cd /path/to/ComfyUI/custom_nodes
git clone https://github.com/yushan777/ComfyUI-Y7-SBS-2Dto3D comfyui-y7-sbs-2dto3d
Install Dependencies
# activate your venv (if you have one)
# Linux/macOS
source venv/bin/activate
or
# Windows
venv/Scripts/activate
pip install -r requirements.txt
Restart ComfyUI if it's already running.
Takes a single image as input, and its associated depth map and will produce an SBS formatted stereoscopic 3D image.
<details> <summary>ℹ️ <i>See More Information</i></summary><strong>Inputs/Widgets</strong>
</details>
- base_image: The image you wish to convert to 3D
- depth_map: The depth map of the base image
- method: Select the 3D rendering method:
- Mesh Warping:
- Grid Sampling:
- depth_scale: Controls the strength of the 3D effect (default: 30). Higher values create more pronounced depth but at the cost of tearing and artefacts
- mode:
- Parallel: For parallel viewing (left eye sees left image, right sees right image)
- Cross-eyed: For cross-eyed viewing (left eye sees right image and vice versa) - useful to check the effect if you do not have a 3D device.
- depth_blur_strength: Controls how much to blur the depth map transitions (3-15, odd values only). Higher values create smoother depth transitions but may lose detail.
Takes a video's frames as input, and their associated depth maps and and will produce an SBS formatted stereoscopic 3D video.
<details> <summary>ℹ️ <i>See More Information</i></summary><strong>Inputs/Widgets</strong>
</details>
- frames: The frames of the video you wish to convert to 3D
- depth_maps: The depth maps of video frames
- depth_scale: Controls the strength of the 3D effect (default: 30). Higher values create more pronounced depth but at the cost of tearing and artefacts
- mode:
- Parallel: For parallel viewing (left eye sees left image, right sees right image)
- Cross-eyed: For cross-eyed viewing (left eye sees right image and vice versa) - useful to check the effect if you do not have a 3D device.
- depth_blur_strength: Controls how much to blur the depth map transitions (3-15, odd values only). Higher values create smoother depth transitions but may lose detail.
- temporal_smoothing: Controls smoothing between frames (0.0-0.5). Higher values create more consistent depth perception between frames but may reduce responsiveness to rapid depth changes.
- Cross-eyed mode is primarily used for viewing stereoscopic 3D images on a regular 2D screen without needing any special equipment. Here's how it is used:
- With Parallel, the left-eye image feeds the left eye, and the right-eye image feeds the right eye.
- But with Cross-eyed, this is flipped it places the left-eye image on the right side and the right-eye image on the left side.
- When you cross your eyes, each eye ends up looking at the correct image, and your brain fuses them into a 3D image which will appear centered. If done correctly, that middle image will appear 3D without the need for a VR headset or 3D glasses.
- More Information here
Note that some 3D viewer apps will interpret square aspect ratios per eye as VR180 format. For example in ImmerGallery, you can force the format by suffixing the filename with _LR, or you can modify the image via its menu.