Crendgrim / AutoHUD

A Minecraft mod for the Fabric launcher which dynamically hides parts of the user interface
GNU Lesser General Public License v3.0
18 stars 12 forks source link

HUD is still rendered although hidden. #97

Closed Finsider closed 6 months ago

Finsider commented 6 months ago

This is more of a performance concern from me

When we toggled off 'fade' from autoHUD The difference in FPS is the same. 2024-03-13_10 11 57 2024-03-13_10 12 07

But when we toggled on 'fade' 2024-03-13_10 11 48 2024-03-13_10 12 20

Expected Behavior: Increased FPS while the HUD is hidden (no fade), and Not having a performance decrease when HUD is not hidden (yes fade)

If this isn't an issue then I'm sorry regarding these, but this is quite concerning to me

Crendgrim commented 6 months ago

For the no fade variant: I did not add a shortcut here to disable rendering because users may configure it to not fully hide. By manually setting how far components move, you could for example set it so the whole HUD moves down so you can just about see your hearts. If I fully skipped rendering, I would need to first do some bounds checking.

As for the fade, I need to render items into a temporary buffer to be able to add transparency. This is mostly necessary because some items like beds still have their own custom renderer rather than using a sprite, and that doesn't play nicely otherwise. I can probably add a shortcut here to skip this step if the current opacity is 100%.

Finsider commented 6 months ago

Thing is, I do not have 'move' enabled in the screenshot, I may have misunderstood something but the HUD does get hidden even when both 'move' and 'fade' disabled, without any animation whatsoever, and they're still being rendered (same FPS)

Is it possible to add a shortcut to disable rendering completely when the opacity are 0%? or in this case, when the hud is hidden without having to move outside the screen

Crendgrim commented 6 months ago

Ah, right, I never considered that case! Should be trivial to skip rendering if no animation is active.

Thing is, I do not have 'move' enabled in the screenshot, I may have misunderstood something but the HUD does get hidden even when both 'move' and 'fade' disabled, without any animation whatsoever, and they're still being rendered (same FPS)

Ah, right, I never considered that case! Should be trivial to skip rendering if no animation is active.

Is it possible to add a shortcut to disable rendering completely when the opacity are 0%? or in this case, when the hud is hidden without having to move outside the screen

Yep, will add that in the next version.

Crendgrim commented 6 months ago

While performance would have been on-par with vanilla in the no-animation mode, I have now implemented this in version 6.6. All item rendering is skipped if not necessary (except for the "move but no fade" case, that'll take some more clever logic).

Finsider commented 6 months ago

I can't thank you enough for this, I wouldn't expected it to come this early, and yes, the performance did increase when the HUD is hidden now. again, thank you.