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

nine_slice texture scaling will cause ridiculous levels of lag when used on small textures

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 24w33a
    • 1.20.4, 24w10a
    • None
    • Community Consensus
    • Performance, Resource Packs

      The bug

      If the nine_slice scaling option is used with a sufficiently small texture file, we will end up encountering absurd levels of lag by virtue of the fact that small groups of pixels (or even one pixel in the most extreme case) will be rendered up to thousands and thousands of times per frame.

      MC-268902 will make this issue harder to see as of the 1.20.5 snapshots, so I've included the demo of a particularly extreme case.

      How to reproduce

      1. Download and apply the attached resource pack
      2. Try your best to navigate the menus using the mouse
      3. Optionally, open the FPS screen to compare how the game runs in the game menu versus out of it

      Expected results

      Good framerates.

      Actual results

      We will be very lag.

      How to fix

      For this specific case (solid-color edges and center), an option could be added to the mcmeta files to determine whether the center slice and four edge slices should be scaled via tiling or via stretching. We'd default to tiling for backwards compatibility, but stretching would remain an option. With stretching selected as the nine-slice scaling sub-option, we'd only need to render a fixed number of subregions (nine) per element, rather than however many are needed for a complete tiling.

        1. 2024-03-06_23.26.57.png
          147 kB
          Connor Steppie
        2. 2024-03-06_23.27.39.png
          103 kB
          Connor Steppie

            timurn [Mojang] Timur Nazarov
            Awesoman3000 Connor Steppie
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: