CV Rasterize Mesh
Renders a mesh that already lives in the graph (pts3d + tris, not a model file) through an OpenCV camera, and returns what the rest of the pack actually needs from a render: the SILHOUETTE as a MASK and METRIC camera-space depth. Shares its z-buffer with 'CV Preview 3D (Calibrated Camera)' - on the shipped truck the two silhouettes agree at IoU 1.0000 - so the mask you composite with and the picture you look at can never drift apart. rvec/tvec accept a single pose OR the Bx3x1 stacks 'CV Rapid Track (Sequence)' emits, so one node turns a tracked clip into a per-frame matte and a per-frame depth map. The depth output is the metric map 'CV Preview 3D (Calibrated Camera)'.scene_depth wants, which is how a tracked real object occludes a virtual one. Pinhole only: lens distortion is NOT applied (undistort the frames first, or use the viewer node when you need the lens). Triangles only, no texture, no shading - this node emits geometry, not a picture.
- pts3d
- tris
- K
- rvec
- tvec
- silhouette
- depth
- coverage
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| pts3d | NPARRAY | Nx3 vertices in OPENCV object space, from 'CV Mesh From 3D Model' (optionally through 'CV Mesh Split Long Edges' or 'CV Transform Points 3D'). | |
| tris | NPARRAY | Mx3 int triangle indices into pts3d. Indices past the end of pts3d yield an empty render rather than reading out of bounds the way cv2.rapid.drawWireframe does. | |
| K | NPARRAY | 3x3 camera matrix of the frames being matched. Must be the SAME K the pose was solved with, or the silhouette lands in the wrong place. | |
| rvec | NPARRAY | Rotation, Rodrigues 3x1 - or a Bx3x1 STACK to render a whole tracked sequence in one execution. | |
| tvec | NPARRAY | Translation 3x1, or the matching Bx3x1 stack. Its units are the units the depth output is in. | |
| width | INT | 8008–8192 | Output width in pixels. Use the frame's own size so the mask lines up with the footage; K must match it (halving the render means halving fx/fy/cx/cy too). |
| height | INT | 6008–8192 | Output height in pixels, matching the frames. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| silhouette | MASK | One 0/1 MASK per pose (a MASK batch): 1 where the mesh covers the frame. Hard-edged - there is no supersampling here; blur it if you need a soft matte. This is the per-frame roto of a tracked object, ready for compositing, inpainting or a ControlNet. |
| depth | NPARRAY | METRIC camera-space Z in the mesh's own units, float32, and `inf` where the mesh does not cover the pixel - which is exactly what 'CV Preview 3D (Calibrated Camera)'.scene_depth reads as 'no measurement here, never occlude'. Shape is HxW for a single pose and BxHxW for a pose stack; take one frame out with 'CV Index Batch'. Sample it at projected points ('CV Sample Array At Points') to test whether an annotation anchor is facing the camera. |
| coverage | FLOAT | Mean fraction of the frame the mesh covers, over all poses. A health signal: 0 means the model missed the frame entirely (wrong K, wrong units, pose behind the camera), not that the render failed. |