SVG files


#1

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.


#2

What kind of scaling issues are you seeing?

SVG are not supported.


#3

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?


#4

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:




#5

Hi. Any chance of supporting SVGs in the future?


#6

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.


#7

Yes, via native extensions :slight_smile:

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


#8

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


#9

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


#10

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.


#11

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


#12

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.