• Editor
  • How to merge atlas

How do I merge two or more atlases? I found that some atlases have blank areas

  • Misaki đã trả lời bài viết này.

    suanLoBeach Are you saying that you are having trouble with the texture atlas page being split into multiple pages? You can open the texture packer settings and change the Max width/ height of the page or change the Scale to fit on a single page. If Rectangles is selected in the Packing section, it may be better to use Polygons to reduce the blank areas.

    I found that some atlases have blank areas

    Spine tries to pack with as little white space as possible, but if Power of two, Divisible by 4, or Square is enabled, it may result in a large blank areas.

    Or, if what you want is to combine multiple skeleton atlases into one, you can choose Single atlas in the pack section on the export settings window: https://esotericsoftware.com/spine-texture-packer#Packing-during-data-export

      Misaki Is this what you mean by Single atlas?.
      For example, if I want Spineboy and Raptor to share the same texture, do I need to package them as the same spine project?

      You can use a single atlas or two atlases, there is no requirement to pack them into a single atlas. No you don't need the skeletons in the same project. Texture packing can be done separately from data export. See:
      http://esotericsoftware.com/spine-texture-packer

        Nate I may not have expressed it clearly. For example, the textures of Spineboy and Raptor both have blank parts, which causes waste. If these two characters share texture, it will not be wasted.

        How much space is wasted depends greatly on the particular images and the many texture packing settings. If packing multiple skeletons together is more efficient use of space, doing it can save some memory at runtime. It also can reduce draw calls at runtime.

        If your images are in different folders, I suggest writing a script to copy them to a common folder where they can be packed. See the combineSubdirectories setting so subfolders won't cause the images to be packed on different pages.

          6 ngày sau

          Nate Hi, I exported spineBoy, and then merged the texture and atlas of spineBoy and raptor, but when I replaced the atlas and tex of spineBoy with the merged atlas and tex, an error occurred. Why is this?



          I want spineBoy and raptor to share the same atlas and texture
          When I merge two textures, how can I make them share the same pattern instead of having two heads and two mouths in one picture?

          I would need to see your atlas to be sure, but I assume it contains region names like:

          spineboy/crosshair
          spineboy/head
          raptor/head

          In the Spine projects, the attachments are named eg crosshair so that is the name it looks for in the atlas. It's not there because it's spineboy/crosshair.

          You can use combineSubdirectories to pack folders together and flattenPaths to remove the folder names. However, you need to take care if two folders contain an image with the same name, like head. When using flattenPaths usually you want all the image names to be unique.

          Alternatively, you can modify the Spine projects so they use attachment names like spineboy/head and raptor/head. You'd set all the projects to point at the same images folder, which also makes it easy for projects to share the same images. Then the atlas you've made will work. You can use the Find and Replace dialog to make adding these prefixes in the Spine editor easier.

          Alternatively, you can create your own AttachmentLoader at runtime that knows which skeleton it is loading. When loading the spineboy skeleton, it would look in the atlas with a spineboy/ prefix to the region name. When loading the raptor, it would use a raptor/ prefix. Then the atlas you've made will work.

          How attachment images are found in the atlas is very simple. It's similar to how it's done in the editor, see here:
          http://esotericsoftware.com/spine-images#Image-file-lookup
          At runtime, see here:
          http://esotericsoftware.com/spine-loading-skeleton-data
          AtlasAttachmentLoader is used by default and it looks in the atlas for the attachment name (or path). You can customize that, as mentioned above, by using your own AttachmentLoader. Otherwise, you need to make sure the paths in the atlas (look at it with a text editor) are the same as you see in the Spine editor relative to the images folder.

          If two images are 100% identical, they will only be packed in the atlas once if alias is enabled. That is one way to avoid having two of the same head images. If they differ at all, even a single pixel, they will be packed separately.

            Nate I first packaged spineBoy and raptor respectively and obtained their atlas and texture. Then I put their atlas and texture in the same folder, and then used "combineSubdirectories" to package them into new atlas and texture. What are the steps for this? Right?

            That won't work at all. Open your atlas with a text editor and look at the regions in it. You'll have 2 regions: one for spineboy and one for raptor.

            You can't pack two already packed atlases. You need to pack all the images into a single atlas. If you keep the images in different folders, you can copy the files into a temporary folder and pack them from there. You can write a script that does this to make it easier.

              Nate OK, I'll try. Thanks