-
Notifications
You must be signed in to change notification settings - Fork 8
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
[Bug] ImGui Main Viewport Resolution and HiDPI Issue #24
Comments
The viewport size issue at least should be fixed as of 8025cba. Can you check and confirm? |
I suppose I would need to make a release for this.. unless you're willing it compile it locally. |
i will compile, dw. |
With The area where ImGui can draw is fixed but not the mouse viewport. Red = Drawing area Yellow + Gray = Mouse area, where I can see and move the cursor ImGui draws it's cursor in different place than the actual cursor. For example, on the image below there is a blocked zone in the top-right because my actual cursor hits top-right edge of the display, while imgui cursor stays more to the middle of the screen. And the reason why i can move more to the right if i go lower (grey area) - is because my actual cursor will go onto the 2nd display on the right, while imgui cursor is still being on the main display. And because actual cursor is already on the 2nd display - any mouse input defocuses the game so i cant interact with imgui. The difference between imgui cursor coordinates is
imgui cursor viewport before downscaling is
Basically, right now it behaves the same as with my dank fix earlier:
|
Yeah I honestly have no idea how to fix the mouse cursor issue. |
Describe The Bug
In some game configuration cases ImGui viewport resolution doesn't match the game resolution, causing ImGui to either be cut off in the middle of the screen or go outside of the game.
Little dive into my configuration before showcasing the issue:
I have a 1080p 60Hz 96DPI (x1 scale) main display with the game + 2 additional displays on each side (both 1366x768 60Hz x1 scale).
On my Nvidia card to get higher in-game resolution options available than the max display resolution I use DSR (Dynamic Super Resolution). Since the game has awful Anti-Aliasing options, downscaling from super resolution is a recommended way to achieve AA on powerful systems, so I am not discarding this edge case, as other power gamers may be using DSR as well.
Screenshot 1
Screenshot 2
To better visualize the actual viewport, I draw a giant half-transparent red rectangle with 5000x5000 size.
On the screenshots pay attention where actual Tea Overlay window is on the screen and where it is on small viewport visualization in the debugger.
Fullscreen
works because it actually changes the display resolution:Screenshot
Screenshot
Screenshot
Windowed Mode
:Screenshot
Screenshot
Screenshot
Borderless Window
:Screenshot
Screenshot
Screenshot
Video
I have been able to partially fix the viewport with this code:
But unfortunately it only affects where ImGui is allowed to draw windows and stuff. Mouse still behaves incorrectly as if the mouse viewport was scaled down and desynchronizes with the actual cursor.
Video
Playing around with
ImGui.GetIO().DisplaySize
andImGui.GetIO().DisplayFramebufferScale
gave no results.ImGui.GetDrawData().ScaleClipRects()
causes a crash.I don't if it is relevant, but in
Borderless Window
the game doesn't launch the game window at the target display resolution, but instead launches the window with the game resolution -> then ImGui gets initialized in 1080p -> then GPU driver scales down the whole window to fit into the target display. (In contrast to whenResolution
may refer to3D Rendering Resolution
, often present as% Scaling
in modern games).As a result, we end up with target resolution being smaller than the resolution used by the framebuffer. This sounds a lot like how Hi-DPI Retina screens work. where there is a pixel ratio of 2.0 between the size of the framebuffer and the size of the application window.
Reference 1
Reference 2
So I assume Hi-DPI display will have a similar issue as well.
As a side note, ImGui looks readable only in 1080p. On higher resolutions (in other words, on higher DPI displays) it will look tiny and on smaller resolutions it will look big. SPL probably should scale it's main ImGui window automatically or provide for end users a way to scale it manually. But going further, perhaps, SPL should automatically handle default scaling for plugins as well?
To Reproduce
Borderless Window
orWindowed Mode
with a resolution that is different from the display resolution.Expected Behavior
ImGui viewport should match the game resolution.
Priority
Suggested P2 Priority. The issue alters the indented functionality of SPL and plugins under some circumstances.
PC Specs
Show/Hide
Motherboard
: Asus ROG Strix Z390-H GamingCPU
: Intel Core i9-9900kRAM
: 32 GB 3200MHzGPU
: Nvidia GeForce RTX 3090 TiSystem and Game SSD
: Samsung SSD 970 EVO Plus NVMe M.2 1TBPlugin Repo SSD
: Western Digital Blue SATA M.2 2280 2TBEnvironment
Show/Hide
OS
: Window 10 Enterprise Version 22H2 (OS Build 19045.3996)Monster Hunter: World
: v15.21.00SharpPluginLoader
: pre-v0.0.4.0 (bea1094)Nvidia Drivers
: v551.52Game Display Settings
Show/Hide
DirectX 12 API
: OnScreen Mode
**: ~~~**Resolution Settings
**: ~~~**Aspect Ratio
: Wide (16:9)Nvidia DLSS
: OffFidelityFX CAS + Upscaling
: OffFrame Rate
: No LimitV-Sync
: OnGame Advanced Graphics Settings
Show/Hide
Image Quality
: HighTexture Quality
: High Resolution Texture PackAmbient Occlusion
: HighVolume Rendering Quality
: HighestShadow Quality
: HighCapsule AO
: OnContact Shadows
: OnAnti-Aliasing
: OffLOD Bias
: HighMax LOD Level
: No LimitFoliage Sway
: OnSubsurface Scattering
: OnScreen Space Reflection
: OnAnisotropic Filtering
: HighestWater Reflection
: OnSnow Quality
: HighSH Diffuse Quality
: HighDynamic Range
: 64-bitMotion Blur
: OnDOF (Depth of Field)
: OnVignette Effects
: NormalZ-Prepass
: OnMods and External Tools:
Show/Hide
Additional Context
Plugin Repo
The text was updated successfully, but these errors were encountered: