Reference local scene ImageTexture within a Material

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Althar93

Hello all,

I have a feeling this is not something that is currently possible in Godot 3.4 but :

Is there a way for a SpatialMaterial or ShaderMaterial to reference an ImageTexture that is local to the scene WITHOUT having to write some script to shoehorn the texture through?


In my case, I have a Node that has some logic for populating the contents of an ImageTexture which is local to that particular node. Unfortunately, within the editor, when I go about trying to assign a Texture to a SpatialMaterial or ShaderMaterial, the only option I get is to load an external resource ; there is no way for me to assign a resource that lives under another node in the scene (I guess in a similar way to how the ViewportTexture browser works).

Given the ImageTexture has its own resource path, you would think there was a way of browsing through the scene tree & look for that resource but other than writing a custom script to explicitely bind the texture to my material, there is no out-of-the-box solution that I could find/think of.

The only other alternative I have is to save the ImageTexture to disk, and then assign it to the material but this goes against the potential for having a ‘Local to Scene’ ImageTexture that I generate every session.


Thanks in advance!