In Blender 2.8 +, how do I limit the (animation / multi-frame) render to only one pass (e.g. only z-pass or only Mist pass)?

Related, not properly answered: How to render only a mist pass Related, talks about using compositor: Render Passes separately

I have the rendering engine set to Eevee here:

I have only the "Mist" pass selected and everything else (including the "Combined" pass) in View Layer Properties:

Yet, when I'm trying to output the animation like so

, the "combined" pass is rendered anyway:

I need just the Mist pass to be saved, like I can see in the Image Editor after the render when I choose the "Mist" pass from the dropdown:

I'm looking for a simple solution with the EEVEE engine, without compositor if possible, because I am doing this programmatically, via Blender compiled as a Python module.

Alternatively, if you can think of a simple way to do this programmatically via the compositor, this would also work for me.

This used to be possible with the Blender internal rendering engine before 2.8, so, if there is no way to do this with Eevee, I would consider this a regression.

Aside: In the meantime, I'll try to compile some older version of Blender as a Python module, e.g. 2.78 (2.79 has build errors that are fixed in some later commit before 2.80) and see if I can get that to work.

1 Answer

I figured out a simple way to do use the compositor programmatically to isolate the mist pass in the renderers (Inspired by this answer).

import bpy

# (perhaps) more code here

# perhaps defined in some function or method
node_tree = bpy.context.scene.node_tree
render_layers_node = node_tree.nodes.get("Render Layers")
composite_node = node_tree.nodes.get("Composite")
links = node_tree.links
links.clear()
links.new(render_layers_node.outputs["Mist"], composite_node.inputs["Image"])

# (perhaps) more code here

bops.render.render(animation=True)
$$$$
`