-
Notifications
You must be signed in to change notification settings - Fork 9
Description
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.
To better visualize the actual viewport, I draw a giant half-transparent red rectangle with 5000x5000 size.
var backgroundDrawList = ImGui.GetBackgroundDrawList();
var position = new Vector2(0, 0);
var size = new Vector2(5000, 5000);
backgroundDrawList.AddRectFilled(position, position + size, 0xAA0000FF);
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:
- Fullscreen + 1280x720 Game Resolution -> OK;
- Fullscreen + 1920x1080 Game Resolution -> OK;
- Fullscreen + 2880x1620 Game Resolution -> OK;
Windowed Mode:
- Windowed Mode + 1280x720 Game Resolution -> OK;
- Windowed Mode + 1920x1080 Game Resolution -> 19 pixels are cut off from the bottom;
- Windowed Mode + 2880x1620 Game Resolution -> ???;
Borderless Window:
- Borderless Window + 1280x720 Game Resolution -> ImGui goes beyond the game;
- Borderless Window + 1920x1080 Game Resolution -> OK;
- Borderless Window + 2880x1620 Game Resolution -> ImGui is cut mid-screen;
I have been able to partially fix the viewport with this code:
ImGui.GetMainViewport().WorkSize = new Vector2(2880f, 1620f);
ImGui.GetMainViewport().Size = new Vector2(2880f, 1620f);
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.
Playing around with ImGui.GetIO().DisplaySize and ImGui.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 when Resolution may refer to 3D 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
- Launch the game in
Borderless WindoworWindowed Modewith 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 2TB
Environment
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.52
Game 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: On
Game 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: On
Mods and External Tools:
Show/Hide
- RTSS Overlay v7.3.4
- Reshade 6.0.0 with SMAA.fx
- Stracker's Loader v3.0.1
- Performance Booster and Plugin Extender v1.3
- HunterPie v2.10.0.134
- HelloWorld (an overlay that shows lots and lots of stuff) v10.4
- Bow Spread Pattern Fix v1.0
- Tic Rate Fix v1.0
- Guiding Lands Gathering Indicator v1.12.11.01
- Gems Sorted by Name (Alphabetized Gems) v1.6.1
- Reshade Hook v1.0
- Endemic Quality (Iceborne Edition) v1.4
- Remove censor bad word banned word filter v1.0
- Monster Weakness Icon Indicator for Iceborne (Hi-Res) vFinal
- Cuter Handler Face Model (Post-Iceborne) aka Make Handler Cuter Again v3.0










