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

Flower pot models are very unoptimized and have flawed texture mapping

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.19.4, 23w18a
    • Confirmed
    • Performance, Textures and models
    • Normal
    • Gameplay

      For further optimizations, refer to MC-262433.

      [ticket pending rewrite - maybe later today?]

      The bug

      The model for flower pots (and by extension, the models for potted objects) are notably more convoluted than they need to be. This results in two seemingly unrelated, but fundamentally linked, issues:

      • Flower pots are considerably more taxing to render, and can cause render lag if many are present (see also MC-260296)
      • The texture mapping on flower pots is rather unintuitive, especially on the bottom

      Optimisation

      The current vanilla flower pot model, as of 23w18a and 1.19.4, uses five elements/cuboids: one uses the dirt texture on the top and the outside texture on the bottom, whereas the other four represent different edges of the pot. However, across those five elements, there are a total of 22 faces, which is less than optimal: many of these faces (specifically the outsides of the pot and the bottom) are coplanar with each other, appearing to be single faces when in fact they are composed of multiple. We can do better.

      The resource pack attached to this issue achieves the exact same visual result with five elements, with 14 faces rather than 22. This is a considerable reduction (both in render lag and file size), and you can feel it.

      How to reproduce

      1. Download the attached resource pack containing the optimized flower pot models
      2. Create a superflat world with the following preset:
        minecraft:barrier,20*minecraft:flower_pot;minecraft:the_void
      3. Set render distance to 2 and simulation distance to 5
      4. Open the FPS bars using Alt+F3
      5. /tp @s 0 -42 0 0 90
      6. Compare where the FPS graph evens out with the vanilla flower pot model vs. the optimized flower pot model - the optimized flower pot will give better FPS

      Texture mapping

      The other major issue with the flower pot model is how the textures are applied to the block. The flower pot block texture, since their introduction in 1.4.2, has only ever had textures for the top and side - the bottom was never normally visible until 1.13, so a texture plane on the bottom was largely disregarded. In 1.16, the bug arising from this (MC-120335, MC-170842) was fixed, however the actual texture file for the flower pot remained unchanged. As a result, the bottom "texture" is effectively a random mishmash of parts of the top and side texture from different elements of the model, and isn't consistent between different potted plants either as a result (MC-194192).

      This issue is a fairly easy fix - there's enough space within a 16x16 texture file to accommodate textures for individual top, side and bottom textures, although things will need to be shuffled around to fit. The attached resource pack contains a texture file for flower pots with defined top, side and bottom regions, and a Programmer Art version of this texture is also attached to this issue separately. The bottom texture has been made to visually match the current bottom "texture" perfectly in both cases.

      I've tested this model thoroughly using multiple texture resolutions and can confirm it is absolutely visually identical to the model currently used in vanilla - any visual differences are either only visible by clipping inside of the pot in Spectator mode or by other means, or are a result of precision issues such as MC-246224.

      Info for resource pack creators

      As this new texture format will break compatibility with any previously created custom textures for flower pots, here is a brief explanation of the new format and a rough guide to how to convert existing textures to this format.

      The new texture layout is composed of four 6x6 quadrants.

      • The top-left 6x6 region is for the top texture of the flower pot, so move the middle 6x6 region to the top left.
      • The bottom-left 6x6 region is for the side texture of the flower pot. Move the bottom-middle 6x6 region of the old texture to this quadrant. (The top row of pixels should be a duplicate of the bottom row of pixels for the top texture.)
      • The top-right 6x6 region is for the inside of the flower pot. By default, this visually duplicates the outside, so you can copy that region to here.
      • The bottom-right 6x6 region is for the bottom of the flower pot. Resource pack creators will probably want to create their own bottom texture, but if the previous appearance is desired it can be recreated by placing the top texture here, and filling in its central 4x4 gap with the bottom-middle 4x4 region of the side texture.

      How to fix

      I've done all of the hard work here to my knowledge - all that needs done is for the flower pot block texture to be replaced with the new texture from the resource pack, for all of the models (flower_pot.json, flower_pot_cross.json, potted_bamboo.json, potted_cactus.json, potted_mangrove_propagule.json, template_potted_azalea_bush.json, tinted_flower_pot_cross.json) to be replaced with the versions in the attached resource pack, and for Programmer Art's flower pot texture to also be replaced with the attached updated version of the texture.

      If permission of some sort is required to have these models and textures implemented into the vanilla game, consider it granted (if this is not possible, then we can discuss this in the comments of this ticket).

      Further notes

      There may be other optimizations that can be made to flower pots and potted objects - I will discuss these in future tickets as to not overload this one and risk making it confusing.

            Unassigned Unassigned
            Awesoman3000 Connor Steppie
            Votes:
            13 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              CHK: