Vector image

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Vincent William Rodr

Hi, importing .svg file to Godot results in the conversion of it to .png, making the same blurry resolutions as the png version of the file. Can it not convert to .png? Many said that implementing .svg file in Godot could cause performance slowdown, but the assets are only 100x87, so that wouldn’t slow down that much. Thanks

:bust_in_silhouette: Reply From: p7f

As far as i know, godot does not convert to png… it just import it and rasterizes. If you want to import it with higher resolution, you should go to the import tab, scroll down to SVG option, and set the scale.

All images are rasterized on import, because parsing an image format, regardless what format it is, on runtime is a waste of resources.

will there be, in the future, an update/plan so that the vector image is not rasterized?

Vincent William Rodr | 2020-09-08 00:41

I dont think it will, but i honestly cannot know for sure.
Godot needs to pass textures to its shaders to show the image on an sprite for example. And for passing an svg as a texture in opengl, you need to rasterize it (you cant just pass an svg, png, or any format to a shader… you need the raw data).
Perhaps it could be done a parser that generate a vertex array object and using that
To render the svg… but it would require a lot of work, for a rare use case.

By the way… what are you trying to achieve with this?

p7f | 2020-09-08 01:51

I’m doing this in order to improve the resolutions of the assets, since the screen resolution glitches the assets, as i have said previously, this probably won’t slow the performance that much

Vincent William Rodr | 2020-09-08 08:36

parsing and rendering svg in real time on the gpu would indeed impact performance a considerable ammount… is not just the way opengl or shadeers are supposed to be used.

You shouldnt have resolution problems, as engines dont usually support real time svg rendering (i dont know any at least) but always do an import and rasterization instead. You should not see any glitches if you import properly the image. If you need high res, just import it with a higher scale value in the svg option, enable filter and mipmaps (mipmaps are important when scaling down) and that should be enough.

This thread can give you more insight (read the comments)

Would you share a minimal project to see your problem so i can help further?

p7f | 2020-09-08 15:43