SVG support ? where are we

urieluriel Posts: 59Member

Hi guys, i am wondering when will we be able to use a scalable .svg in Godot ?
as i want to use svg for Ui design to get a perfect resolution at any window size, i wanted to know from you guys if someone knows when this will be available or if there is an other solution at this time.
thx

uriel


Tags :

Comments

  • urieluriel Posts: 59Member

    i take the oportunity to up this topic...
    i am sure people use SVG graphics in their games !, no ?
    please, repport any experience with it and any informations regarding the use of SVG capabilities in godot :)
    thank you

    uriel

  • MegalomaniakMegalomaniak Posts: 1,671Admin

    I've none, but one though that occurs is perhaps to create a importer for svg's and process the data into polygon 2d's? Likely going to enable only partial support for the SVG data perhaps though. I'm not too familiar with the SVG data-structure though, so take it with a grain of salt, but it's a thought.

  • urieluriel Posts: 59Member

    i am very suprised that svg is not supported from the beginning, as it is so used for mobile devices UI and html5.
    i really consider looking at this option in my future projects, looking forward how can i help in this direction...
    thx @Megalomaniak

  • atriatri Posts: 10Member
    edited October 13

    if you talk about real time scale vector graphic
    to use svg or any other vector format, render engine need special render for that vector-scalable format
    its very complex to make it low-cost in real time
    middle-tier GPU can do few (1-2 I think) vector image on screen at same time

    if you talk about static prerendering for svg images, then you can connect any simple svg render using GDNative, or just convert all svg images to *.png outside of godot

    P.S. you can do cheap-trick, to have it scalable and low cost in real time image (still little complex)
    render source svg to many images with different size(from 512x512 for far distance), biggest like 10k(cut it on 2k textures-tiles)
    and use them same like LOD, loading needed texture base on camera position to this mesh with texture

  • atriatri Posts: 10Member

    @Megalomaniak said:
    create a importer for svg's and process the data into polygon

    Blender can render SVG to polygons (layer by layer with color-material for each).
    Still static solution

  • urieluriel Posts: 59Member

    i found this in the vulkan dist
    https://github.com/godotengine/godot/tree/master/thirdparty/nanosvg
    is that the parser for advanced svg manipulation ?
    https://github.com/memononen/nanosvg

  • atriatri Posts: 10Member

    you can write svg parser on pure GLSL
    https://www.shadertoy.com/view/4lySWd
    https://www.shadertoy.com/view/ldXyRn

    question is how fast is it
    as I know svg real-time-render is very slow and very limited(make huge impact to overall performance in project), does not matter is it Vulkan or software render

  • Richard KainRichard Kain Posts: 36Member

    SVG rendering is essentially little different from the rasterization of 3D graphics. You take mathematically calculated and stored data, and render it to pixels. The primary difference being the inclusion of mathematically calculated curves where most 3D interpreters are based on vertex and polygon data.

    The reason why no one in game engines seems to support SVGs is that is because they are often more costly to render than 3D graphics, largely thanks to the previously mentioned smooth curves. Calculating curves frequently involves more computational overhead than just connecting existing vertex data. It's much less costly to render a vector image once, and then use that rendering until a different version is required.

    You could compare it to real-time lighting and baked lighting. Real-time lighting can look better, and be more responsive. But baked lighting is WAY better for a game's performance. Constantly rendering SVGs would be terrible for a game's performance, while rendering an SVG to a series of different-resolution PNGs is much less costly. (and can provide similar functionality) Most people go for the latter approach.

    I love vectors and SVGs. I use them all the time for graphic design. But if I wanted to use a vector approach in a game engine, I would probably limit myself to 3D graphics that I render to a texture.

Sign In or Register to comment.