• Editor
  • Import SVG files

Hello,

I have a question about importing. Since I work with vector files in both Affinity Designer and Unity, I would like to work with vector files (SVG) in Spine as well. However, I have the problem that Spine does not seem to recognize the SVG files. I would like to know if Spine recognizes vector files at all or if you have to work with raster files like PNG/JPEG. I am looking forward to your answers.

Many thanks in advance!

With kind regards,
Trilex

    Related Discussions
    ...

    Trilex Welcome to the Spine forum!

    Unfortunately, vector images cannot be used in Spine. The image formats that Spine can load are PNG and JPEG.

    If you have any other questions, please do not hesitate to ask them in this forum!

      Misaki Hello Misaki,

      Thanks for your quick reply. It's a pity that Spine doesn't support SVG files.

      With kind regards,
      Trilex

      The main reason is SVG is difficult to render in game engines. Most game engines are designed to render raster graphics efficiently (eg from PNGs).

      The images are separate from the Spine skeletal and animation data. One approach is to load an atlas with a resolution that is most similar to the user's display device resolution. That is a very easy way to provide higher quality graphics. It doesn't have all the advantages of SVG, notably the ability to scale/zoom large amounts without pixelation and the small file size. The next step could be to create the raster graphics from SVG. This provides the small file size, but doesn't prevent pixelation at high scale/zoom.

        Hello Nate

        In the Unity engine, I was able to use SVG files using a plugin. However, the engine automatically converted them to raster images. I now plan to re-export all sprites as PNG files. The screen resolution is 3840 x 2160 pixels, which should cover most screen resolutions. Shrinking raster graphics is not a problem, but enlarging them results in a blurry appearance.

        With kind regards
        Trilex

        Aye, rendering SVG is possible, though typically only a subset of SVG is allowed because supporting all of it is complex. It's easier to render SVG to a raster image than it is to render SVG dynamically each frame. It sounds like it wasn't Unity converting SVG to raster, that must be how the plugin works. Nothing stops you (or a plugin) from rendering SVG each frame, it's just difficult to do well.

        Nate Don't mipmaps partly address the zoom/scale issue assuming original export is large enough and target devices can handle the roughly 33% increase of memory requirements? Of course, infinite detail of vectors is not achievable, but realistically this might cover most usecases.

        Mipmaps help with downscaling, so you'd need to use high resolution source images but yes, the results can be good, especially with bicubic and anisotropic filtering. See how images look scaled down (or zoom out) in Spine with smoothing at 11 and anisotropic filtering checked, under Viewport in the settings dialog.