Nodes/ComfyUI_pytorch360convert/Equirectangular to Perspective
ComfyUI Node

Equirectangular to Perspective

Point a virtual camera inside your panorama — the node that makes 360s usable for faces and subjects

By ProGamerGov·Created 2 years ago·Updated 11 months ago· 37
Equirectangular to Perspective
  • e_img
  • Perspective Image
fov_deg_h90.00
fov_deg_v90.00
h_deg0.00
v_deg0.00
out_h512
out_w512
in_rot_deg0.00
padding_modebilinear

Equirectangular images have a dirty secret: the people in them look wrong. Faces get wider near the center, narrower near the edges, and anything at the poles becomes a smear. It's the price of the 2:1 format. But you don't have to do your image work in that distorted space - you can extract a normal, rectilinear photo out of the panorama, process it like any normal image, and put it back. That's what Equirectangular to Perspective (E2P) is for.

Think of it as pointing a virtual camera somewhere inside the sphere. You tell it where to look (yaw/pitch), how wide the lens is (FOV), and what resolution to shoot at, and it renders a perspective view of that slice of the pano. Same math as how 360 video players let you look around, just as a still output.

How it works

The node calls e2p from the pytorch360convert library. For each output pixel it computes a ray from the virtual camera through the image plane, finds where that ray hits the sphere, and samples the equirectangular image there. All inputs that matter:

  • fov_deg_h and fov_deg_v - horizontal and vertical field of view in degrees (both default 90). 90×90 is roughly a normal-ish lens; crank it up for a wide-angle look, drop it for a zoomed crop. This is where a lot of the "why does it look stretched" confusion comes from - an equirect panorama sampled through a 120° lens gets heavily barrel-distorted by design.
  • h_deg and v_deg - where the camera looks. h_deg is yaw (0 = the panorama's center/front, 180 = directly behind it, and the image wraps so you can pan continuously), v_deg is pitch (positive looks up, negative looks down). These are your "spin the viewer" controls.
  • out_h and out_w - output resolution, both default 512.
  • in_rot_deg - rotation of the camera around its own view axis (roll). Useful for straightening a horizon.
  • padding_mode - sampling mode, bilinear default.

Output is a single Perspective Image - a normal flat image you can send to anything: a sampler, a face-restore node, an upscaler, whatever.

When you'd reach for it

The killer use case is people. Instead of generating faces directly in equirectangular space (which models hate), you can render a perspective view of a region, do face work there, and fold it back in - that's why the pack's Equirectangular to Face / Face to Equirectangular pair exists for a full face, and E2P is the more flexible version for arbitrary crops. It's also just the fastest way to check what a panorama looks like from a particular angle without opening a viewer: render a few perspectives at different h_deg values and you've effectively looked around the room.

It's also worth knowing this is the node people use to turn a 360 into "normal" training or generation material - extract a flat photo, run it through SD, and composite back. If that's your plan, do the extraction at high out_h/out_w (upscale the perspective view rather than a small one) - the resample in E2P is where your detail budget goes.

Install

Same as the rest of the pack: ComfyUI Manager, search "ComfyUI_pytorch360convert", or git clone https://github.com/ProGamerGov/ComfyUI_pytorch360convert into custom_nodes and restart. The requirements.txt is empty, so you'll likely need python -m pip install pytorch360convert in your ComfyUI environment. No models to download - it's all projection math on the tensor.

Categorypytorch360convert/equirectangular

Inputs (9)

NameTypeDefaultDescription
e_imgIMAGE
fov_deg_hFLOAT90.00
fov_deg_vFLOAT90.00
h_degFLOAT0.00
v_degFLOAT0.00
out_hINT512
out_wINT512
in_rot_degFLOAT0.00
padding_modeCOMBObilinear3 options: bilinear, bicubic, nearest

Outputs (1)

NameTypeDescription
Perspective ImageIMAGE