SVG files

I have been using Defold for a while and my graphics in Photoshop look great but when I import them I keep getting scaling issues. I would like to know if Defold accepts SVG files so that I can scale however I want.

1 Like

What kind of scaling issues are you seeing?

SVG are not supported.

2 Likes

Just in general I am wondering what the best practices are for size of game in game.project. Right now I have it set to 640/1440 with High DPI on. I have no idea what I should set those to. Also, if a phone with a different resolution than that logs on, how will it scale or will it change the size of the game world?

We will create a new manual to better try to cover these questions. In general you can say that it depends a bit on how what kind of game you are creating. Have you read these posts:



2 Likes

Hi. Any chance of supporting SVGs in the future?

4 Likes

I saw someone made an SVG importer for point data somewhere… there is probably a rasterizer out there which someone could make into a native extension for loading SVG image data into buffers for display.

2 Likes

Yes, via native extensions :slight_smile:

There was a new image loader extension announced recently, perhaps it also supported SVG (unlikely)?

4 Likes

@sergey.lerg maybe look at adapting this like you did with stb_image.h?

2 Likes

Nanosvg is not good enough, it produces bad results barely useable.

I think we need a lot more work done to support custom texture formats in the engine (i.e. rendering actual vector graphics).

If not, we’re talking about rasterising the texture. And unless you have tough gradients in the texture, a large texture will compress quite well. And, you can scale it down to the lower resolutions.

That said, yes, you can rasterise it in a native extension.

5 Likes

Supporting vector formats would be great especially for user interface assets.

5 Likes

I don’t see many better options.

A nanosvg version may still be useful to some as a starting point. Just having a functional vector rasterizer for Defold would be cool.

3 Likes