Nodes/Avatar Graph/Object Call Calc Matrix Camera
ComfyUI Node

Object Call Calc Matrix Camera

A camera projection matrix, computed but not wired out

By avatechai·Created 3 years ago·Updated 2 years ago· 264
Object Call Calc Matrix Camera
  • BPY_OBJ
  • depsgraph
  • BPY_OBJ
x1
y1
scale_x1
scale_y1

ObjectCall_CalcMatrixCamera is part of the long, undocumented tail inside Avatar Graph (avatechai/avatar-graph-comfyui) - the pack whose headline feature is rigging a single character portrait into a live, blinking, lip-syncing 2D avatar. This particular node has nothing to do with that headline feature directly. It exists because the pack's node generator wrapped essentially every method of Blender's bpy.types.Object API into a ComfyUI node, and this is the camera-projection one.

How it works

It maps to Object.calc_matrix_camera(depsgraph, x, y, scale_x, scale_y), documented in Blender's API as generating the camera's projection matrix. It only makes sense called on an object that's actually a Blender camera. x and y (both defaulting to 1 here, matching Blender's real defaults) represent the render resolution; scale_x/scale_y (also defaulting to 1) are pixel aspect ratios. Feed it real resolution and aspect values and, in Blender proper, you'd get back the 4×4 matrix that maps 3D scene coordinates into that camera's clip space.

Why you'd reach for it

Only if you're scripting something camera-related yourself - say, matching a custom render or compositing step to a specific virtual camera's exact framing, rather than relying on whatever's set up by hand in the scene. Nothing in Avatar Graph's documented workflow (the README's own node list - Create Mesh Layer, Join Meshes, Create Shape Flow, Avatar Main Output, and similar) touches cameras directly, so this is squarely power-user territory.

Inputs and outputs

  • BPY_OBJ (optional) - the camera object to compute the matrix for.
  • depsgraph (optional, default null) - Blender's evaluated dependency graph, required for the calculation to run against current scene state.
  • x, y (optional INT, default 1 each) - target resolution.
  • scale_x, scale_y (optional INT, default 1 each) - pixel aspect ratio scale.

Output is a single BPY_OBJ - the same object passed straight through. Here's the catch worth knowing before you wire this up: Blender's real calc_matrix_camera() returns a Matrix, but that computed matrix never becomes its own output socket in this node's schema. You can call it, but you can't pull the result anywhere else in the graph. This holds for essentially every ObjectCall_* node in the batch - they're side-effecting/query calls whose actual return values don't surface as wires.

Installing it

Avatar Graph depends on Blender's bpy package, so it's fussier to install than a typical pure-Python node pack. On Windows, use the author's bundled Python 3.10 environment (linked in their README), unzipped into your ComfyUI folder and launched via the included .bat, then install "Avatar Graph" from ComfyUI Manager. On macOS/Linux, your ComfyUI environment needs to be Python 3.10.x exactly - conda makes that easy (conda create --name comfyui python=3.10). Then cd ComfyUI/custom_nodes, git clone https://github.com/avatechai/avatar-graph-comfyui.git (their own README's manual-install command points to a stale org, avatechgg - the repo actually lives under avatechai). cd avatar-graph-comfyui && python -m pip install -r requirements.txt, then restart with python main.py --enable-cors-header (Mac: also --force-fp16). That flag opens CORS so the hosted viewer at editor.avatech.ai can talk to your local ComfyUI; skip it if you're exporting .glb/.gltf from Avatar Main Output instead.

Common issues

The Python-version pin is where nearly everyone gets stuck first - bpy needs 3.10.x, not newer. Specific to this node: if you were hoping to read the projection matrix back out for use elsewhere in the graph, this node's schema won't let you - the computed value is discarded from the graph's perspective. And like the rest of this batch, it's absent from the README's own documented node table, so treat this article and Blender's official Python API docs as your reference, not anything Avatech published.

Categoryblender

Inputs (6)

NameTypeDefaultDescription
BPY_OBJoptBPY_OBJ
depsgraphoptdepsgraph
xoptINT1
yoptINT1
scale_xoptINT1
scale_yoptINT1

Outputs (1)

NameTypeDescription
BPY_OBJBPY_OBJ