Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Corgi SDF Outlines (aka Stroke Outlines) for URP [Released]

Discussion in 'Assets and Asset Store' started by funkyCoty, Nov 11, 2021.

  1. funkyCoty

    funkyCoty

    Joined:
    May 22, 2018
    Posts:
    686
    Corgi SDF Outlines (aka Stroke Outlines) for URP

    Asset store URL: https://assetstore.unity.com/packages/slug/206960

    Fast and easy to use SDF / Stroke outlines for URP projects.

    Features:
    * Fast stroke outlines!
    * Customizable thiccness!
    * Customizable HDR colors!
    * Uses layers, so you can easily control what does and does not have an outline.
    * Depth testing so outlines do not appear through walls!
    * Works in VR (both multi-pass and single pass instanced) and non-VR!
    * FULL SOURCE CODE INCLUDED

    Documentation here!

    Want to test out performance and quirks? Check out this demo here.

    Please note: This plugin is only intended for URP projects. If you need it to work in HDRP or a custom render pipeline, please hit me up and ask!

    Unity_8AYBOXPt5n.png
     
    Last edited: Dec 13, 2021
  2. funkyCoty

    funkyCoty

    Joined:
    May 22, 2018
    Posts:
    686
    It's now released!
     
  3. JokerDen

    JokerDen

    Joined:
    Apr 9, 2015
    Posts:
    9
    Hi! Few questions here:
    1. Does it support multiple different outlines?
    2. Doest it support multiple renderers/objects under with single outline?
    3. Is line width performance relative?
    4. Is line has same width all around the object? It looks on some screenshots that line sometime has different width like extrusion outline.
     
  4. funkyCoty

    funkyCoty

    Joined:
    May 22, 2018
    Posts:
    686
    1. It does, I'm using it for that in a personal project. However, it requires a separate pass for each layer (allowing for independent outlines). If you run into any issues with this, please DM me with the Unity/URP version you're using and I'll make sure it works for that combo, asap. URP changes a lot so it can be a bit tricky with this stuff.

    2. Yes, each pass is a single outline around a layer of objects.

    3. Yes, but it's screen-space. It's a linear cost with the pixel width of the outline. However, it's relatively fast so you can get decently thick outlines before performance becomes a concern.

    4. Yes, it's a screen space width that you can change via a slider per-pass.
     
  5. JokerDen

    JokerDen

    Joined:
    Apr 9, 2015
    Posts:
    9
    Thanks for you answers!
    As I can see it using same algorythm as in the article:
    https://bgolus.medium.com/the-quest-for-very-wide-outlines-ba82ed442cd9
    Any particular reason why the width now is limited by 16? Article mentioned that even extra-wide lines are relatively cheap.

    I'm also very interesting in more complex behaviour: is it possible for now outline not the whole objects but only visible pixels? Not just crop overlapped outline but render outline all around visible object.
     
  6. funkyCoty

    funkyCoty

    Joined:
    May 22, 2018
    Posts:
    686
    Yeah you are right, it's using something very similar to that article's final solution. At the moment, each pass is another compute call, which gets a bit heavy when doing a LOT of them in a row on the cpu side, but the gpu side is basically linear time. It could be improved a lot by moving it to be a loop on gpu, which is controllable by cpu. If you or others request this, I can improve the plugin by changing the behavior to make even wider outlines cheaper.

    Can you explain what you mean by this? I'm not quite understanding. A drawing might help clear up what you mean.
     
  7. JokerDen

    JokerDen

    Joined:
    Apr 9, 2015
    Posts:
    9
    I think doing outlines of any width without loosing in performance to much could make your asset to be best on the market :D It's especially useful for mobile where devices has ultra resolutions / DPIs that requires strokes to be wide to look same as at desktop but outcome performance is very poor.

    As for drawing with obstacles (I guess it requires depth-testing or something like that), I'll try to explain:
    a) Here the model (Unlit material) with 2 outlines – Black and White
    Screenshot 2022-02-02 at 12.57.23.png
    b) And here how outlines react to overlapping object: Black is outlining only visible mask and White still outline whole object without any depth test
    Screenshot 2022-02-02 at 12.58.43.png
    c) And here one more behaviour that using by some outlines – just cropping visible outline. It could be useful sometimes but also could be very undesired (in my case at least). The best option is give the ability to switch between (b) and this behaviour but I understand that it's requires a lot of work.
    Screenshot 2022-02-02 at 12.59.02.png

    There is one of the best outline here https://github.com/Arvtesh/UnityFx.Outline that gives control to customize outline as described in (b) that I like very much. But unfortunately this solution is very sensitive to outline width (I guess it uses Blurred Buffer approach) that makes it unusable at mobile.
     
  8. funkyCoty

    funkyCoty

    Joined:
    May 22, 2018
    Posts:
    686
    My plugin will do b's black outline, right now. I could add in the option to optionally depth test or not (although you can also tweak the urp settings to remove the depth stuff, which then the outline has no depth texture to use for obscurity).

    How thick of an outline are you desiring? 16 pixels is pretty thicc in my opinion, but if you're looking for something like 256 pixels the plugin might need some work done to make it possible.
     
  9. JokerDen

    JokerDen

    Joined:
    Apr 9, 2015
    Posts:
    9
    It's cool that it has depth test. Also it is possible to enable/disable it for different outlines in one project?
    As for thickness let calculate.
    Screenshot 2022-02-02 at 23.42.02.png

    Here the width 4 and 8 for black and white outlines at the screen height 720. Modern resolution of iPhone and iPad about 2500px that means we need to increase outlines about x4 times. And if we are at desktop some Retina and 8K displays also could require even more. But for I need at least 32 pixels width. And ideally I dream about outlines that really could give any width without major performance out drawdowns...

    But anyway for now I'm a little afraid to buy new assets because I'm not sure that it suit best for my goals (already purchased few and they useless for my case). But if you could implement same performance relative to width I defiantly will give chance to your asset (no pressure here, your asset already has huge advantage) or in the end I'll try to implement it by myself :D
     
  10. funkyCoty

    funkyCoty

    Joined:
    May 22, 2018
    Posts:
    686
    There's not yet a way, but I can implement this for you and push an update, maybe this weekend or the next.

    That graph is a bit idealistic, but I think I can get this plugin closer to matching its trend overall with a bit of effort. I'll see what I can do soon. It's not too far off, just a bit too much CPU overhead from the multiple compute dispatches.

    I understand, I've been bitten by a lot of asset store plugins as well. If you do pick it up, I'll be happy to work with you to resolve any issues you might have. If you're not happy, you can always get a refund with no hard feelings.
     
  11. funkyCoty

    funkyCoty

    Joined:
    May 22, 2018
    Posts:
    686
    New update just submitted to the asset store. Details:
     
  12. funkyCoty

    funkyCoty

    Joined:
    May 22, 2018
    Posts:
    686
    Working on adding in some custom property drawers, to make the editor side of the tool feel much nicer to use. It gives helpful tooltips and advice based on context. For example, when using texture downscaling it will warn you that depth testing will no longer work (to avoid doing an extra depth blit that would be required to make this work).

    Unity_wI9eB4OtCJ.png
     
  13. funkyCoty

    funkyCoty

    Joined:
    May 22, 2018
    Posts:
    686
    Pushing the next update:

     
  14. funkyCoty

    funkyCoty

    Joined:
    May 22, 2018
    Posts:
    686
    Surprise update coming through!

     
  15. funkyCoty

    funkyCoty

    Joined:
    May 22, 2018
    Posts:
    686
    Mini update, but a pretty good one.

     
  16. funkyCoty

    funkyCoty

    Joined:
    May 22, 2018
    Posts:
    686
    Another small update:

     
  17. funkyCoty

    funkyCoty

    Joined:
    May 22, 2018
    Posts:
    686
    By request, added a new feature:

     
    JokerDen likes this.
  18. funkyCoty

    funkyCoty

    Joined:
    May 22, 2018
    Posts:
    686
    update uploaded:

     
  19. funkyCoty

    funkyCoty

    Joined:
    May 22, 2018
    Posts:
    686
    Small update: