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

Rendering performance optimization for glass pane models

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.20.4
    • Confirmed
    • Performance
    • Normal
    • Gameplay

      The bug

      Glass panes and their stained variants are fairly commonly and extensively used blocks, but can contribute to frame drops in many occasions due to using a rather primitive multipart system to display connections. For example, a "straight" window-type pane with no branching will utilize three texture planes for the full face, when it really only requires one.

      It is possible to optimize the models such that for side faces, the minimum number of faces is used to render the desired result, which results in a client performance bonus. This requires completely ripping out the old multipart system, model files and templates that pane blocks currently use, and replacing it with a new one. This system is more complex (nine models are required per pane type instead of five, and the blockstates file for each pane is twice as long), but performance is verifiably improved as a result. The appearances of panes should be unaffected aside from fixing some vanilla mapping issues.

      I haven't optimized the top and bottom faces since ideally these should be culled by other pane blocks above and below them with respect to the shape of said panes, however this does not happen for some reason (MC-264676). See also MC-50349.

      How to reproduce

      1. Create a creative superflat world with the following preset:
        minecraft:barrier;minecraft:the_void
      2. Set the render distance to 12
      3. Run the command
        /tp @s 0 -20 0 0 0
      4. Set up walls of panes by running the following six commands:
        /fill -60 -63 30 60 63 30 glass_pane

        ,

        /fill -60 -63 32 60 63 32 glass_pane

        ,

        /fill -60 -63 34 60 63 34 glass_pane

        ,

        /fill -60 -63 36 60 63 36 glass_pane

        ,

        /fill -60 -63 38 60 63 38 glass_pane

        ,

        /fill -60 -63 40 60 63 40 glass_pane
      5. Open the performance graph using F3+2
      6. Observe with the default resources versus the attached fix pack

      Expected results

      Good framerates with vanilla resources.

      Actual results

      The resource pack gives better performance.

      How to fix

      Remove all of the glass-pane related model files from the vanilla models/block directory and replace them with those in the resource pack, and replace the blockstates files in vanilla with those in the resource pack. I give full permission or whatever to Mojang to use these. Billions of computers will thank you.

        1. optimized-panes-1.20.4-v1.0.zip
          62 kB
        2. 2023-12-13_17.37.47.png
          2023-12-13_17.37.47.png
          529 kB
        3. 2023-12-13_17.38.23.png
          2023-12-13_17.38.23.png
          542 kB
        4. 2023-12-13_12.17.19.png
          2023-12-13_12.17.19.png
          1.84 MB
        5. 2023-12-13_12.17.40.png
          2023-12-13_12.17.40.png
          1.89 MB

            Unassigned Unassigned
            Awesoman3000 Connor Steppie
            Votes:
            11 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              CHK: