Accessing scene information in a CompositorEffect

Godot Version

4.5.1

Question

I’m wondering if there is a way to take information in the scene hierarchy – for example, properties of an object in the scene – and getting that information into a CompositorEffect that’s in the effects list on the WorldEnvironment?

I do know that directly accessing the scene should not be allowed, because the main function of the CompositorEffect is the render callback, presumably done on a different thread than the scene update. In a hypothetical other engine, the way I might handle this is by creating a region of data that is populated by the game simulation, then replicated to the render thread for consumption in a thread-safe manner.

Naively, I have tried so far creating an export variable on the CompositorEffect script with type Node3D, but this generates an error as I might expect, specifically that a Node3D export is disallowed on a script of this type. After that, I explored if it was possible to create a global script which could act as the middleman to pump the information between the scene and access it in the render callback (likely not thread-safe anyway), and to Godot’s credit I get an error Invalid access to property or key ‘test’ on a base object of type ‘Node (Global.gd)’.

So, is there a “correct” way to do this or is it even possible at all?

Summarizing: I’d like to take properties of a node in the scene hierarchy, which could change over time, and pipe them into a CompositorEffect script so that the effect can respond to the changing properties.