godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.16k stars 97 forks source link

Add an option to stop the rendering in editor and free VRAM when running the game #10559

Open Rytelier opened 2 months ago

Rytelier commented 2 months ago

Describe the project you are working on

3D game with high graphics

Describe the problem or limitation you are having in your project

Currently when running the game, the game runs in a separate instance and editor renderer is still running which results in doubled VRAM usage. This is a big issue for people with lower end graphics cards, as the graphics memory can overflow and cause performance problems. This also might cause issues when having many assets in the scene.

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

There should be an option to stop all the rendering and free its VRAM when running the game, it would solve the high memory usage.

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

A checkbox in Debug bar would give an option for what is described above. When game runs, editor stops all rendering until the use requests to resume the render or closes the game.

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

The rendering can be paused in the editor viewport, but VRAM is still used, I don't know if there's solution to free the memory on demand.

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

The use of advanced 3D graphics is raising for Godot developers and the issue might be major roadblock for some developers.

Calinou commented 2 months ago

You can save most of the editor's VRAM usage by closing the currently open scene in the 3D editor. Implementing this could be as simple as making the editor close its open scenes when running a project and restoring them when stopping the running project, although this will prevent you from using live scene editing and editor camera replication.

Also, texture streaming would make this much less of a necessity. The engine would automatically adapt to the amount of VRAM available on the system, so you'd run out of VRAM much less often in projects where it matters most (i.e. 3D projects).