RenderEngine interactive rendering: getting initial scene?

In the example shown loops over depsgraph.ids followed by looping over depsgraph.object_instances to get the initial scene.

def view_update(self, context, depsgraph):
        if not self.scene_data:
            # First time initialization
            self.scene_data = []
            first_time = True
            # Loop over all datablocks used in the scene.
            for datablock in depsgraph.ids:

            first_time = False

            # Test which datablocks changed
            for update in depsgraph.updates:
                print("Datablock updated: ",

            # Test if any material was added, removed or changed.
            if depsgraph.id_type_updated('MATERIAL'):
                print("Materials updated")

        # Loop over all object instances in the scene.
        if first_time or depsgraph.id_type_updated('OBJECT'):
            for instance in depsgraph.object_instances:

However, what I’m seeing in my tests is that all scene objects are included in depsgraph.object_instances independent of the .hide_render value set on the object. How to make sure that the initial scene only contains the objects that actually need to be rendered? object_instance.show_self doesn’t help as it’s always True it seems.

When handling a final render the depsgraph passed to RenderEngine.render() will only have objects in object_instances that actually need to be rendered. Is there an easy equivalent for interactive renders?

Viewport renders show objects with viewport visibility, not render visibility.

We plan to support showing final render visibility in the future. This will require some deeper internal changes to ensure we can keep such a scene in sync with interactive changes, make it work with overlays, etc. It’s not really possible to work around that from an add-on.

Thanks for the quick reply. I figured out my dumb mistake on the bike on my way home. Sorry for the noise.