0 votes

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

in Engine by (41 points)

1 Answer

+2 votes
Best answer

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.

by (3,491 points)
selected by

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

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?

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

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?

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.