Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

This plugin is a godsend, I'm making a game with some FMV stuff and it's so much better using this than having to use the built-in video formats supported by Godot on its own.

It works amazing for the FMVs in my game and I was also able to get it working with 3D light projectors by putting the videoplayback node in a subviewport and updating the projector texture with the video image from the subviewport. 

However this isn't super great on performance as it has to update the projector image every frame (or in my case I have it update on a timer closer to 24 fps). Do you have any idea how I can make this work more efficiently? My way feels pretty hacky right now.

How is performance of your video playback inside of the test room?

The test room runs great, I think what's tanking performance is updating the projector image the way I am (which is probably not the best way but i don't know a better way).


This is the code I have that gets the video into the projector:


extends SpotLight3D

@export var video_viewport: SubViewport

var projector_texture:ImageTexture

var timer:Timer

var image:Image

func _ready() -> void:

    timer = Timer.new()

    timer.connect("timeout",update_image)

    #Only update the projector video every 1/24 of a second (the video framerate)

    timer.wait_time = 0.042

    add_child(timer)

    timer.start()

    image = video_viewport.get_texture().get_image()

    projector_texture = ImageTexture.create_from_image(image)

    light_projector = projector_texture


func update_image() -> void:

    image = video_viewport.get_texture().get_image()

    projector_texture.set_image(image)

Don’t use a timer for updating the image, not a great way of doing it. I don’t understand your code and what you’re trying to achieve very well to give better advice.

For updating the frame, use _process and use the delta for having the correct time to update the frame.

You might get more useful help in the discord server in the GoZen channel ;)