Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow the render loop to continue when the window is minimized #10286

Closed
pochoco24 opened this issue Jul 26, 2024 · 6 comments
Closed

Allow the render loop to continue when the window is minimized #10286

pochoco24 opened this issue Jul 26, 2024 · 6 comments

Comments

@pochoco24
Copy link

Describe the project you are working on

A Twitch Stream Overlay for OBS.

Describe the problem or limitation you are having in your project

When minimizing the Godot window, the game capture in OBS freezes until I restore the window back.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

If Godot stops drawing when minimized to save energy, it would be great to toggle that feature so OBS captures could work.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

A boolean in Project Settings to toggle drawing when minimized.

If this enhancement will not be used often, can it be worked around with a few lines of script?

This feature can be useful for VR games or games that require to draw while minimized.

I've tried to compile a custom godot build to fix this problem, but I can't find what disabled minimized window rendering. (I'm not familiar with C++ neither.)

Is there a reason why this should be core and not an add-on in the asset library?

I'm unsure if plugins can change engine behavior like this.

@Calinou Calinou changed the title Godot freezes when minimized in OBS Allow the render loop to continue when the window is minimized Jul 26, 2024
@Calinou
Copy link
Member

Calinou commented Jul 26, 2024

@dsnopek
Copy link

dsnopek commented Jul 27, 2024

In order to solve an XR issue (see PR godotengine/godot#94412), we added a feature (in Godot 4.3-rc1) that will allow you to make Godot keep rendering even if all Godot windows are minimized: DisplayServer.register_additional_output()

If an additional output is registered with DisplayServer, then Godot will keep rendering.

@Calinou
Copy link
Member

Calinou commented Jul 27, 2024

I suppose what @dsnopek mentioned could be implemented as a project setting, which would register an additional output with a reserved object name.

@pochoco24
Copy link
Author

pochoco24 commented Jul 31, 2024

I tried to capture Godot with OBS while minimized with this commit, but it still freezes in OBS when the window is minimized.

All I have in the scene is an animated moving cube, a camera, and a script:

extends Node3D

var object = Object.new()

func _ready() -> void:
	DisplayServer.register_additional_output(object)

@dsnopek
Copy link

dsnopek commented Jul 31, 2024

I tried to capture Godot with OBS while minimized with this commit, but it still freezes in OBS when the window is minimized.

Hm. Well, DisplayServer.register_additional_output() should definitely keep Godot's render loop running. I just re-tested this on Windows (since I most recently tested it on MacOS) with a VR application (OpenXR), and if I minimize the window when using Godot 4.3-beta3 the rendering in the headset stops (and never recovers even if I show the window again), whereas with Godot 4.3-rc1 rendering in the headset continues as expected.

So, I don't think the problem is that the render loop has stopped. I would suspect either a Windows issue (maybe it doesn't update the window when minimized even though Godot is rendering it?), an OBS issue (maybe it can't capture the window's content when it's minimized?) or Godot needs to do something else special in order to make Windows or OBS do the right thing.

In any case, the changes from PR godotengine/godot#94412 seem to be working fine in my testing. But I think perhaps some additional changes may be necessary in order to support your use-case?

@Calinou
Copy link
Member

Calinou commented Jul 31, 2024

an OBS issue (maybe it can't capture the window's content when it's minimized?)

@pochoco24 Are you using Game Capture or Window Capture in OBS? I believe Game Capture has options that control how effectively it can capture minimized windows.

Edit: I realized this was already proposed in #1931 a while ago, so consolidating there. Please continue the discussion in that proposal 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants