TransformToMatrix
Build a camera transform from sliders, not 16 numbers
- transformation matrix
Everywhere in camera-comfyUI you need a MAT_4X4 - to move a point cloud with TransformPointCloud, rotate splats with RotateSplats, or feed a camera_matrix into a projection node. TransformToMatrix is the friendly way to produce one: instead of typing sixteen numbers, you get five sliders - three translations and two rotations - and it assembles the 4x4 matrix for you.
The inputs, exactly:
shiftX,shiftY,shiftZ- translation along each axis (range ±1000).theta,phi- two rotation angles in degrees (range ±360).
The output transformation matrix is a MAT_4X4 with a batch dimension, which every consumer in the pack expects. The internal recipe is translation composed with two rotations: T @ R_theta @ R_phi. Here's the honest caveat: the code's docstring labels theta as "rotation around the Y-axis" and phi as "around the X-axis," but the implementation actually applies phi through the Y-rotation and theta through the X-rotation. The naming and the math disagree, and the result is that you can't trust the labels. This is a genuine trap - you'll set theta, nothing happens the way you expected, and you'll blame yourself before you blame the node.
The practical workaround is to not care. It's two angles; set one, watch the render, set the other. If your rotation is on the wrong axis, you've picked the wrong slider, not broken the math. For anything where the exact matrix matters (a pose you copied from elsewhere, a Blender export, a COLMAP run), skip this node entirely and use its sibling TransformToMatrixManual, where you type the real values.
Also note there's no roll control here - two rotation axes and three translations is what you get. If you need a full free-orientation camera transform, either chain two of these or go straight to the manual node.
Where it shows up: the demo workflows use it to nudge the pinhole camera and shift point clouds around, and it's the quickest way to test "what does the scene look like 30 degrees to the side?" without building a whole trajectory. It's pure numpy math - no GPU, no models - so it runs on anything.
Install with the rest of the pack - ComfyUI Manager, search camera-comfyUI, Install, restart; or by hand:
git clone https://github.com/Alexankharin/camera-comfyUI.git custom_nodes/camera-comfyUI
cd custom_nodes/camera-comfyUI && python install.py
For quick camera-move experiments, this is the node you'll grab first. Just remember the theta/phi label quirk and you'll save yourself an afternoon of clicking the wrong slider.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| shiftX | FLOAT | 0.00-1000–1000 | — |
| shiftY | FLOAT | 0.00-1000–1000 | — |
| shiftZ | FLOAT | 0.00-1000–1000 | — |
| theta | FLOAT | 0-360–360 | — |
| phi | FLOAT | 0-360–360 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| transformation matrix | MAT_4X4 | — |