Persistent warn when assigning Viewport Texture to Light Projector Texture

Godot 4.4

I have a 3d scene in which I have a mesh of an old cabinet CRT TV. This TV has a screen with a Viewport Texture assigned to it, and within that SubViewport is a variety of 2d elements. However in order to simulate the variable light of an actual TV being cast into the room I have a second SubViewport with identical 2d elements and a blur shader, which I have assigned to a Spotlight3D. This only works by running this function continually through the _process function:

func light_reset():
	light_projector.light_projector = null
	light_projector.light_projector = $"TV Light".get_texture()

This works great and isnt a performance problem or anything, however, I then receive this warning EVERY FRAME:

“ViewportTexture cannot be used as a Light3D projector texture (). As a workaround, assign the value returned by ViewportTexture’s get_image() instead”.

Provided I’m applying this change correctly (which I assume is the case as it doesn’t throw errors of any kind) the projector no longer works, if I try to ignore the warning, I cannot due to it not having a specified type (as far as I can tell). This is obviously very obnoxious, I do fully understand that according to the docs this workaround I am using is specifically not supported hence the warning, but I am simply unwilling to let it go and it literally still functions, I should at least be able to ignore the warning.

If I am leaving out any relevant code, Images, or other information that may help you help me please let me know. Thank you for reading!

You’ll need to use an ImageTexture for your light_projector and set the viewport’s texture Image to it whenever you want to update it with ImageTexture.set_image()

extends Node

@onready var spot_light_3d: SpotLight3D = $SpotLight3D
@onready var sub_viewport: SubViewport = $SubViewport

var projector_texture:ImageTexture

func _ready() -> void:
	var image = sub_viewport.get_texture().get_image()
	projector_texture = ImageTexture.create_from_image(image)
	spot_light_3d.light_projector = projector_texture


func _process(delta: float) -> void:
	if not projector_texture:
		return
	var image = sub_viewport.get_texture().get_image()
	projector_texture.set_image(image)

Result:

THANK YOU SO MUCH! I see now that it was not simply asking me to tack something onto my existing code. this works perfectly.