Nodes/ComfyUI-TRELLIS2_Motion/Mesh Renderer (3D to Image)
ComfyUI Node

Mesh Renderer (3D to Image)

The nvdiffrast renderer with five looks

By styletransfer·Created 8 months ago·Updated 8 months ago· 6
Mesh Renderer (3D to Image)
  • mesh
  • camera_trajectory
  • background_color
  • rendered_image
output_width1920
output_height1080
render_modepbr
lighting_presetstudio
num_frames1

MeshRenderer is where a TRELLIS mesh stops being a data blob and becomes something you can actually look at. Feed it a TRELLIS_MESH (from Trellis2Predict) plus a CAMERA_TRAJECTORY (from CameraTrajectory_T2), and it renders the mesh from that viewpoint to a standard ComfyUI image - the thing you can preview, save, or feed into an upscaler.

It's the node that makes the whole pack feel like magic on the single-image path. LoadImage → Trellis2Predict → MeshRenderer → SaveImage, with a CameraTrajectory feeding the middle - that's the pack's own single_image_novel_view.json workflow, and it's the fastest way to see what you're building.

How it works

Rendering is done with nvdiffrast, NVIDIA's differentiable CUDA rasterizer - the same workhorse the TRELLIS pipeline itself uses, which is why this pack leans on it. The node builds the camera's MVP matrix from your trajectory, rasterizes the mesh's triangles, interpolates vertex attributes (normals, colors, textures) across the surface, and shades the result.

The clever bit is the five render modes, all implemented right in the node:

  • pbr - full lighting pass using the mesh's PBR data and one of four lighting presets (studio, outdoor, dramatic, flat). Studio is the default and it's the look you'll want for a product shot; flat is what you want before cel shading.
  • wireframe - edge visualization, great for checking topology or that low-poly aesthetic. Triangles only, white-on-background.
  • cel - quantized shading with a clean toon look, computed straight from light intensity bands.
  • normal - RGB-encoded surface normals, the texture-baker's friend.
  • depth - normalized grayscale depth map.

The node also auto-frames the subject: if you leave distance and the center at their defaults, it estimates the mesh's center and a good camera distance from the actual vertices, so even a "static, default everything" render lands on the object instead of in empty space.

The inputs that matter

  • mesh and camera_trajectory - the only required inputs, and they're exactly the outputs of Trellis2Predict and CameraTrajectory_T2. This is the one wiring you can't get wrong.
  • output_width / output_height - default 1920×1080, range 256–4096. If you're just previewing, drop to 512 and save the VRAM; the render itself is fast (~0.1s per frame at 512 on an A100 per the README).
  • render_mode - the five looks above. This is where the pack earns its "advanced rendering effects" billing.
  • lighting_preset - studio / outdoor / dramatic / flat.
  • background_color - hex color behind the mesh. Default black; set it to white if you're compositing.
  • num_frames - 1 by default. Raise it (up to 300) to render an animated trajectory as a sequence of frames; each frame gets its own camera pose if animate was on in the trajectory.

The output is rendered_image (IMAGE) - one image for a static shot, an image batch for a multi-frame render, ready for SaveImage or VHS_VideoCombine.

Installing

The standard pack setup:

cd ComfyUI/custom_nodes
git clone https://github.com/styletransfer/ComfyUI-TRELLIS2_Motion
cd ComfyUI-TRELLIS2_Motion
python install.py --full
pip install git+https://github.com/microsoft/TRELLIS.git
pip install git+https://github.com/NVlabs/nvdiffrast.git

Restart ComfyUI; the node is under TRELLIS2/Render.

Common issues

  • "nvdiffrast is not available." This node is the one that needs it, so this error is its signature. pip install git+https://github.com/NVlabs/nvdiffrast.git is the fix - it's a CUDA wheel, so make sure your torch/CUDA build is compatible or you'll be compiling it yourself.
  • Black or blank render with the right wire. Check background_color (black default is easy to mistake for a failure) and that the mesh actually has vertices - an errored Trellis2Predict upstream will hand you an empty mesh and MeshRenderer will render exactly that.
  • Slow multi-frame renders. At 1024 with num_frames in the hundreds you're paying for every pixel times every frame. Preview at 512, then render big when you're happy.
  • "CUDA is required" even though you're on a GPU. The node hard-checks torch.cuda.is_available(). If your ComfyUI is running in CPU mode, fix that first - this pack has no CPU path, and MeshRenderer is where you'll find out.
CategoryTRELLIS2/Render

Inputs (8)

NameTypeDefaultDescription
meshTRELLIS_MESH3D mesh from TRELLIS2
camera_trajectoryCAMERA_TRAJECTORYCamera parameters from CameraTrajectory node
output_widthoptINT1920256–4096Output image width
output_heightoptINT1080256–4096Output image height
render_modeoptCOMBOpbrRendering style
background_coloroptCOLOR#000000Background color for rendered image
lighting_presetoptCOMBOstudioLighting configuration
num_framesoptINT11–300Number of frames to render (for animated trajectories)

Outputs (1)

NameTypeDescription
rendered_imageIMAGE