Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

SVG Importer | Vector Graphics | Unity UI Supported [OPEN SOURCE]

Discussion in 'Assets and Asset Store' started by Jaroslav-Stehlik, May 4, 2015.

  1. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Also, I don't have any documentation about how the new API works and
    the version on bitbucket is obsolete.

    https://bitbucket.org/Unity-Technologies/ui/downloads

    I am sorry that I did not have the time to reverse engineer the new Unity.
    I have a week for that to do. Please wish me luck.
     
  2. ortin

    ortin

    Joined:
    Jan 13, 2013
    Posts:
    221
  3. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
  4. ortin

    ortin

    Joined:
    Jan 13, 2013
    Posts:
    221
    Jaroslav-Stehlik likes this.
  5. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
  6. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    @ortin Do you know how to use the new Rect Clipping?
    I cannot find any actual function which does the clipping on the mesh.
    Only helper functions to calculate the clipping.
     
  7. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Please send on my email your email with your invoice number so I can send you the hot-fix.
    Thank you!
     
  8. ortin

    ortin

    Joined:
    Jan 13, 2013
    Posts:
    221
    According to UI dev:
    So I assume it'd done by UI shader which can be downloaded from here:
    https://unity3d.com/get-unity/update - Additional downloads - Built in shaders
     
    Last edited: Sep 11, 2015
    Jaroslav-Stehlik likes this.
  9. ortin

    ortin

    Joined:
    Jan 13, 2013
    Posts:
    221
    Last edited: Sep 11, 2015
  10. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Thanks!

    Would take a look at it and implement it.
    I am glad that it was not so hard in the end.
     
  11. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Unity 5.2 HotFix - amazing performance increase!
    Curves Demo Scene - UI

    Draw Calls:
    before: 17
    after: 13

    Vertices:
    before: 33.9K
    after: 8.9K

    Triangles:
    before: 16.9K
    after: 8.5K

    Who wants to beta-test send me your invoice and email!

     
    DavidSmit and ortin like this.
  12. concave

    concave

    Joined:
    Aug 28, 2012
    Posts:
    49
    Are these issues (OnFillVBO deprecated, m_IncludeForMasking not used anymore) in SVGImage.cs fixed in the hotfix? cheers, concave
     
  13. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Yes they are fixed in the HotFix
    and also many new bugfixes and updates in favour of the new Unity UI.
     
  14. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    In the upcoming update there will be some awesome features:

    Mesh Compression and Keep SVG file.
    Mesh Compression works the same way like in FBX import
    but can dramatically reduce the file size as seen in the picture below.

    Keep SVG file
    is an option for including or excluding the original SVG Document
    in the build, which can also reduce the final build size.

    Final Vector Graphics in Mimpi is just twice as much as scripts.
    Which is by my opinion incredible :)



    Preview of the Inspector:
     
    ortin, pep_dj and DavidSmit like this.
  15. pep_dj

    pep_dj

    Joined:
    Nov 7, 2014
    Posts:
    179
    That's awesome! Less memory use and less build size! great!
     
    Jaroslav-Stehlik likes this.
  16. ortin

    ortin

    Joined:
    Jan 13, 2013
    Posts:
    221
    Any news on 9-slice fixes?
     
  17. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Hi, 9slicing is a little bit trickier than I expected.
    I hope it would be in the next update.
    Right now it works, when you don't have gradients.
     
  18. petersonh

    petersonh

    Joined:
    Dec 5, 2013
    Posts:
    1
    Jaroslav, are you doing a talk @ Unite Boston? Didn't see your name on the schedule at all.

    If I see you there, and you're interested, I'd love to show you my game I'm working on using SVG importer. It's been great to work with so far :)
     
    Jaroslav-Stehlik likes this.
  19. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Hi, I am not having any talk there,
    We are presenting our game with the company in which I am working.
    Also the game is done with SVG Importer :)
    I would love to see your game!
    +420 773 583 384 you can text me a message.
     
  20. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
  21. biscito

    biscito

    Joined:
    Apr 3, 2013
    Posts:
    138
    Last edited: Sep 21, 2015
  22. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Hi, it is possible only with postprocessing so basically it is too expensive to do it in real-time.
     
  23. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
  24. popcap_markbarrett

    popcap_markbarrett

    Joined:
    Sep 21, 2015
    Posts:
    3
    Hi,

    I had a few questions.

    1. The SVG renderer color and opacity features are not working for me at all. You can see here that I have selected the white face in the train to turn purple and display at 50% opacity but nothing has changed. SVG_ColorOpacityBug.png
    2. How does SVG Importer integrate with source control programs like Git and Perforce? Does the whole team need to have a copy of SVG importer or is one license enough?

    3. I am trying to make the case for switching to SVG vector characters for our mobile games. What memory benefits are there to using SVG over a sprite texture atlas? (I know this is broad, looking for any help on laying out the benefits for others)

    Thank you so much for the help!
     
  25. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Hi,

    1) Please update to the latest version, this version is probably 1.0.6 which had a bug with recoloring artwork.
    I am sorry about that.

    2) We use Git + SourceTree without any problem because everything is serialized as Unity Asset it works without any problems. I personally don't have a problem if you copy the license across your whole project. Of course, if you have a different team working on a different project you should buy an additional license at least for the other team.

    3) If your character is not overly complicated it could yield in a great performance upgrade.
    If you look at a simple use case, when you have a simple circle which takes 1000x1000 pixels
    in Sprite as a texture it would take

    1000 x 1000 x 8 x 4 = 320 000 000 bites = 4 megabytes uncompressed RGBA
    With SVG Importer, you need only 64 segments to get nice looking circle for the same
    resolution and that would only take:

    vertex count x (vertex position + colour + uv0 + uv1)
    64 x ((4 x 32) + (4 x 8) + (2 x 32) + (2 x 32)) = 64 x (128 + 32 + 64 + 64) = 2.3 kilobytes uncompressed

    So there are clear benefits even in memory footprint...
    And the vector graphics circle you can still scale without getting a blurry image.

    If any of my calculation is not 100% perfect I am sorry because it is almost midnight and I am at Unite Boston right now :) But this should be a pretty close example.
     
    Last edited: Sep 22, 2015
    popcap_markbarrett likes this.
  26. biscito

    biscito

    Joined:
    Apr 3, 2013
    Posts:
    138
    hey,
    low resolution blurred textures,i guess so,
    but concerning this asset is it possible ?

    i'll take it anyway i'm just wondering
     
  27. ikemen_blueD

    ikemen_blueD

    Joined:
    Jan 19, 2013
    Posts:
    341
    I got an email 50% sale offer on 23rd. Is it still on?
     
    Jaroslav-Stehlik likes this.
  28. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Sure today is 22 so tomorrow it will be on sale!
     
  29. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    you can use Unity default DOF post processing filter and if you put the images in different z depth
    you will have working depth of field effect.
     
    overthere and biscito like this.
  30. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    584
    Hi,

    Do you support or plan to support importing an svg at runtime? For example, using svgs for UI but letting players mod the UI by changing out the svg for another one. Thanks.
     
  31. popcap_markbarrett

    popcap_markbarrett

    Joined:
    Sep 21, 2015
    Posts:
    3

    perfectly answered all my questions, thank you.
     
  32. popcap_markbarrett

    popcap_markbarrett

    Joined:
    Sep 21, 2015
    Posts:
    3
    Sorry if i ask a lot of questions, i am an artist/designer and not as technical as I would like to be. I have made two identical rigged character prefabs, one is SVG, the other sprite. One thing i am able to do with sprites is to use the sprite packer and reduce the draw calls from 12 down to 2. The vector rig has 5 draw calls, any suggestions or recommendations on how to optimize the SVG assets to reduce this number?

    This is a wish more than a question, but do you have any plans to integrate SVG with animation programs like Spine?
     
  33. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Not right now, SVG Importer is focusing on these things.

    1) To get the best SVG Import for all different applications.
    2) To achieve the best performance possible.
    3) To be able to animate the vector graphics in a better way.
     
  34. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Great question,

    Spine integration would be actually quite hard to make
    without falling in to problems that the actual spine runtime is not perfect at all
    and dont take any blame for that. So I hope there would be tools directly in unity
    for better animation support.

    You can reduce draw calls with static batching
    and static batching also supports dynamic root,
    so if you have heavy graphics going on but care just about
    moving it around the screen, then you can do that programmatically.
    http://docs.unity3d.com/ScriptReference/StaticBatchingUtility.Combine.html

    But there could be some improvement about this in future.
    I would definitely take a look about that.
     
  35. ikemen_blueD

    ikemen_blueD

    Joined:
    Jan 19, 2013
    Posts:
    341
    hey, is the offer on yet? 23rd already, sorry, quite impatient :D
     
    Jaroslav-Stehlik likes this.
  36. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Wait just one hour more.
    https://www.assetstore.unity3d.com/en/

    Asset store does not respect timezone so...
    You can imagine :)
     
  37. ikemen_blueD

    ikemen_blueD

    Joined:
    Jan 19, 2013
    Posts:
    341
    LOL I thought it was like clicking the link to get a discount code or something. But, it turns out, like an usual Asset Store Discount 24 Sale :D Purchased it btw.
     
    Jaroslav-Stehlik likes this.
  38. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    BTW I will have to flight today from Boston to Czech Republic so bear with me :)
    I would not respond to any email during that time. Thanks for your understanding.
     
  39. Arganoid

    Arganoid

    Joined:
    Oct 12, 2013
    Posts:
    24
  40. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Hi!
    I would take a good look at it. It should take much less time :)
    For having mostly a great time exporting SVG files I recommend to use Adobe Illustrator or Affinity Designer.

    Thanks for the file!
     
  41. sloopidoopi

    sloopidoopi

    Joined:
    Jan 2, 2010
    Posts:
    244
    Hi,
    this asset looks really great!
    I saw the stroke rendering video. Can i change the points of the stroke at runtime? Could they created in a procedural way via code or do i have to import a SVG that i can tweak?
     
  42. seanbro

    seanbro

    Joined:
    Apr 25, 2013
    Posts:
    13
    Is slicing only available to UGUI format? Do you have plans to add slice functionality to Transparent/Opaque format also? I want to use sliced SVGs to build a 2D game, but I do not want to do everything in UGUI, as it is very slow.
     
  43. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Hi right now the slicing work only on UGUI and it is experimental, it has problems with gradients.
    but I am planning to put support on regular SVG renderer and fix the experimental phase.

    The new UGUI in unity 5.2 should be fast as the regular thing, maybe faster in some cases.
    But right now, they have some memory leak so there should be a patch release for that from Unity.
     
  44. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Hi,

    that stroke rendering was just for showing purposes and purelly for testing,
    the script is available in the package it is called SVG Stroke Renderer.

    But it is purely for some special use cases
    and SVG Importer is purely offline solution for obvious performance benefits.
     
  45. HugoCosta

    HugoCosta

    Joined:
    Jul 1, 2013
    Posts:
    15
    So you do not recommend using Inkscape?
     
  46. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Hi,
    There are people using it in combination with SVG Importer
    but I cannot say it will be 100% perfect, because
    Inkscape generates really bloated SVG files with a lot of unnecessary code
    which can sometimes break the import.

    I am still working on better support for Inkscape
     
  47. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    What about iDraw and Acorn? Both can export SVG.
     
  48. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    HI

    never tried them, I will give them a try.
    Good to know. Thanks!
     
  49. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080

    I have both apps. I can send you files to test. Or if you have test files I can import and then export them again for you to test.
     
  50. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Sure thing!

    If you find any error, send it to me.
    Thanks!