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
    As long as you are not blowing out your SM2.0 shaders with more than 64 math instructions, you are fine. However, I'm not sure how long Unity itself will keep supporting SM2. To be able to run NGSS on SM2 hardware, you really need very simple mobile shaders.
    If I'm not mistaken, I think Unity still don't support spot/point shadows on Mobile (only directional). This only applies for directional lights and custom mobile renderer that does spot/point shadows and want to integrate NGSS on them.
    PS: SM3.0 will remain for a moment (Desktop and Mobile) so no problem on that.
     
    ZJP likes this.
  2. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Thanks. :cool:
     
    tatoforever likes this.
  3. Olafson

    Olafson

    Joined:
    Aug 7, 2012
    Posts:
    255
    So does this support Point lights only, or also Directional lights?
     
  4. wetcircuit

    wetcircuit

    Joined:
    Jul 17, 2012
    Posts:
    1,409
    From the first post in this thread:

    Current Shadow Features:
    - Point Light: PCSS + Approximation filters
    - Spot Light: Approximation filter

    Upcoming Shadow Features (v1.2):
    - Spot Light PCSS filtering
    - Directional: PCSS + Approximation filters
    - Optimizations and quality profiles for low-end hardware
     
  5. toto2003

    toto2003

    Joined:
    Sep 22, 2010
    Posts:
    528
    hello i just bought your awesome asset, but i can t seem to find the folder Data \CGIncludes where i need to replace the UnityShadowLibrary.cginc , i m on a mac.
    cheers
     
  6. Flurgle

    Flurgle

    Joined:
    May 16, 2016
    Posts:
    389
    Try here: /Applications/Unity/Unity.app/Contents/CGIncludes/
     
    tatoforever likes this.
  7. toto2003

    toto2003

    Joined:
    Sep 22, 2010
    Posts:
    528
    ah ok find it, work beautifully!!!! thanks :)
     
    tatoforever and Flurgle like this.
  8. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    Folks,
    I'm in the hospital, dealing with an urgent intervention but everything got sorted out.
    Fortunately there's wifi here and I'll be reading your posts but I won't nave access to my email and computer work in the next 3 days. So access to NGSS pre-releases versions wont be possible either for 3 days (time to recover at hospital).
    Any questions you have, please PM me or post them here in the thread.
    PS: I'm almost done with Directional filter, you should have pre-access by the end of next week.
    Warm regards :)
     
    id0, punk and Flurgle like this.
  9. Flurgle

    Flurgle

    Joined:
    May 16, 2016
    Posts:
    389
    Best of luck to a speedy recovery !
     
    tatoforever and punk like this.
  10. Inspeinre

    Inspeinre

    Joined:
    Jun 15, 2013
    Posts:
    44
    I wish you health!
     
    tatoforever likes this.
  11. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    Folks,
    If you are having CBuffer warnings or errors, open the NGSS UnityShadowLibrary.cginc file and comment out the CBuffer (not whats inside of it). We actually don't need to Cbuffer the values inside it, not really necessary even under DX11 as those values are not updated outside the cginc. Here's how to:

    Code (CSharp):
    1. //CBuffer MyCbufferName
    2. //{
    3.     //dont comment the functions and variables in side it
    4. //}
    And don't forget to delete your ShaderCache folder after modification before opening your project again.
    The pre-release version already have this fix but I can't access to my computer work right now so here is in case you need it. :D
    PS: Supporting customers from Hospital bed (that's what I answer to my doctor when they saw me). :cool:
     
    toto2003 and hopeful like this.
  12. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    Folks,
    I'm leaving hospital tomorrow, will probably take the day off to read gazillions of unanswered emails and messages and then get back to work next day.
    PS: Hold it tight, directional light is almost there! :)
     
    brisingre, Flurgle and toto2003 like this.
  13. toto2003

    toto2003

    Joined:
    Sep 22, 2010
    Posts:
    528
    directional light + realtime gi , that s going to be a game changer, i m really curious about the performance
     
    tatoforever likes this.
  14. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    @toto2003,
    Overall, the NGSS overhead is unnoticeable. Unless you have a very weak GPU and you are already bandwidth bound then you'll see the difference, otherwise you should be good.
     
  15. toto2003

    toto2003

    Joined:
    Sep 22, 2010
    Posts:
    528
    and what if i setup the shadow distance to something like 300, usually even with very high quality resolution in quality setting i get to see this horrible aliasing . will NGSS would be able to handle such situation for direction light?
     
  16. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    It will smooth out better yes.
     
    toto2003 likes this.
  17. Flurgle

    Flurgle

    Joined:
    May 16, 2016
    Posts:
    389
    @toto2003 this isn't the directional lighting, but you can see the NGSS spotlight shadows from 300+ distance here in this forest mountain scene:

     
    toto2003, hopeful and tatoforever like this.
  18. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    @Furgle
    It will look miles better with NGSS directional shadows. Hoping to finish pre-release this week so you can have access. ;)
     
    Flurgle, toto2003 and hopeful like this.
  19. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    Folks,
    I'm recovering pretty fast, being working on a bit intermittently and started this week pretty strong. I will soon finish directional shadows and submit for update on the Store. Will let you know if you want to get a pre-release access (remember to email your invoice number if it's your first time asking for it).
    Regards,
     
    Akshara, AcidArrow, Flurgle and 3 others like this.
  20. Flurgle

    Flurgle

    Joined:
    May 16, 2016
    Posts:
    389
    @tatoforever Awesome, looking forward to it. And get well :)

    Also, if you didn't get a chance to watch the GDC presentation, Unity made it really clear that scriptable render loop is a huge priority, also multithreading, and some other goodies :)
     
    tatoforever likes this.
  21. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    @Flurgle,
    I saw it yes, we are quite excited too! :)
     
  22. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    Ok Folks,
    Directional Light update is done and submited to the Store under v1.1. You can start bombing support email if your want pre-realease v1.1 (don't forget to attach your invoice number if it's your first time requesting pre-releases). Upcoming version (1.2) will include performance/quality sets and new bias algorithms for shadows quality then contact shadows after that. :)

    IMPORTANT: You must set your graphics shadows projection to Closefit (Quality Window), right now it works better with NGSS algorithms and cascade seams are unnoticeable. Fail to do so you'll see pronounced cascade seams and bias noise.
    Due to the behavior of Closefit shadows, you better tweak them in-game view (not in-editor view) as it looks sometimes funky in Editor view (seems like a bug in 5.5).
    Furthermore, you can experiment with no cascades (faster shadows) or set shadow distance larger than 150, it will always look smoother than default Unity shadows. And don't forget to crank up Directional Shadows Normal-Bias (setting it to 3 gives the best results).
    PS: You'll be able to switch between NGSS Directional shadows and Unity Directional Shadows using the Shadows Type (Hard = Unity default, Soft = NGSS). Also, Shadows cascade transition looks a lot better in 5.6 in Editor.
     
    Last edited: Mar 2, 2017
    ifreed92, cfantauzzo, Akshara and 4 others like this.
  23. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    NGSS 1.1 have been submitted (email support for pre-release), it contains soft-shadows support for Directional Lights.
    Next NGSS version (1.2) will provide quality range settings, Bias improvements and new shadows algorithms for directional lights (PCSS filtering).
     
    id0, HerrDarko, brisingre and 3 others like this.
  24. toto2003

    toto2003

    Joined:
    Sep 22, 2010
    Posts:
    528
    seriously THIS should be the unity default shadow, it really boost my project to a new visual level, i m so fed up with the actually unity shadow that was one of his weakest point for ages!!!
     
    AcidArrow, ZJP, Flurgle and 1 other person like this.
  25. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    Got some images to share that would make tears in my eyes? :D
     
    Flurgle likes this.
  26. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    How you doing today folks?
    Already started working on contact shadows (for directional lights). Directional PCSS will probably never see the daylight as contact shadows does exactly the same job (hardening shadows with short distances between caster/receiver) and it's really light performance wise as it does not depends of geometry complexity it requires only screen depth. Works on any renderer (requires depth pre-pass on Forward, free on Deferred).
    In the near future I will be moving out all PCSS/auto penumbra filters out of the light space and do it entirely screen space, leaving only a simple PCF (or maybe simple hard shadows) in light space and doing the heavy filtering screen space with the same NGSS secret sauce. :)
    PS: Screenshots coming soon. ;)
    Regards,
     
    Last edited: Mar 5, 2017
    punk, Lex4art, one_one and 2 others like this.
  27. arnoob

    arnoob

    Joined:
    May 16, 2014
    Posts:
    155
    Hello tatoforever!

    I am currently thinking about purchasing your asset.
    I'd like to have a better directional shadowing for an open area. Do you confirm that the performances are better with this asset on directional lights(especially drawcalls, i'm really fighting against them multiplying)? And if not, is it possible to get back at runtime on the unity's default soft shadows? (this way it could be a graphic setting).
    Also does it work with a split screen setup?
    And finally, do you think it works in combination with SESSS? (http://www.sonicether.com/screenspaceshadows/)

    By the way I sincerely hope you got better, and yes I'd be glad to show screenshots if I purchase the asset! :)
     
    tatoforever likes this.
  28. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    @arnoob,
    Performance varies (depending how you set it but it will never be more costly than default directional soft-shadows) and does similar amount of samplings per fragment. However, you can obtain better looking shadows at low resolutions which transforms in faster shadows than default ones. For example, you can disable all shadow cascades and still have better smoother shadows which will runs faster than default ones with 4 cascades. ;)
    For directional shadows, you can switch back to hard default shadows at runtime yes.
    As for SESSS, yes, it works in combination with but I'm currently working on the same thing (contact shadows) that will support in the near future all light types (not just one directional). :)
    Regards,
     
    ilmario and arnoob like this.
  29. arnoob

    arnoob

    Joined:
    May 16, 2014
    Posts:
    155
    Sounds good so far!
    I need to lit a map with a shadow distance at 1000m, so cascades aren't really an option.
    However, can you change the size of the smoothing at runtime using a float value for example? And is it possible to get similar performances by disabling the smoothness completely? (I'm asking because I really want to give the players the ability to choose).
     
    tatoforever likes this.
  30. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    If you disable cascades and set the distance to 1000 it will not only look better than the default counter part (built-in soft-shadows) but also will run faster. Switching back to hard shadows will do the exact same thing as default Unity hard shadows.
    PS: Penumbra size (shadows smoothness) can be tweaked using the shadows built-in value "Strength" on your light.
     
  31. blizzzz

    blizzzz

    Joined:
    Jun 22, 2016
    Posts:
    15
    Do you support vr rendering? I've been having many filtering, biasing and fitting issues with the standard Unity shadows. Would love to give yours a try but my project is in VR and want to be sure that stereo rendering is supported prior to purchasing. Thanks!
     
  32. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    @blizzz,
    NGSS support what Unity already support, so If Unity doesn't properly support VR, it will be the same with this asset. What NGSS does is improve shadows quality not shadows compatibility across platforms.
    PS: I think Stereo rendering got implemented in 5.6. Give it a go, if you have trouble, I'll be glad to refund you back.
    Regards,
     
  33. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    Folks,
    Do not forget that any custom effect (shader/lighting/framework, etc) you are using that get access to internal _LightShadowData.r value, you need to override that value with 1.0 or comment such line. Otherwise your effect will fade when you tweak the NGSS penumbra size.
    It's on the documentation. :D
     
  34. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    408
    Single pass stereo VR has been working for a while I'm using it on 5.5, tis awesome. If you don't implement single pass VR on the contact shadows, can you put an option to turn them off?

    I'm not sure whats involved, but I know @Lexie added this to hxVolumetric lighting, could perhaps ask him, cos it would be rad
     
  35. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    @punk,
    I wasn't sure if it was 5.5 or 5.6 (got mixed up). ^^
    As for contact shadows yes it will work with VR (single pass). You'll have the option to turn them off if your game don't need it.
     
    punk likes this.
  36. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,348
    Native VR (for Oculus SDK 0.7.0) went in for Unity 5.2, and Single Pass Stereo was added in 5.4 a year ago.
     
    tatoforever likes this.
  37. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    408
    Nice, you are too cool
     
    tatoforever likes this.
  38. greengremline

    greengremline

    Joined:
    Sep 16, 2015
    Posts:
    183
    Hey, thanks for making this asset! It's pretty cool!

    upload_2017-3-7_19-7-4.png
    Standard unity shadows

    upload_2017-3-7_19-7-13.png
    Soft shadows (no tweaking)

    I have noticed a huge framerate drop, however. Is there an easy way for me to change the value on all lights from soft to hard in quality settings, or will I have to build custom logic for that?

    Also, sometimes I'm noticing lines on walls where I guess the cascades are visible? Is there an easy way to fix this? I'm a noob at lighting so all of this is very new to me.

    Thanks!
     
    CoffeeCYC and tatoforever like this.
  39. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    @zornor90,
    For cascade seams, try Close Fit Projection (Edit/Project Settings/Quality). And crack up Normal Bias if you can.
    Regards,
     
  40. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    Folks v1.1 is out on the store.
     
    punk, brisingre, one_one and 3 others like this.
  41. Mad-Monkey-Art

    Mad-Monkey-Art

    Joined:
    Oct 22, 2014
    Posts:
    7
    For anyone who still doubts whether to get this asset or not, do yourself a favor and upgrade your visuals significantly pretty much for free as far as performance goes! We've experimented with it this morning and the results are a serious step up compared to default shadow quality so well worth the price! Good asset. :)

    We did get some errors when building in 5.6.0b9, something with dx9 and the UnityShadowLibrary file but can't remember exactly. Will keep an eye on it with further testing.

    Edit, these errors poped up after the build finished:

    NGSS-test-errors.jpg
     
    Last edited: Mar 8, 2017
  42. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    @Mad-Monkey-Art ,
    If you are not targetting SM2 devices, you can ignore those errors.
     
  43. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,348
    Well, I can confirm it works on the PS4 and with single pass stereo VR, and looks great, but is also comes with a significant performance impact over the built in shadows. Even after modifying directional shadows to use only 10 samples it's still noticeably slower than Unity's built in 9 sample 5x5 PCF method.
     
    buttmatrix likes this.
  44. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    Upcoming version should provide greater performance boost and more quality. I'm moving everything from light space to screen space.
    PS: Are you using VR right?
     
  45. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,348
    This was specifically using only the single screen space directional lighting, and yes, VR. For our project we can't afford even a single additional point or spot light using Unity's built in stuff, let alone an additional shadowcasting light.
     
  46. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    @bgolus,
    Indeed, shadows can make any GPU/CPU crawl, specially on mid-range VR platforms where high frame-rate is required.
    What's your ms budget (for your target platform) and what are your numbers now?
    What others heavy effects you have (post-effects, complex shaders, etc)? If shadows are very important on your game, perhaps you can cut out in other areas and leave more bandwidth/drawcalls for shadows.
    Regards,
     
  47. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,348
    We're aiming for 90fps on the PS4 PSVR. Currently we're fairly consistently between 100 and 120 fps because we actually target 10ms as our max frame time. Just using the custom screen space shadows I'm seeing an increase in frame cost of at least ~3ms on the GPU (using internal console timing tools) on our simplest scenes (which run at ~150 fps). On more demanding scenes where the framerate is normally 100~110 fps it's dropping down to mid 70s, so closer to 4ms. I don't even have 4ms to render the main scene geometry so spending an additional 4ms to make the shadows nicer isn't going to happen. ;)

    On PC I can't even separate the difference in the frame time from the usual delta noise, so A+ there.
     
    buttmatrix, tatoforever and one_one like this.
  48. DannyBennn

    DannyBennn

    Joined:
    Sep 5, 2014
    Posts:
    1
    looks interesting
     
    tatoforever likes this.
  49. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    I am keeping my eye on this plugin.

    I recently figured out some quality settings that would allow a great number of shadows to render fast as long as the camera doesn't move as that causes the shadows to shake so can this plugin prevent the shaking?

    I am noticing many users state that it's much slower than the default shadow solution so I will wait until the performance update and for users to report it. We will see.

    Currently in case anyone is wondering I am on the hunt for a full suite of tools to upgrade the capabilities of Unity, their compatibility has to be maximum including areas of VR and so far I seem to have found what works very well for Water and Volumetric Fog.

    Hydroform Water
    https://www.assetstore.unity3d.com/en/#!/content/76960
    Hx Volumetric Lighting:
    https://www.assetstore.unity3d.com/en/#!/content/67665

    Once the update comes out and people start posting more on this thread I will see how it all turned out and if this plugin will work out too.
     
  50. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    @SilverStorm
    Performance is relative to the target hardware and platform. On PC you will probably never see any difference (unless you are doing something wrong with your setup). On consoles and VR If you are already GPU bound you'll see a difference when using NGSS, if you are not abusing your GPU you won't notice any performance.
    As for compatibility with other assets, it works 100% as long as the asset isn't using _LightShadowData.r internally. If that the case, you have to manually override that value with 1.0 or comment out that line in the shader. The reason is that value maps to Shadow Strength value on the light which NGSS uses to set shadows penumbra size.
     
    SilverStorm and Flurgle like this.