Search Unity

  1. We're looking for feedback on Unity Starter Kits! Let us know what you’d like.
    Dismiss Notice
  2. Unity 2017.2 beta is now available for download.
    Dismiss Notice
  3. Unity 2017.1 is now released.
    Dismiss Notice
  4. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  5. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice
  6. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice

SVG Importer | Vector Graphics | Unity UI Supported [RELEASED]

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

  1. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    448
    Yes, I do adapt and I will take a look at this, thanks!
    Is there any more information about this from console?
     
  2. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    448
    Yes there is,

    in SmallXMLParser.cs
    comment the section from line 105 to line 123
    it should look like this

    #if !UNITY_WSA
    switch (Char.GetUnicodeCategory(c))
    {
    case UnicodeCategory.LowercaseLetter:
    case UnicodeCategory.UppercaseLetter:
    case UnicodeCategory.OtherLetter:
    case UnicodeCategory.TitlecaseLetter:
    case UnicodeCategory.LetterNumber:
    return true;
    case UnicodeCategory.SpacingCombiningMark:
    case UnicodeCategory.EnclosingMark:
    case UnicodeCategory.NonSpacingMark:
    case UnicodeCategory.ModifierLetter:
    case UnicodeCategory.DecimalDigitNumber:
    return !start;
    default:
    return false;
    }
    #endif
     
    moonmenlabs likes this.
  3. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    448
    So I have today found out a solution to anti-aliasing errors so I would push a new Update until Unity Approves it :)
     
    ShawnFlanagan likes this.
  4. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    448
    Hello,

    Are you sure that it is just scene size or the whole build size?
     
  5. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    448
    Hello,

    I am not really sure what this is causing but with new Unity, the geometry antialiasing started doing weird things which is related to the latest version of SVG Importer. do you have enabled antialiasing on your asset?
    If so, I am just working today to publish a hotfix on the asset store.

    If you are having other problems, it could be related to mesh compression as it looks
    not precise enough. Then we would have to investigate that further.

    Thank you for your kind words!
     
  6. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    448
    Hello, I am looking at the stack trace but I am unable to find the problem, the line which the error is pointing at is rubbish.
     
  7. onceabird

    onceabird

    Joined:
    Feb 24, 2017
    Posts:
    1
    I'm using SVG Importer and the antialising problem seems to remain, with or without lighting enabled...
     
  8. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    448
    Hello,
    That is because Unity did not approve the update I just submitted :)
    Wait a little bit, thank you.
     
  9. Goodyearpimp

    Goodyearpimp

    Joined:
    Jun 5, 2014
    Posts:
    3
    I appreciate the re-surgence of support, this is a great tool!

    I have tried creating several mesh deformers from scratch as well as purchasing JellyMesh & JellySprite. None of these tools seem able to deform the SVG Renderer meshes.

    I absolutely want to use SVGs, but for my project it is a must that I can deform them (due to collisions, etc).

    Please please help me anyone :) Have hit a brick wall for months!!!!
     
  10. JaimeAL

    JaimeAL

    Joined:
    Dec 4, 2015
    Posts:
    20
    Just tried the new version and in some SVG Renderers I get the following console errors:

    NullReferenceException: Object reference not set to an instance of an object
    SVGImporter.SVGRenderer.get_sortingOrder () (at Assets/SVGimporter/Plugins/Core/SVGRenderer.cs:248)

    NullReferenceException: Object reference not set to an instance of an object
    SVGImporter.SVGRenderer.set_vectorGraphics (SVGImporter.SVGAsset value) (at Assets/SVGimporter/Plugins/Core/SVGRenderer.cs:92)

    They happen in lines of code where I try to set one of those values on enable, sometimes at the very beginning of a scene. Most SVG renderers work but the ones that do not break the rest of the game.

    EDIT: This is a small note, but there is a debug.log on the Awake and Destroy of the SVGRenderers, not a big deal as I can just comment it out, but figure I'd mention it
     
    Last edited: Jul 24, 2017
    Jaroslav-Stehlik likes this.
  11. moonmenlabs

    moonmenlabs

    Joined:
    Mar 27, 2017
    Posts:
    3
    Thanks a bunch
     
  12. mikolajewskip

    mikolajewskip

    Joined:
    Mar 29, 2017
    Posts:
    5
    Same here after update:

    This happens when I am trying to change sorting order of object programmaticaly. Any tips?

    Issue 2:

    When I import svg and apply antialiasing - it is ok.
    But if i mirror it by rotation (rotate X -1.0f) then antialiasing is lost
     
    Last edited: Jul 26, 2017
    Jaroslav-Stehlik likes this.
  13. Jonycafre

    Jonycafre

    Joined:
    Oct 13, 2014
    Posts:
    16
    Purchased SVG Importer yesterday, after reading good critics about this asset.
    Despite some warning messages related to obsolete method calls, it's a nice work overall. But, does SVG Image (UGUI) have Antialising? In the scene window it shows ok, but in game window pixels look like LEGO bricks :(

    BTW: I'm using Unity 2017.1.0f3
     
    Last edited: Jul 26, 2017
  14. D-Chiodini

    D-Chiodini

    Joined:
    Apr 11, 2015
    Posts:
    5
    Hi!
    I am trying to get separated mesh from one SVG file.
    I.e. if I have a group <g id = 'myGroup'> I would like to be able to assign a different material to that group.
    First thing first, how can I access the SVGElements?

    Thanks!
     
  15. royvaneijndhoven

    royvaneijndhoven

    Joined:
    Jun 1, 2017
    Posts:
    8
    Check this out: https://issuetracker.unity3d.com/is...in-game-view-with-screen-space-overlay-canvas

    Don't forget to vote for this bug to be fixed. Temporary solution; use ScreenSpace Camera for the Canvas.
     
  16. Jonycafre

    Jonycafre

    Joined:
    Oct 13, 2014
    Posts:
    16
  17. RomkaKing

    RomkaKing

    Joined:
    Nov 20, 2015
    Posts:
    2
  18. WayneC

    WayneC

    Joined:
    Jan 15, 2016
    Posts:
    5
    @Jaroslav-Stehlik Hi , will you contiune to support SVG Importer through unity 2017.x lifecycle? It's important to us. thanks!
     
    Jaroslav-Stehlik likes this.
  19. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    448
    For sure I will!
     
    ShawnFlanagan likes this.
  20. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    448
    Hello,
    This kind of rendering is much more efficient to do with the Unity Line Renderer and dashed texture / material.
    If this would be done in SVG Importer, it would need to create geometry every Update which would be highly insufficient.
     
  21. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    448
    Hello,
    What kind of deformation do you need?
    Could you give me an specific use case?
    Thank you.
     
  22. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    448
    Thanks! U just figured out how to sovle the negative scale :)
     
  23. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    448
    DO you have now some 2017 specific errors?
     
  24. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    448
    Hi Everyone!
    U just made a Tutorial Video on how Antialiasing in SVG Importer works!
     
    ShawnFlanagan and Inspeinre like this.
  25. JaimeAL

    JaimeAL

    Joined:
    Dec 4, 2015
    Posts:
    20
    EDIT: I just noticed the Antialising Width setting is not working, not changing the blur at all, disabling and enabling antialising seems to not do a thing too?


    Just got the new update! This still happens:

    NullReferenceException: Object reference not set to an instance of an object
    SVGImporter.SVGRenderer.get_sortingOrder () (at Assets/SVGimporter/Plugins/Core/SVGRenderer.cs:248)

    NullReferenceException: Object reference not set to an instance of an object
    SVGImporter.SVGRenderer.set_vectorGraphics (SVGImporter.SVGAsset value) (at Assets/SVGimporter/Plugins/Core/SVGRenderer.cs:92)

    But I figured out how to fix them, even though is going back a bit to the previous version

    In SVGRenderer.cs, this is what breaks:
    Code (CSharp):
    1.         protected MeshRenderer _meshRenderer;
    2.         public MeshRenderer meshRenderer
    3.         {
    4.             get
    5.             {
    6.                 if (_meshRenderer == null)
    7.                 {
    8.                     _meshRenderer = GetComponent<MeshRenderer>();
    9.                 }
    10.                 return _meshRenderer;
    11.             }
    12.         }
    13.  

    From a previous version, using the following code fixes those two errors:
    Code (CSharp):
    1.         protected MeshRenderer _meshRenderer;
    2.         public MeshRenderer meshRenderer
    3.         {
    4.             get
    5.             {
    6.                 if (_meshRenderer == null)
    7.                 {
    8.                     _meshRenderer = GetComponent<MeshRenderer>();
    9.                     if (_meshRenderer == null)
    10.                     {
    11.                         _meshRenderer = gameObject.AddComponent<MeshRenderer>();
    12.                     }
    13.                 }
    14.                 return _meshRenderer;
    15.             }
    16.         }
    17.  


    However doing so gives yet another error that is solved the same way, error pops up on:

    Code (CSharp):
    1.         protected MeshFilter _meshFilter;
    2.         public MeshFilter meshFilter {
    3.             get
    4.             {
    5.                 if (_meshFilter == null) GetComponent<MeshRenderer>();
    6.                 return _meshFilter;
    7.             }
    8.         }
    9.  

    Changing it to this fixed it
    Code (CSharp):
    1.         protected MeshFilter _meshFilter;
    2.         public MeshFilter meshFilter
    3.         {
    4.             get
    5.             {
    6.                 if (_meshFilter == null)
    7.                 {
    8.                     _meshFilter = GetComponent<MeshFilter>();
    9.                     if (_meshFilter == null)
    10.                     {
    11.                         _meshFilter = gameObject.AddComponent<MeshFilter>();
    12.                     }
    13.                 }
    14.                 return _meshFilter;
    15.             }
    16.         }

    Will keep using the newest version with these couple of changes and see if it breaks anywhere else, but it should not since the previous version I was using had them declared this way, my guess is that I am trying to access components too fast on start before Unity has been able to initializate them.

    Figured I'd mention about it! Hyped to see negative antialising fix!
     
    Last edited: Aug 4, 2017
    Jaroslav-Stehlik likes this.
  26. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    448
    Correct! thanks for that!
     
  27. mikolajewskip

    mikolajewskip

    Joined:
    Mar 29, 2017
    Posts:
    5
    Glad to help ;) was there another method?

    anyway - the problem was that when I did have svg imported with scale 1.0f (any positive) all was ok, when x=-1.0f reflection was done but antialiasing was lost

    regards
     
    Jaroslav-Stehlik likes this.
  28. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    448
    The version which was today released handles negative scales
     
  29. mikolajewskip

    mikolajewskip

    Joined:
    Mar 29, 2017
    Posts:
    5
    Thank you!
     
  30. mgreene1

    mgreene1

    Joined:
    Feb 29, 2016
    Posts:
    2
    I am developing on Unity 5.6 and I have hit a wall using the importer. Everytime I export or 'save as' from AI (using the settings in the documentation) the SVGs produced in Unity lose their curves and instead are replaced by straight lines that connect at the anchor points to complete line. In short, all the smooth edges of strokes are removed for some reason. At first, I kept getting black artifacts and a "Transforms are Expanded" error from AI when I tried to Save a Copy. I've been able to get around it by using the 'Export As' command instead, even though it contains less SVG options. But I can't seem to find any resource on why this is happening. Is there some suggestion on what is going wrong?

    Edit: I tinkered around with the 'Quality' setting in the SVG window in unity and it seems to help somewhat, if I turn it up to a crazy number like 30,000. I think what is most concerning me (now that I am better examining what is happening) is that say I am working on my character's head, as I zoom out or increase the size of the camera the details on my character's face don't stay sharp. They start to condense into a black blob, as if the stroke width doesn't scale proportionately. I was under the impression that SVGs keep their clarity no matter how close or far they are zoomed in/out on? Why are my SVGs so sloppy looking?
     
    Last edited: Aug 7, 2017
  31. ADoby

    ADoby

    Joined:
    Dec 10, 2012
    Posts:
    18
    Antialiasing is totally broken.

    UI SVG Image Antialiasing is based on Screenposition. Moving a svgImage closer to the screen center will narrow the antialiasing width.
    Moving it closer to screen edge will strengthen the antialiasing.
     
  32. mgreene1

    mgreene1

    Joined:
    Feb 29, 2016
    Posts:
    2
    I haven't really seen anything vary due to where the screen was positioned. It seems to happen when I either zoom out in the editor or I make the camera bigger (so the SVG seems smaller), in both cases the strokes making up detail begin to become fuzzy black blobs instead of staying sharp.

    Edit: Ok I see what is happening now. I'm not sure if this is what you were talking about, @ADoby, but it seems that the 'anti aliasing' setting for SVG importer in the asset s inspector is to blame. Once I turned it off and used the Unity quality settings my SVGs become sharp again. I'm glad @ADoby mentioned antialiasing either way.
     
    Last edited: Aug 10, 2017 at 7:19 PM
  33. ADoby

    ADoby

    Joined:
    Dec 10, 2012
    Posts:
    18
    @mgreene1 @Jaroslav-Stehlik Here a small scene.
    I added 1 SVG image (a circle) with the same scale 5 times, in the center and on the edge of the screen.
    I also added 1 copy stretching it over the screen.
    You can easily see the changing antialiasting width based on screen position of the vertex.
    This is using Version 1.1.6.

    EDIT:
    I Debugged a little bit and I found out which part of the shader does this:
    Removing: * length(ObjSpaceViewDir(vertex))
    from SVGImporterCG antialiasing fixes the screen based antialiasing.
    YOU have to use bigger numbers for antialiasing width thought like 5000 instead of 5.

    EDIT 2:
    Multiplying the Antialiasing with " _ScreenParams.x" makes it work a bit better with different resolutions and you don't have to use 5000 as width which fixes Editor rendering.
    But this doesn't work with portrait resolutions and editor/game looks different.

    [​IMG]
     
    Last edited: Aug 11, 2017 at 12:05 PM
  34. Jindrich-Regal

    Jindrich-Regal

    Joined:
    Nov 22, 2013
    Posts:
    4
    Thx for your post, I also had this issue, SVG importet 1.1.6, Unity 2017.1.0f3

    @Jaroslav-Stehlik
    You have wrong version in about window. It shows 1.1.3, not 1.1.6.