Skip to main content

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

Trent Garlipp

2
Posts
38
Followers
8
Following
A member registered Feb 09, 2019 · View creator page →

Creator of

Recent community posts

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)

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.