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

Add Model Viewer Widget #5613

Merged
merged 18 commits into from
Sep 8, 2023

Conversation

sturnclaw
Copy link
Member

@sturnclaw sturnclaw commented Aug 26, 2023

This PR rewrites the old ModelViewer interface into a new, docking-enabled viewport widget which can be used portably as part of a larger editor, and a set of sidebar panels which no longer draw over the viewport.

A picture is worth a thousand words, or so they say. Here's the old interface:

And here's the new interface:

2023-08-26.15-40-31.mp4

The major win here is that the model viewer now renders to an ImGui window instead of the fullscreen backbuffer, which means we can use it in many different contexts, potentially even in a running game.

TODO:

  • Enable MSAA when working with render targets
  • Use font icons instead of text icons (forgot to cherry-pick the commit)

Core code for viewing models implemented in terms of a movable + resizable window for use during live gameplay or in editor.

Dependent on the "editor app" framework, for intended use inside a greater editor context. Further work required for use in-game.
- Add "model" tab for animation+pattern+colors
- Add menu bar widget to select light setup
- Refactor custom widget code into Editor::Draw
- Add menu extension points via virtual functions
- Dock subwindows in model viewer app host window
- Move most controls to dropdowns in model viewer widget
- Add UI extension delegates to render extra menu items
- Clean up all duplicated rendering + loading code
- Overwrites the user's saved dock node layout, but ensures a consistent interface on each run
- Copy/Blit and MSAA resolve operations added to command list
- Proper render target state tracking in OGL::RenderStateCache
- Fix hidden bugs with render target creation
- GuiApplication is now responsible for creating the MSAA backbuffer target for rendering.
- Graphics::Renderer::StateTicket resets render target + viewport state on cleanup
- Removed Renderer::SetClearColor et al, clears are expected to provide an explicit clear color.
- Active render target state is still messy; we want to reduce overall state tracking.
- GuiApplication can own the window backbuffer but a GBuffer/color buffer should be owned by some scene-rendering related facility.
- Fix invalid lighting data being inherited from previous render passes
- Add MSAA and resolve pass to ModelSpinner viewport rendering
@sturnclaw
Copy link
Member Author

MSAA has been re-enabled and this PR includes a set of bugfixes for rendering-related issues that have cropped up as part of this series of PRs. Pending further testing by interested parties, this PR is now ready for merge.

- On Nvidia, MSAA resolve uses a different, higher-quality sampling filter when resolving to the window backbuffer.
- This difference is very perceptible when rendering thin lines with high contrast.
- This does not present a significant performance cost on mid-high spec systems. Ideally this workaround is dynamically enabled based on driver version etc.
@sturnclaw sturnclaw merged commit 0938f42 into pioneerspacesim:master Sep 8, 2023
@sturnclaw sturnclaw deleted the model-viewer-widget branch September 8, 2023 04:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant