Custom ImGUI rendering

  • doodlum
  • Topic Author
More
2 years 9 months ago - 2 years 9 months ago #1 by doodlum Custom ImGUI rendering was created by doodlum
Is it possible to render ImGUI windows at arbitrary points, since I want to be able to render textures at specific points to a GUI for debugging.

Additionally is there a way to render cubemaps and depth stencils. Using Image I'm getting either nothing (cubemaps) or crashes (for stencils).


Also, the latest API version can't build with ImGUI support. Missing ImGuiDockNodeFlags and ImGuiWindowClass.
Last edit: 2 years 9 months ago by doodlum. Reason: weeeeee

Please Log in or Create an account to join the conversation.

  • crosire
More
2 years 9 months ago - 2 years 9 months ago #2 by crosire Replied by crosire on topic Custom ImGUI rendering
Fully custom GUI can be realized in the "reshade_overlay" event (you can create your own windows in there with ImGui::Begin/End and e.g. position them with ImGui::SetNextWindowPos etc.). Avoid doing this when possible, since it has a performance hit when the overlay is closed and doesn't work in VR.

The "ImGui::Image" function accepts a "reshade::api::resource_view" handle of a SRV to a resource. So if you want to display a cubemap or depth-stencil, create a SRV to the face of the cubemap you want to show (or if you have a ID3D11ShaderResourceView already, just use that). Do not pass in a "reshade::api::resource" or a RTV, that will crash.

As for ImGui, you need this specific header: github.com/ocornut/imgui/blob/15b4a064f9...b615fb394321/imgui.h . It appears the documentation was pointing to the wrong one.
Last edit: 2 years 9 months ago by crosire.
The following user(s) said Thank You: doodlum

Please Log in or Create an account to join the conversation.

  • doodlum
  • Topic Author
More
2 years 9 months ago #3 by doodlum Replied by doodlum on topic Custom ImGUI rendering
I don't think you understood the question. I have all the UI sorted via that event method, but it would be interesting for me to view the render targets at a specific point in rendering. I guess my only real option then is to copy all of the views otherwise.

Please Log in or Create an account to join the conversation.

  • crosire
More
2 years 9 months ago - 2 years 9 months ago #4 by crosire Replied by crosire on topic Custom ImGUI rendering
Ah, I see. ImGui is rendered at the end of the frame, so if you e.g. want to display different stages of a render target from throughout the frame, you'll need to copy those to separate textures that can then be drawn at the end of the frame, yes. The generic depth add-on does this with depth buffers too for example: creates backup textures at github.com/crosire/reshade/blob/029308b9...neric_depth.cpp#L230 and then copies into those at github.com/crosire/reshade/blob/029308b9...neric_depth.cpp#L337 .
Last edit: 2 years 9 months ago by crosire.
The following user(s) said Thank You: doodlum

Please Log in or Create an account to join the conversation.

  • doodlum
  • Topic Author
More
2 years 6 months ago #5 by doodlum Replied by doodlum on topic Custom ImGUI rendering
With the overlay I found that the cursor is not visible. I'm unsure how to enable it?

Please Log in or Create an account to join the conversation.

  • crosire
More
2 years 6 months ago #6 by crosire Replied by crosire on topic Custom ImGUI rendering
You can simply do this every frame it should be visible:
ImGui::GetIO().MouseDrawCursor = true;

Please Log in or Create an account to join the conversation.

  • doodlum
  • Topic Author
More
2 years 6 months ago #7 by doodlum Replied by doodlum on topic Custom ImGUI rendering
This worked, thanks!

I'm a bit unsure about the overlay/ImGui. Would it be better that I do my own implementation of ImGui do you think? Or can ReShade provide the same functionality? I'd like to work with docking windows as well so that the positions of the different windows can be customised.

Please Log in or Create an account to join the conversation.

  • crosire
More
2 years 6 months ago #8 by crosire Replied by crosire on topic Custom ImGUI rendering
ReShade gives you access to all of ImGui (including docking) and you don't have to worry about the implementation details on how it needs to be rendered + there is consistent styling. For fully custom UIs can use the "reshade_overlay" event. IMHO that's big advantages over rolling it your own, but in the end it's not my decision to make.

Please Log in or Create an account to join the conversation.