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

Fence gate models are very unoptimized, causing lag among other issues

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.19.4, 1.20 Pre-release 6
    • Confirmed
    • Performance, Textures and models

      The bug

      The four template models used for fence gates specify more texture planes than are needed, causing the game to render far more triangles in areas which contain a large amount of fence gates, resulting in extra lag. To be specific:

      • template_fence_gate.json and template_fence_gate_wall.json specify 40 planes, but only need to specify 24
      • template_fence_gate_open.json and template_fence_gate_wall_open.json specify 40 planes, but only need to specify 36

      Unlike most other model optimization tickets (but like MC-262652), such an optimized model does not look outwardly perfectly identical to the current vanilla fence gate. This is due to vanilla's fence gates being affected by MC-262935 and MC-262936, which are undesirable texture mapping bugs. The optimized fence gate models do away with these issues entirely in favor of a more intuitively mapped gate model.

      How to reproduce

      1. Download the attached "complete fix" resource pack
      2. Create a superflat world with this preset:
        minecraft:bedrock,20*minecraft:oak_fence_gate;minecraft:the_void
      3. Set the render distance to 2 chunks
      4. Enter Spectator mode
      5. Run the command
        /tp @s 0 -40 0 0 90
      6. Use Alt+F3 to view the FPS bar
      7. Compare the performance with the vanilla resources versus the optimized fence gates

      The optimized fence gate resource pack should offer a considerable performance benefit over vanilla (and should therefore be what vanilla uses in the first place).

      How to fix

      This should be a very, very easy fix. Just take the four template models inside of the attached resource pack (template_fence_gate.json, template_fence_gate_open.json, template_fence_gate_wall.json, template_fence_gate_wall_open.json) and replace the vanilla model files with them, and fence gates should now have a markedly lower performance impact (and a slightly lower file size as well).

      These models also fix some other existing issues plaguing fence gates:

      • The textures used on parts of the constituent doors should now rotate in an intuitive manner when opened. (MC-92182, whose closing was probably a misunderstanding of the issue)
      • Two faces inside of fence gates that can never be seen without clipping inside of them have been deleted, and cullface has been added for the two top squares for non-wall fence gates. (MC-238734)
      • Both sides of the fence gate are now mapped in a way that preserves the block's texture - in vanilla, it's randomly and weirdly cut off in places for no good reason. (MC-262935)
      • Some stretched pixels on open fence gates have been fixed as part of the intuitive rotation mapping. (MC-262936)

      A second separate resource pack is attached which disables uvlock on fence gates, as its presence interferes with the rotation of textures between open/closed states.

      Further notes

      I haven't touched bamboo fence gates at all since they have a custom texture which requires specific mapping, rather than reusing the constituent planks. To make this fix work for bamboo fence gates would require fundamentally rearranging this texture file.

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

              Created:
              Updated:
              CHK: