ComfyUI Extension: ComfyUI-Y7-SBS-2Dto3D

Authored by yushan777

Created

Updated

1 stars

Convert 2D images or videos into 3D side-by-side (SBS) formats

Custom Nodes (0)

    README

    ComfyUI-Y7-SBS-2Dto3D

    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 ;)

    Installation (ComfyUI Manager)

    This is the better way to install:

    • Open ComfyUI Manager
      • Custom Nodes Manager
      • → Search for Y7 or Y7Nodes.
      • Install.
      • Restart Restart ComfyUI

    Installation (Manual)

    1. 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
      
      
    2. 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   
      
    3. Restart ComfyUI if it's already running.


    Nodes

    Y7 SBS (Image)

    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>

    • 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.
    </details>

    Y7 SBS (Video)

    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>

    • 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.
    </details>

    About Cross-eyed Mode

    • 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

    Formats and Aspect Ratios

    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.