scene.compositor.CompositorTree

scene.compositor.CompositorTree(scene)

Builder for the scene’s compositor node tree.

Mirrors :class:~molecularnodes.entities.base.MolecularTree: use it as a context manager to append nodes, or :meth:reset to start from a clean Render Layers -> output graph and build the post-processing chain yourself with nodebpy.compositor nodes.

from nodebpy import compositor as c

with canvas.compositor.reset() as (image, output):
    image >> c.Glare.bloom() >> output
canvas.compositor.add_annotations()

Execution settings for the render-time compositor are exposed as properties: :attr:device, :attr:precision, :attr:denoise_device, :attr:denoise_preview_quality and :attr:denoise_final_quality.

# on a headless machine without a GPU
canvas.compositor.device = "CPU"

Notes

The surface is intentionally minimal — raw nodebpy node construction. We may later add higher-level convenience wrappers (e.g. add_glare(), add_vignette()) that build common effects in one call, but for now effects are composed by the user directly.

Attributes

Name Description
denoise_device Device Denoise nodes execute on: "AUTO", "CPU" or "GPU".
denoise_final_quality Denoise node quality in final renders: "HIGH", "BALANCED"
denoise_preview_quality Denoise node quality in preview renders: "HIGH", "BALANCED"
device Device the compositor executes on: "CPU" or "GPU".
image The rendered image to build the compositor chain from.
output The final image output of the tree, adding it if it is missing.
precision Precision the compositor executes at: "AUTO" or "FULL".

Methods

Name Description
add_annotations Composite Molecular Nodes annotations on top of the current output.
reset Clear the tree back to a default state and build within it.

add_annotations

scene.compositor.CompositorTree.add_annotations()

Composite Molecular Nodes annotations on top of the current output.

Alpha-composites the mn_annotations image over whatever currently feeds the output. Annotations are opt-in: :meth:reset clears them, so call this after building a custom compositor chain to draw them on top.

reset

scene.compositor.CompositorTree.reset()

Clear the tree back to a default state and build within it.

Discards the existing tree — including any annotation overlay, which can be restored with :meth:add_annotations. Use with canvas.compositor instead to append to the existing tree.

with canvas.compositor.reset() as (image, output):
    image >> c.Glare.bloom(strength=2.0) >> output