godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.14k stars 95 forks source link

Add GPU, CPU, FPS frame widget, and (draw calls, vertex count) for the 2D editor window #2384

Open jordo opened 3 years ago

jordo commented 3 years ago

Describe the project you are working on

2D destructible terrain multiplayer game. And rendering smooth font outlines with msdf. PR here: https://github.com/godotengine/godot/pull/44772

Describe the problem or limitation you are having in your project

Our 2d game is fairly resource heavy. In our 2D scene we have multiple viewports, terrain fields, water shaders which sample screeen textures, etc. A lot of the visual design is done in-editor. In the 3D editor there is a nice toggle which shows at a glance, some scene information in the editor viewport. (CPU time, GPU time, draw calls, vextex count, etc). See below:

3d_editor_view

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

It would be nice to have a similar feature in the 2D editor viewport. I was recently playing with the msdf font rendering PR here: https://github.com/godotengine/godot/pull/44772, and noticed that this view: Screen Shot 2021-03-01 at 12 51 07 PM brought my editor to an ABSOLUTE CRAWL. Well, it ended taking close to 100ms for my GPU to process that frame in editor, because thick outlines at that scale end up sampling a font texture a few thousand times per fragment. It took a bunch of time to dig in, add the instrumentation, and then figure out where the bottleneck is, instead of just having a simple toggle like the 3D workflow, and easily determine 'OK, it looks like something is GPU bound'.

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

The 2D editor viewport can have some of the same helpful profiling widgets as the 3d viewport. I propose we move "View frametime", and "View information", toggles from the 3D editor viewport 'perspective' drop down currently here: per

To the view menu here: new2

The view menu is constant across both 2D and 3D workflows, and would allow the 2D workflow to enable visibility of this information as well.

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

N/A

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

This could be done as an add-on, but it's pretty core to the workflow in-engine. It would consolidate more of the 2D and 3D workflows which makes usability easier across workflows.

Calinou commented 3 years ago

Note that this is quite complex to implement as we'll have to factor out the frame time and information panels from the Node3DEditorPlugin first.

PS: It looks like we should add a MAX() to the FPS calculation denominator to avoid infinite-ish values… Edit: Done by https://github.com/godotengine/godot/pull/47733.

jordo commented 3 years ago

@reduz Actually, I'll comment that maybe we could move all 4 of the 'view' settings that are currently under the 'perspective' drop-down in 3D, to the view menu? It seems better to have these all in a consistent place no? (Also then if I do implement in 2D, can unify workflow) See video below:

https://user-images.githubusercontent.com/323868/109572294-948d7d00-7ab2-11eb-9f1c-0768afdcbe7b.mov

aaronfranke commented 3 years ago

I think this proposal is a great idea! For one, it improves UI consistency, since view toggles should go in the view menu. For another, it adds stuff to 2D that's already in 3D, which makes sense.

The environment toggle is not necessary anymore and can be deleted, because there is now a dedicated button in the top bar (as in the below image, the circled buttons are duplicates). All three of the remaining options starting with "View" make sense to be moved to the "View" menu. If there are others that should be moved too that's also open for discussion.

Screenshot from 2021-03-30 19-37-00

I think this should be done in two PRs: First, move the existing options for 3D, then in another PR, add debug information to 2D.

Calinou commented 3 years ago

The environment toggle is not necessary anymore and can be deleted, because there is now a dedicated button in the top bar (as in the below image, the circled buttons are duplicates).

View Environment is still useful if you have a custom environment in the current scene and wish to hide it temporarily.