Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-233603

HUD / Hotbar rendering can heavily impact frame rate performance

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 24w33a
    • 1.17.1, 1.18.1, 22w06a, 1.18.2, 22w11a, 22w12a, 22w16b, 22w19a, 1.19 Pre-release 4, 1.19, 22w24a, 1.19.2, 1.19.3 Pre-release 2, 1.19.3, 23w04a, 23w05a, 23w06a, 1.19.4 Pre-release 1, 1.19.4, 23w16a, 23w18a, 1.20.1, 23w31a, 1.20.2, 23w44a, 1.21.1
    • Confirmed
    • Performance

      The game experiences a large frame rate decrease when there's a large amount of HUD/hotbar elements displayed on the screen, in this case hearts. I assume this is also the case with other elements like the hunger, armor, and oxygen icons, but only noticeable with hearts due to the use of certain effects (health boost & absorption) at high amplifiers, as well as with the use of the max_health attribute. Fairly small example:

      As can be seen in the images the performance hit is somewhat high just for a few more hearts added to the screen. Apparently each element (heart/hunger/defense icon) is counted as a draw call, and this number can increment in certain survival scenarios, making rendering of a simple status bar resource intensive. Even more intensive if items are rendered on the slots (MC-233604).

      I considered this a different issue from MC-10755 for two reasons:

      1. There aren't any uninteded effects at high amplifiers gameplay-wise, and can be reproduced with the max_health attribute, not only effects.
      2. This is a performance concern with something as simple as the HUD, which as i said before can be reproduced in a survival setting.

      While this issue might not be very noticeable in vanilla at first hand, some servers and datapacks make use of high health effects, making this issue very apparent. Here you can see the worst case scenario to demonstrate how it can impact frame rate times:

      You can only imagine how many draw calls are being made here to end up with these frame times in a void world. You can also check the attachments for more examples. Word from some modders say that this can be mitigated by applying batching when rendering the status bar.

      How to reproduce

      1. Create a void world, and run either one or both of the next commands.
      2. /effect give @s minecraft:absorption 100 255 true
      3. /attribute @s minecraft:generic.max_health base set 1000
      4. Press ALT+F3 and notice the lag on the FPS graph.

        1. 2021-08-01_21.05.00.png
          173 kB
          syarumi
        2. 2021-08-01_21.05.42.png
          151 kB
          syarumi
        3. 2022-03-23_15.02.47.png
          448 kB
          [Mod] ampolive
        4. 2022-03-23_15.02.54.png
          493 kB
          [Mod] ampolive
        5. 2022-03-23_15.03.04.png
          507 kB
          [Mod] ampolive
        6. 2022-05-13_19.11.58.png
          1.84 MB
          syarumi
        7. 2022-05-13_19.13.59.png
          1.82 MB
          syarumi
        8. 2022-05-13_19.18.17.png
          1.80 MB
          syarumi
        9. 2022-05-13_19.18.50.png
          1.80 MB
          syarumi
        10. 2024-08-17_12.26.14.png
          194 kB
          syarumi
        11. hearts_1.png
          217 kB
          syarumi
        12. hearts_2.png
          240 kB
          syarumi
        13. MC-233603_1.18.1.mp4
          8.08 MB
          Mohammad Sarabi

            Unassigned Unassigned
            Chavamix700 syarumi
            Votes:
            10 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: