Are there plans to support vector graphics in Godot?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Aris Kallergis
:warning: Old Version Published before Godot 3 was released.

This.

:bust_in_silhouette: Reply From: ericdl

There was a similar question about SVG support answered here. There’s currently an open issue on github regarding supporting vector graphics, with the possibility of Godot 3.0 introducing support for 2d meshes.

In the meantime, there is a plugin as pointed out by jospic that will import and convert SVG files to PNG.

thanks. support for 2d meshes means lossless scaling at runtime?

Aris Kallergis | 2016-10-22 11:42

To answer your question, I would say simply, no.

For pixel based images, you can achieve better scaling with exporting/importing graphics as textures with mipmapping, it’s an improvement, but certainly nothing loseless.

The meshes will be making use of textures and manipulating their UV mappings. So same technical restrictions.

You just won’t ever get raster graphics to do what vector graphics do, especially in the way of infinitely scaling something. One is a file of fixed in place pixel data, and the other is just geometric information combined with style information that allows it to be redrawn dynamically.

avencherus | 2016-10-22 17:14

If SVG gets converted to meshes, then… “yes”, you can zoom in and out without too much loss, but there is a catch behind the scenes. For example, take a circle. Flash would render it as a perfect circle because it uses formulas to fill an image (no wonder why Flash is slow). On graphic cards, a circle is rendered with a polygon that has enough sides to be seen as a circle. You can zoom in and out of the circle without seeing “blurryness”, however, you might be able to see the edges of the sides, depending on how much precision you have.

Converting SVG to meshes is basically the same as Flash would do when it renders vector graphics, however it will be done through approximation of all drawings by the use of polygons, that you can make more or less numerous for precision.

Textures are another matter. They will always have the same precision problems when you zoom, wether you draw them with Flash or Godot. If you vectorise them they will become lossless, but you still loose information in that process, they will look different.

There is a tradeoff to take. You can use SVG converted to meshes, but if that process produces too much geometry, then you are better off with a texture. However if your graphics are simple enough, they might be eligible for polygon-based vector graphics.

Zylann | 2016-10-22 23:17

Nice. Thank you for your time :slight_smile:

Aris Kallergis | 2016-10-23 04:47