Search Unity

[Next-Gen Soft-Shadows 2] Sophisticated dynamic penumbra Shadows for Unity

Discussion in 'Assets and Asset Store' started by tatoforever, Nov 8, 2016.

?

Would you like to buy this on the Asset Store? If so, how much?

Poll closed Jul 10, 2017.
  1. I like it to be priced between 20 to 10$.

    56.8%
  2. I like it to be priced between 10 to 5$.

    39.0%
  3. Zero $, I'm not interested, I love my Unity's default aliased, pixelated horrid-shadows.

    4.2%
  1. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    Spot Light Shadows comparison (Hi and Low) with and without filters (Editor images):
    spot_hi1.png spot_hi2.png spot_low1.png spot_low2.png
     
    OCASM and Lex4art like this.
  2. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    As you can see, even at extreme tiny resolutions the filters smooth-out the shadows aliasing and banding. Basically, you can have pretty nice soft-shadows at very low cost with small memory usage and bandwidth.
     
    ZJP likes this.
  3. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    408
    Looks really nice
     
  4. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    Package will be live a this address (once reviewed): http://u3d.as/GmQ
    And this is how it looks like on the Asset Store (preview):

    The system is compatible with Unity 5.3 and up (could possibly work with lower than 5.3 but not tested yet). A small PDF document is also provided with the package but you'll see it's a no-brainer two-steps quick setup.
     
    OCASM and wetcircuit like this.
  5. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,142
    Yeesh, only $15? I'll definitely be picking this up then. This is a huge leap over Unity's traditional shadows.
     
    ikazrima, ZJP, punk and 1 other person like this.
  6. mensch-mueller

    mensch-mueller

    Joined:
    Nov 25, 2014
    Posts:
    156
    Great news for next year :)
    Definite buy! Eta for 1.2 (with directional light)?

    Cheers
    Michael
     
    tatoforever likes this.
  7. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    289
    Definitely looking forward to picking this up the instant it's approved. I have one question though. How easy is it to enable/disable NGSS at runtime?

    Thanks!
     
    tatoforever likes this.
  8. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    Just set your light shadows to off (changing the shadows type to None).
     
  9. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    I'm currently working on Directional shadows and will submit as soon as I'm done with. So sometime mid-late January 2017.
    PS: Will post progress as I move it forward.
     
    Lex4art likes this.
  10. Max1982

    Max1982

    Joined:
    Oct 16, 2014
    Posts:
    133
    Hi, i would like to know what exactly is your asset? There are shadows or filter to shadow? May I use it and turn off unity shadows?
     
    ZJP and tatoforever like this.
  11. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    It's a set of real-time shadow filterings that replaces the default ones provided by Unity. The way it works, it replaces the built-in filtering system at it's core level so you don't have to add scripts to lights or scene. In fact, there's no single C# file in this package, only core-level shaders. There's no extra RTs creation, no extra performance overhead nor extra-setup to do or anything like that. You replace the Unity ones with this, then tweak shadow properties on the Lights Component itself.
     
    ZJP likes this.
  12. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    289
    Will this disable shadows completely? I was looking for how to switch back to standard Unity shadows at runtime. It sounds like this might not be possible though?
     
  13. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    Not in this version. Future versions will have a whole lot more range of filters, including the built-in Unity filters. Right now it's not possible due to performance considerations. But once ScriptableRenderLoops is available I'll rewrite the same renderer and add support for more shadowing techniques. As of now (again due to performance considerations) I only have place for two filterings (which can be switched at runtime) and they are PCSS + the approximated one. If there's a huge request I can remove one of the filters and add the default soft one from Unity.
    PS: Can I know the reason why you want to switch back to Unity filters at runtime?
    Regards,
     
    Last edited: Jan 1, 2017
  14. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    289
    Sounds good. I don't imagine it will be an issue. I just like to allow my users to enable/disable any features that might have overhead or cause discomfort. I'm in VR development, and sometimes every cpu/gpu cycle counts. It doesn't sound like the performance overhead for your shadow solution will be an issue though, so I wouldn't worry about it. It's more of a "would be nice but if not that's fine" sort of thing. I think, of the options you've got currently, having the ability to switch between PCSS and approximated is the best compromise. Users can always drop shadow quality or disable them entirely if it's somehow an issue.

    Thanks again. I'm looking forward to adding these shadows to my game. Lighting is a huge element, and I think this will add a lot. :)
     
    tatoforever likes this.
  15. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    @CodeBison
    To minimize overhead you can try low-res shadowmaps with NGSS filters, you should have similar overhead to standard Unity filters but better looking shadows. The trade off are kinda similar but visuals are better with NGSS.

    Btw, PCSS and approximated filters looks exactly the same, their difference it's mainly how penumbra kernel is handled (PCSS is more physically correct). PCSS is also a bit heavier but not that much as it integrates a good blocker search optimization that skip fragments smartly based on distance between light, caster and receiver.
     
  16. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    @CodeBison
    Saw videos and images of your game (which btw looks quite interesting) and yeah BGSS will help a lot but keep in mind that either Unity filters or NGSS ones, shadows still shadows and they will remain heavy. You must pay careful attention to the amount of lights that cast shadows simultanesouly. Like for instance that ball you throw to distract enemies, you should not cast shadows from it. Your LD looks pretty dark so you can smartly place lights a bit sparingly here and there with shadows. Remember that tiny lights (or lights with low intensity) don't really need to cast shadows as it will barely noticeable by the user. Big dominant lights are the most important (those are the ones you must separate and try to use your LD style to cull them intelligently).
    I'm in the process of rewriting our custom renderer in ScriptableRenderLoops. It does plenty of dynamic lights with atlased shadows in one single pass. The system is very flexible, you'll be able to integrate it with any shader framework by doing small core tweaks (basically replace shader passes names and tags). By default it will be compatible with a Standard like Shader.
    Regards,
     
    punk and wetcircuit like this.
  17. OCASM

    OCASM

    Joined:
    Jan 12, 2011
    Posts:
    328
    I wasn't aware that the Scriptable Render Loops system was already in a somewhat usable state. Interesting...
     
  18. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    You can already start using it but API is being changed as we speak, it's in Experimental state right now.
     
    OCASM likes this.
  19. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    Folks,
    Happy 2017 (3 days later). Hoping this year, you won't be ashamed of your Unity shadows anymore! :D

    Btw, I can definitely make this work with older versions of Unity by providing different packages per Unity Editor, including 4.x/3.x. If there's huge number of request (obviously) I'll provide support to them.
     
  20. Arnklit

    Arnklit

    Joined:
    May 18, 2015
    Posts:
    48
    This looks lovely, would love to try this out on a VR project I'm working on, if the performance is OK. One thing I'm wondering about. Does this implementation of shadows work correctly with MSAA? The standard Unity shadows seem to be applied after MSAA and therefore cause aliasing.
     
  21. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    Hi Arnklit,
    It works wherever Unity built-in shadows works (VR, Mobile, Desktop, Consoles, etc). Overhead can be lower or higher to default shadows filtering (depending on shadows resolution) but visuals will always be better, even at very low resolutions.
    MSAA shouldn't cause any aliasing unless isn't properly implemented. It's main job it's to reduce it.
    PS: You have any image I can take a look where MSAA cause shadows aliasing?
     
    Last edited: Jan 5, 2017
  22. Arnklit

    Arnklit

    Joined:
    May 18, 2015
    Posts:
    48
  23. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    @Arnklit,
    MSAA doesn't cause Aliasing, MSAA simply isn't enabled in that offscreen buffer to compute directional shadows. And you get a display buffer anti-aliased with a normal depth buffer (without AA). This is something Unity need to address. Same for MSAA and HDR buffers they didn't work until now (v5.5) if I remember correctly.
    PS: Spot/point shadows aren't affected by this issue.
     
  24. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    @Arnklit,
    If I'm not mistaken, Unity applies directional shadows filtering only to the first Directional light, the rest of directional shadows gets standard hardware filtering (if available). My goal for v1.2 of NGSS is to filters directional shadows at core level the same way spot/points shadows are filtered. It shouldn't have this MSAA issue unless something else is really broken on Unity.
     
  25. Arnklit

    Arnklit

    Joined:
    May 18, 2015
    Posts:
    48
    @tatoforever
    Thanks for the answers. Let's hope they get this solved, it seems a really ugly issue for everyone who is reliant on forward rendering and MSAA for VR.
     
    tatoforever likes this.
  26. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    Indeed,
    All in all, you'll be able to have better looking shadows with less overhead by reducing shadows resolution and having better AA on them using NGSS filters.
     
  27. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    289
    Have you heard anything back from Unity on your submission yet? I know they can take a while sometimes.
     
    tatoforever likes this.
  28. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,142
    Unity needs to hurry along with this. I've been blocking out some cutscenes and just... wow the shadows are ugly.
     
    tatoforever likes this.
  29. brisingre

    brisingre

    Joined:
    Nov 8, 2009
    Posts:
    277
    No kidding. Built-in dynamic shadows are one of the last things about Unity that's still really embarrassingly bad.
     
    tatoforever likes this.
  30. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    Hey guys,
    Haven't heard of Asset Store team yet. It's probably taking some time cause holidays and new year.
    If any of you are interested in getting an early access to NGSS, I can give you a PayPal invoice and once the payment is completed send you a copy of NGSS with an Asset Store code (not sure if I'm allowed before the asset is published though).
    Send me an email to: tatoforever [at] psychozinteractive [dot] com with your PayPal name and email.
    PS: Keep in mind that I can do this for a limited amount of users as the payment must be processed manually. :)
     
    Last edited: Jan 9, 2017
  31. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    289
    You can only generate something like 10 keys a year, so you'll want to be careful how many of those you do.
     
    Last edited: Jan 9, 2017
    tatoforever likes this.
  32. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    @CodeBison,
    Just saw something on my Asset Store account that says Publishers are not allowed to sell vouchers or otherwise charge for them.
    So yeah folks, after reconsideration we better wait for it to be on the Asset Store. Sorry for the heads-up hype. ^^
    I’ll keep you guys updated on the review state of NGSS as it goes on.
     
    Last edited: Jan 9, 2017
  33. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    Folks,
    NGSS still in "Pending Review" state. Haven't heard yet from the Asset Store team.
    I got an upcoming video (later on) showcasing NGSS shadows in a real world scenario, our current game! :)
    Keep around if you wanna see it. ;)
     
    punk and Lex4art like this.
  34. thelebaron

    thelebaron

    Joined:
    Jun 2, 2013
    Posts:
    857
    I was just wondering(and patiently awaiting this being approved!) but the shadows in the screenshots look a ever so slightly noisy, is this configurable, or an artifact of the image? A higher quality video or webgl player or something would be fantastic.

    [edit] i somehow missed the huge filters images, forget I mentioned this! Anyway looking forward to the store debut
     
  35. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    @thelebaron,
    You will hit the noise bar if your tweak is extreme beyond normal use (like your shadows are soo smooth and wide out that they will wont be visible anymore) because that's how the filter works. Instead of a Box-pattern sampling, samplers are rotated in a spherical way (to cover all possible areas around the middle sampler).
    But again, it's a lot preferable than shadows banding, aliasing and textel bigger than objects. ^^
     
    Last edited: Jan 13, 2017
  36. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    Folks,
    Wanted to share an image of a character from our current game showcasing up-close NGSS shadows (low resolution Point light shadows):





    Everything in those shots are full 100% dynamic real-time, no pre-process or pre-brake. As you can see bias problems with built-in shadows aren't a problem with NGSS as you'll have more fine control even on the pesky point lights shadows. :)
     
    Last edited: Feb 3, 2017
    ZJP, ikazrima, wetcircuit and 2 others like this.
  37. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    Now up-close images of spot light shadows using NGSS on characters (previous post was point light):


    Again, bias problems and contact shadows isn't an issue with NGSS.
    Even shadows acne can be faded out due to the ability to override shadows soft-ness.
     
  38. thelebaron

    thelebaron

    Joined:
    Jun 2, 2013
    Posts:
    857
    Looks really nice! Did you go with your own shaders for the skin and hair?
     
    tatoforever likes this.
  39. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    Custom forward+ renderer capable of doing multiple lights and shadows in one single pass with skin, eyes and hair shaders. Environments also do have few custom shaders too.
    NGSS come from our custom renderer. :)
     
  40. wetcircuit

    wetcircuit

    Joined:
    Jul 17, 2012
    Posts:
    1,409
    Thanks for these latest pics. My greatest Unity peeve is jaggy shadows from hair props on my character's faces. NGSS is an instant buy from me.
     
    tatoforever likes this.
  41. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    Wanted to share an analysis comparison case with standard PCF filtering vs NGSS filtering algorithms. Both shadows using 16 samplers per fragment. By default Unity does only 4 per fragment so it's even more aliased. Example below showcases it (using point light shadows).

    Standard PCF 16 samplers per fragment:


    NGSS filtering 16 samplers per fragment:

     
    Last edited: Feb 3, 2017
  42. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,142
    I get the feeling that by the time Unity approves this, 1.2 will be ready and we'll all be waiting on them to update the asset store page so we can use it with directional lights.
     
    tatoforever likes this.
  43. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    @Murgilod,
    I got the same feeling. :oops:
    I'll make sure you get the first version before I submit v1.2, so you can at least have nice shadows on spot/point lights. On future updates of NGSS I'll provide you ways to get early access before it hits the Asset Store (using your purchase invoice).
    PS: Will soon post some of the work done with Directional Shadows in NGSS.
     
    Last edited: Jan 20, 2017
  44. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    Folks,
    Got an answer from the Asset Store Team yesterday. They told me that I forgot to provide the example scene in one of the packages, I've submitted 3 of them (v5.3, v5.4 and v5.5). Silly me.:confused:
    I've done a new resubmission with the missing example scene. The good thing is that you now got all the improvements since v1.0. :)
    Keep it tight, NGSS will come soon and I'll keep teasing you till it's out. :cool:
     
    ikazrima, one_one, brisingre and 4 others like this.
  45. jvo3dc

    jvo3dc

    Joined:
    Oct 11, 2013
    Posts:
    1,520
    Very interesting. It's on our must have list now, so as soon as it comes online...
     
    tatoforever likes this.
  46. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    Guys,
    Resubmission done, it has all the latest updates (improvements to shadow bias and filters algorithms).

    Also uploaded a video of it showcasing NGSS point light shadows with PCSS filtering:


    And now in a real game character:


    PS: I'll let you know once the packages gets approved but will keep teasing you with updates toward v1.2.
    Enjoy!
     
    Last edited: Jan 23, 2017
    Seith likes this.
  47. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    Folks,
    I know it's taking a bit of time (I wrote a small message to Asset Store team to see if things can get accelerated).
    So to cut that time out, I wanted to share some of the improvements in the latest version (the one coming to the Asset Store). Small sphere zoomed in with point light shadows:

    No matter how much you zoom in, you will never see any aliasing or banding.
    In fact, the little secret behind NGSS is a Monte Carlo variant that produces randomized but stable patterns on all NGSS filters (spot, point, directional, etc). :)
     
    cecarlsen, ZJP and Lex4art like this.
  48. ggXXmastrerz

    ggXXmastrerz

    Joined:
    Dec 26, 2016
    Posts:
    2
    Than what is this?
    I am just concerned about what's going on under the hood... Now I'm no shader junky, but this looks like it's using the same filtering technique that was used in Unity 4, just greatly improved. While that's not a bad thing, it leads me to ask two questions: 1, do you have plans to implement PCF? 2, is this system, at ANY point screen-space?

    P.S, the screenshots shown so far look amazing!
    Please and thank you,
    ggXXmastrerz
     
    tatoforever likes this.
  49. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    Hi,
    Is not the same technique, it's not even similar, quite different in every way. Unity4 used a screen-space filtering with a screen space texture that created random unstable patterns which didn't scaled well with distances (probably the reason why they removed it). NGSS filter shadowmaps on light-space (much like PCF does), offsets are pre-stored in a grid to minimize bandwidth. Finally a Monte Carlo algorithm is used to stably distribute kernels across the surface. Each light provides two filter types (PCSS and a cheap variation of it).
    Btw, the image you've posted is an old version of the filter, here's what it looks like today (same sphere, point light NGSS shadows):
     
    Last edited: Feb 3, 2017
  50. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    755
    Great job, that looks really nice! Can't wait to try it! :)
     
    tatoforever likes this.