Search Unity

  1. Check out our Unite Austin 2017 YouTube playlist to catch up on what you missed. More videos coming soon.
    Dismiss Notice
  2. Unity 2017.2 is now released.
    Dismiss Notice
  3. The Unity Gear Store is here to help you look great at your next meetup, user group or conference. With all new Unity apparel, stickers and more!
    Dismiss Notice
  4. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice
  6. Unity 2017.3 beta is now available for download.
    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:
    451
    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.
  2. Jaroslav-Stehlik

    Jaroslav-Stehlik

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

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    451
    Hello,

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

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    451
    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!
     
  5. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    451
    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.
     
  6. 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...
     
  7. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    451
    Hello,
    That is because Unity did not approve the update I just submitted :)
    Wait a little bit, thank you.
     
  8. 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!!!!
     
  9. 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.
  10. moonmenlabs

    moonmenlabs

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

    mikolajewskip

    Joined:
    Mar 29, 2017
    Posts:
    6
    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.
  12. Jonycafre

    Jonycafre

    Joined:
    Oct 13, 2014
    Posts:
    21
    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
  13. 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!
     
  14. royvaneijndhoven

    royvaneijndhoven

    Joined:
    Jun 1, 2017
    Posts:
    11
    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.
     
  15. Jonycafre

    Jonycafre

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

    RomkaKing

    Joined:
    Nov 20, 2015
    Posts:
    2
  17. 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.
  18. Jaroslav-Stehlik

    Jaroslav-Stehlik

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

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    451
    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.
     
  20. Jaroslav-Stehlik

    Jaroslav-Stehlik

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

    Jaroslav-Stehlik

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

    Jaroslav-Stehlik

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

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    451
    Hi Everyone!
    U just made a Tutorial Video on how Antialiasing in SVG Importer works!
     
  24. 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.
  25. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    451
    Correct! thanks for that!
     
  26. mikolajewskip

    mikolajewskip

    Joined:
    Mar 29, 2017
    Posts:
    6
    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.
  27. Jaroslav-Stehlik

    Jaroslav-Stehlik

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

    mikolajewskip

    Joined:
    Mar 29, 2017
    Posts:
    6
    Thank you!
     
    Jaroslav-Stehlik likes this.
  29. mgreene1

    mgreene1

    Joined:
    Feb 29, 2016
    Posts:
    4
    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
    Jaroslav-Stehlik likes this.
  30. ADoby

    ADoby

    Joined:
    Dec 10, 2012
    Posts:
    20
    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.
     
  31. mgreene1

    mgreene1

    Joined:
    Feb 29, 2016
    Posts:
    4
    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
    Jaroslav-Stehlik likes this.
  32. ADoby

    ADoby

    Joined:
    Dec 10, 2012
    Posts:
    20
    @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
  33. 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.
     
  34. royvaneijndhoven

    royvaneijndhoven

    Joined:
    Jun 1, 2017
    Posts:
    11
    @Jaroslav-Stehlik
    After updating to version 1.1.6 we got a NullReferenceException and we traced it back to the SVGRenderer class. See the image below, left is the current code, right is the alteration we did to fix the problem.

    Notice that the left has implemented a nice null check but then does not caches the GetComponent call into the actual _meshRenderer. Which results in the _meshRenderer variable staying null. Also, the MeshFilter getter does a GetComponent call to get the MeshRenderer, should obviously be MeshFilter.

    SmallOversightInUpdate.png
     
    Last edited: Aug 16, 2017
    Jaroslav-Stehlik likes this.
  35. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    451
    Hello,

    I have to create an explanation video about how SVG Importer handles units.
    The quality of your vector art depends on the units inside the document.
    That is probably the reason why you had to increase the quality so much.
     
  36. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    451
    Hello,

    Thank you for your report.
    Could you please send me a quick screen capture so I can investigate that
    further?
    Thank you for your help!
     
  37. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    451
    Hello,

    I had issues that in editor it looks different than in the actual game.
    That is correct, the latest midification was done because when negative scaling
    or rotating the image 180 in Y completelly turned off the antialiasing.
    I gues I have to find another work around.
    Thanks for your report, you rock!
     
  38. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    451
    Thanks,

    thats really stupid bug!
     
  39. ADoby

    ADoby

    Joined:
    Dec 10, 2012
    Posts:
    20
    You did already reply to the answer which contains the screenshot.


    @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]
    Hello,

    I had issues that in editor it looks different than in the actual game.
    That is correct, the latest midification was done because when negative scaling
    or rotating the image 180 in Y completelly turned off the antialiasing.
    I gues I have to find another work around.
    Thanks for your report, you rock!
     
  40. sproutel

    sproutel

    Joined:
    Jul 28, 2016
    Posts:
    3
    Hi, I have a strange issue in my scene where SVG UGUI assets are rendering as black (unlit). It seems to be caused by some issue with lighting and the cameras... if I enable a projector light in the scene, the assets will get all their color back (be lit). I've tried to find this in this forum... I've cleared all baked lighting, made sure all the settings between scenes are similar... I'm not sure where to check anymore... Any ideas?
     
  41. sproutel

    sproutel

    Joined:
    Jul 28, 2016
    Posts:
    3
    I seem to have solved this issue by making the shader "SVG Importer/SolidColor/SolidColorAlphaBlendedAntiAliased" instead of "SVG Importer/UI/UIAntiAliased".

    If it's relevant... I have to use OpenGLES2.0 as the graphics API on this project because another plugin has a conflict with Metal on iOS... The black SVG problem with "SVG Importer/UI/UIAntiAliased" was only noticed on iPhone 7 and iPhone 7+. iPhone 6 didn't have the issue.
     
  42. sproutel

    sproutel

    Joined:
    Jul 28, 2016
    Posts:
    3
    I am not sure if this is related... but now I have an issue where in a 2D scrollview, the SVG assets are shown beyond the extants of the scrollview, and are not being masked. I am using an Image and Mask as part of the scrollview. Unity 2017.1.0f3, SVG Importer 1.1.3. Thanks!
     
  43. V4nKw15h

    V4nKw15h

    Joined:
    Dec 16, 2011
    Posts:
    46
    Hi Jaroslav,

    I've been working with SVG Importer for 18 months on a project that is close to finished. However I ran into a problem on update 1.1.3. I'd be happy to upgrade to the latest version but I'd like to check with you first if my issue is fixed. Updating obviously brings with it some risks, and it's not worth it for me if the problem still exists.

    Let me explain.

    Prior to 1.1.3 I could use the SVG Collider 2D component to alter the quality of the collider. I have planets that are built from SVG's and have up to 35,000 triangles and vertices in their mesh. This was always fine for performance because I could use the quality slider on the SVGCollider2D component to reduce the collider complexity while still matching the high quality mesh shape. However, after updating to 1.1.3 a few months ago I discovered that this no longer worked the same way. The created collider would be an exact match for the mesh at 1.0 quality, but the next step down would create a MASSIVELY reduced quality collider that was totally unusable. The collider would drop in quality removing 90%+ of the collider vertices. It wouldn't even remotely match the mesh any more. I can either have a super high density collider or a super low density one but nothing in between.

    This was not the case prior to 1.1.3. Prior to 1.1.3 I could drop the collider quality down to 0.9 or 0.95 and it would reduce the density of the collider nicely. This used to work similarly to the way the import quality settings tweaked the density of the mesh in nice small steps. It would retain the overall shape of the mesh but at a much lower density.

    Were you aware that this problem existed and did you fix it in the more recent versions?
    Thanks for your time, and I'm happy to see that you are feeling better. SVG Importer is an amazing tool if I could just solve this one last issue I have with it.

    Edit: On getting back to work today, I decided to look into solving this myself. I suspect it's an issue with my very large sized planet colliders(2000 units across). I added a new boolean flag, that I could set on the SVGCollider2D component, that when active would do
    precision *= 0.05
    This was inside SVGCollider2D.UpdateCollider()

    This solved my issue. Now I can fine tune the collider as I used to before. My physics performance went from 50+ms per frame to 5ms once I was able to tweak the points on the PolygonCollider2D down from 6000 to 1000.

    Jaroslav, you may wish to incorporate more range in your quality slider to allow for other users to be able to deal with similar situations with large colliders.
     
    Last edited: Sep 4, 2017
  44. cjsawyer

    cjsawyer

    Joined:
    May 7, 2015
    Posts:
    4
    Hello.

    I have two problems with antialiasing on 2017.1.0p4

    1 - No matter what I do, only one SVG renderer can be on the screen at a time. If there are two, the antialiasing is lost.
    2 - If the Z scale is not set to 0, the sprites get all fuzzy like I had set them to 1000px antialiasing.
     
  45. ADoby

    ADoby

    Joined:
    Dec 10, 2012
    Posts:
    20
    Antialiasing is currently close to broken.
    These fixes are for SVG Importer Version 1.1.6

    1. ALL SVG Assets need to have Antialiasing ON, if you turn it off on just one the SVGImage will disable Normal-Channel in its parent Canvas and break SVG Rendering completely.

    2. Check if Normal Channel is enabled in Canvas "Additional Shader Channels"

    3. Antialiasing will be different based on screen-position, kinda fixed, see posts above
     
  46. Thor_e

    Thor_e

    Joined:
    Sep 4, 2015
    Posts:
    9
    Hi @Jaroslav

    I have this asset for quite a while now, it's great!

    I encounter a problem which I could not resolve yet: I want the SVG sprites to be affected by light (too) and discovered that this works by setting normals to true and then by setting the shader to SVG Importer/.../Solid Color Diffuse Opaque (the sprites are rendered as opaque). This looks nice, but the problem is that for some reason the settings are being lost when I restart Unity. After restart, the sprites are set to the default Solid Color Opaque again. I have only a limited understanding of these shaders at this point and probably do something wrong, but perhaps you (or anyone) can give me a pointer.

    Thanks in advance
     
  47. Hintofox

    Hintofox

    Joined:
    Aug 14, 2017
    Posts:
    5
    i am having an issue with importing an SVG file, when i just drag and drop it like the videos say it adds it to my assets, but when i put into the scene and it creates the object, nothing shows up i don't know if i did something wrong or was it SVG file i have included a link for the file
    https://t.co/yjp5MZDo7i , and when i try to use the SVG editor it says to use one asset, when it is the only asset selected.
     
  48. AlexHell

    AlexHell

    Joined:
    Oct 2, 2014
    Posts:
    28
    @Jaroslav-Stehlik, I found a bug with MSAA in unity 5.6 (and 2017) build WebGL ver 1.0. In 5.5 MSAA is work well, but in 5.6+ it disables. After some experiments, I understand - it's due to Camera.onPreRender += OnAtlasPreRender; which invoke RebuildAtlas(); after commenting it - MSAA is work in webGL 1.0 unity 5.6 now.
    In webGL 2.0 it work with it, and with image effects, etc. But webGL 1.0 have limitations, and it's not clear what Camera.onPreRender disables MSAA.
    Also not only Camera.onPreRender disables MSAA, it can be HDR on main camera (in my test project HDR is on by default, and MSAA not worked without SvgImporter).
    WebGL 2.0 is not enabled by default on my firefox (latest) and my collegue's PC firefox and chrome, and may be in many of out potential users; in my chrome webGL 2.0 is enabled, and unity 5.6 build MSAA is works fine.
    Strange what unity 5.5. build works ok in firefox and chrome on webGL 1.0, but support don't research this very deep.

    p.s. also you need to disable AddFakeCamera() which create new camera. may be with HDR?
    after disabling AddFakeCamera(); and Camera.onPreRender - MSAA is work 100%. But after only disabling Camera.onPreRender not enough.

    now I have troubles with gradients.
     
    Last edited: Sep 26, 2017
  49. AlexHell

    AlexHell

    Joined:
    Oct 2, 2014
    Posts:
    28
    @Jaroslav-Stehlik after final research, you need only patch code with
    AddFakeCamera()
    {
    ..
    camera.allowHDR = false;
    }

    now MSAA in webGL 1.0 in unity 5.6+ works fine.
    It's due to HDR enabling by default on every camera: created on runtime, or when convertion 5.5 to 5.6 project on scene cameras too.
    gradients is ok due to rebuild gradients.

    p.s. also user can disable HDR totally in tier settings.
    I have found what you need AddFakeCamera (which invokes public void OnPreRender -> then OnAtlasPreRender) OR Camera.onPreRender += OnAtlasPreRender but not both. and you definitely not need
    protected void Update()
    {
    Camera.onPreRender -= OnAtlasPreRender;
    Camera.onPreRender += OnAtlasPreRender;
    }
     
    Last edited: Sep 26, 2017
  50. Grazer2

    Grazer2

    Joined:
    Jun 20, 2011
    Posts:
    43
    I'm also here to report that anti aliasing is broken for me when using a Screen Space - Overlay canvas. This basically forces me to replace all those neat svg images with regular images :(