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,366
    Patch v2.3.2 just got submitted for review. It fixes a Frustum Shadows opacity bug (the value was being ignore for no apparent reason). You don't need to install any library, only update the package to v2.3.2. Expect the update to land sometime tomorrow. :)
    If you need it right away, PM.
    [EDIT]
    It's live on the store.
     
    Last edited: Jul 2, 2020
    bac9-flcl and hopeful like this.
  2. bac9-flcl

    bac9-flcl

    Joined:
    Dec 5, 2012
    Posts:
    829
    I'm hitting a problem with all point and spot lights in an AFS project. They render as a pink (no shader) shape when shadows are enabled. No error is raised initially until I try attaching an NGSS component to them, then this error pops up:

    Code (csharp):
    1. Shader error in 'Afs_Internal-DeferredShading': 'UnitySampleShadowmapNGSS': cannot implicitly convert from 'float2' to 'float3' at Assets/Standard Assets/AFS/Shaders/Resources/Afs_DeferredLibrary.cginc(149) (on d3d11)
    2. Compiling Vertex program with SPOT SHADOWS_DEPTH SHADOWS_SOFT UNITY_HDR_ON
    3. Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_HARDWARE_TIER3 UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_RGBM_ENCODING
    The line in question:

    Code (csharp):
    1. #if defined(SPOT)
    2.     #if defined(SHADOWS_DEPTH)
    3.         float4 shadowCoord = mul(unity_WorldToShadow[0], float4(vec, 1));
    4.         #if defined (NGSS_SUPPORT_LOCAL)
    5.         shadowAttenuation = UnitySampleShadowmapNGSS(shadowCoord, uv); // here
    6.         #else
    7.         shadowAttenuation = UnitySampleShadowmap(shadowCoord);
    8.         #endif
    9.     #endif
    10. #endif
    Edit: Disregard me, all fixed thanks to your help over at Discord! The problem was on my side, I forgot to install your replacement for AFS deferred library. :)
     

    Attached Files:

    Last edited: Jul 4, 2020
  3. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,366
    Are you using the provided Afs files that comes with NGSS or is a modded one?
    Can you send me that file (PM Discord or email)?
    PS: What NGSS version are you?
     
  4. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,366
    From v2.3 you don't have to mod these assets in order to make it work with NGSS, I've provided a list of popular assets libraries already modded that works 100% with NGSS (UBER, AFS, etc). If you have someting in-house or custom you can send it over and I'll do the changes. :D
     
  5. Zarkow

    Zarkow

    Joined:
    Jul 27, 2015
    Posts:
    92
    A question: What is 'shadow bias library' for? It is noted as optional, but not what it is for. The included doc (pdf) lacks ref to it at all.
     
  6. calebhc

    calebhc

    Joined:
    Feb 11, 2013
    Posts:
    13
    Hello!

    I installed NGSS version 2.3.2 using Unity 5.6.6f2 and when compiling shaders from Amplify I'm getting this error:

    operands to "%" must be integral at /UnityShadowLibrary.cginc(121) (on d3d9)

    I did the manual installation of the cginclude files and confirmed that the latest ones are in my Unity installation directory. I've also cleared my shader cache and re-imported all assets in my project but still getting this error. Also our project is targeting DirectX 11 as the renderer. Maybe I'm just missing something simple that will fix the compilation issues. :)

    Thanks for any help!
     

    Attached Files:

    tatoforever likes this.
  7. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,366
    Hi,
    Seems like you have some shaders with DX9 compile variants which is no longer supported by NGSS. Also Unity removed support to Unity 5.6 and 2017 but NGSS 2.1.x still works fine on Unity 5.6. If you don't have a copy of it, you can ask us on support or Discord with your invoice number. :)
     
    calebhc likes this.
  8. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,366
    The Shadows bias library is a new normal inset bias algorithm that works in tandem with the basic constant bias to fight acne and peter panning. When using PCSS, you can set light shadows bias to 0 (or very close to it) and tweak the normal bias to your desired value. Or tweak both until you are pleased. :)
    PS: It's also fast (vertex based).
     
  9. Zarkow

    Zarkow

    Joined:
    Jul 27, 2015
    Posts:
    92
    Just to verify then - it is being used if installed, no further actions needed to switch to it?
     
  10. calebhc

    calebhc

    Joined:
    Feb 11, 2013
    Posts:
    13
    Thanks! Haha I guess Unity 5.6 is becoming a dinosaur now. I posted in the discord group and have my invoice number ready since I don't have any older versions of NGSS unfortunately.
     
    tatoforever likes this.
  11. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,366
    Yes,
    The value for Local shadows can be tweak inside NGSS_Local component and for directional lights is he Normal bias value.
    [EDIT] If you are wondering about performance, it's vertex based, you won't notice any perf drop.
     
    Last edited: Jul 7, 2020
  12. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,366
    Folks, don't forget our discord channel for real time NGSS/NGSSEB support or any related graphics performance tips! :)
     
    dsilverthorn likes this.
  13. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,366
    New improvements, little to almost no noise shimmering at distance with very low sampling (4spp):


    Version v2.3.3 is out now. Features and Changes:
    - Improved noise algorithm stability. Allows for a great sampling reduction (eg: 4spp) while reducing noise shimmering over distance
    - Changed samplers reduction algorithm, now computed at world space instead of view space for a better stabilization when the camera rotates
    - Behavior change in NGSS_Local. By default the first instance of NGSS_Local is now the manager, no need to have more than one. Also display warnings if multiple instances of NGSS_Local is detected and shows the user how to correct it
    PM discord if you need it right away. :cool:
     
    Last edited: Jul 10, 2020
    dsilverthorn likes this.
  14. Numa

    Numa

    Joined:
    Oct 7, 2014
    Posts:
    100
    Hi,
    Does anyone have tips on how to setup cloud build to install the libraries?
    Thanks!
     
  15. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,366
    Hi,
    Sure but please head to our discord channel for live support. We don't want to pollute fourms with back and fort answers and questions. :)
     
    Numa likes this.
  16. NeatWolf

    NeatWolf

    Joined:
    Sep 27, 2013
    Posts:
    924
    Hi there!

    I was looking for some info in the PDF doc about the "Shadow Bias" setting but couldn't find any.

    I mean, I believe I knew when it first came out but now I'm a bit clueless about when should be appropriate to use it, and how exactly it affects visuals and performance.

    Could you please add it to the PDF doc? (if it's not already there :) )

    BTW: I keep cranking the max far smoothness to 4 - pretty happy about it. Any chance of getting the slider max up to 4 by default?

    Thanks so much for your asset!

    (still crossing my fingers about an URP version or some better transitioning from/to PCSS directional shadows and frustrum shadows - maybe some dithering? )

    I know it may affect performance, but I"d love to use frustrum shadows for close grass blades (contact shadows), PCSS in the middle, and again frustrum shadows with different settings for distant elements.

    Maybe it's a bit of a corner scenario, but who knows? :p (maybe lerping 2 frustrum profiles from near to far?)
     
    tatoforever likes this.
  17. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,366
    @NeatWolf
    The new normal bias algorithm works very similar to the one in Directional Shadows the value represents a geometry (shadow collector) extrusion along meshes normals, and is vertex based (ultra fast).
    It is possible to set FrustumShadows the way you described but I don't think that's what the majority of people want. I can guide you how to do it though (can be easily done with a smoothstep function). Get in our discord channel and I'll tell you how. :D
    PS: Yeah I forgot to add notes about the bias library, done for next version. :cool:
     
    NeatWolf likes this.
  18. NeatWolf

    NeatWolf

    Joined:
    Sep 27, 2013
    Posts:
    924
    Sounds great!
    Having both contact shadows in the Near range and full distant shadows in the Far range sounds pretty dope! (not sure about how should I be interpolating between the Scale on/off tho. Should I lerp scaling from 1 to 0 as well?

    Sure I'm going to have a visit on the Discord channel :)

    I know it may sound weird but... would it be possible in the future to get some more intense/larger blur on the frustrum shadows? I only need it for polygonal grass (a geometry shader) and the corner of a few buildings that are a bit.. too hard to blend with the PCSS ones.
     
  19. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,366
    Its certainly possible to increase the blur iterations of FrustumShadows yes, I will add a note on that.
    Heading to bed, we can discuss live tomorrow on Discord about the smoothstep feature. :)
     
  20. DrInternet

    DrInternet

    Joined:
    Apr 6, 2014
    Posts:
    106
    Hello,

    one year later, this is still an issue. But with frustum shadows this time instead of contact shadows. Also it happens only after build, works fine in editor.

    To reproduce:
    1. Create new project, import NGSS v2
    2. Open frustum shadow scene demo.
    3. Turn on VR and use single pass and OpenVR
    4. Build (x64) and run

    NGSS 2.3.3
    Unity 2019.2.21f1
     
  21. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,366
    Seems like a Unity bug. If it works on editor, it should work on build.
    I will investigate.
     
  22. AlteredPlanets

    AlteredPlanets

    Joined:
    Aug 12, 2013
    Posts:
    455
    is the cached shadows out?
     
  23. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,366
    Not yet.
     
  24. LumaPxxx

    LumaPxxx

    Joined:
    Oct 3, 2010
    Posts:
    340
    hi,@tatoforever.
    is there a way to make Lux plus work with FrustumShadows in deferred path?
    Lux plus wants take control of the deferred shader in graphic setting and FrustumShadows wants the built-in deferred shader.
    without the deferred shader,Lux plus's translucent shader and skin shader will not work properly.
    anyway to solve this?
     
    Last edited: Aug 6, 2020
  25. VirtusH

    VirtusH

    Joined:
    Aug 18, 2015
    Posts:
    95
    Hey, love this asset!

    I've got a similar problem to the guy above me.
    It's my understanding that NGSS is supposed to be compatible with AFS (Advanced Foliage Shaders v5). I tried installing the modded AFS stuff that comes with NGSS but it hasn't helped.

    Frustum shadows don't seem to work if we have the AFS deferred shader override set in Project Settings -> Graphics.
    It's also my understanding that AFS needs that custom shader to support it's deferred translucency.

    As an aside, it seems like we could all really use a standardized upgraded deferred library that all these assets could use for translucency, SSS, etc... I'm not ready to move to the mess that is HDRP yet! :eek:
     
    tatoforever likes this.
  26. LumaPxxx

    LumaPxxx

    Joined:
    Oct 3, 2010
    Posts:
    340
    and ATG (Advanced terrain grass ) support please.
    ATG,AFS,Lux plus,they used same deferred shader because they are same developer and they are very popular in the market.
    i have old NGSS 1.X in my old project and the screen space shadow works with all of them.
    if you can not fix the problem,is that been possible to provide us the old screen shadow for us as a solution?
     
    Last edited: Aug 8, 2020
  27. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,366
    Sorry for the late reply I was all week out (Vacations). :)
    @VirtusH
    In v2.3 I provide a custom library that works with AFS and other shader frameworks that changes internal libraries. Look for them inside the NGSS/Library folder.
    @dongliang28
    Could you please reach me over discord. Send me the Lux files, I can do the changes and we can live test it. Once it work, I will add it to the next update. I think Lux is the only one left. :)
     
  28. LumaPxxx

    LumaPxxx

    Joined:
    Oct 3, 2010
    Posts:
    340
    Hi,i joined the discord and sent the core lux plus file to your support email.
     
    tatoforever likes this.
  29. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,366
    Got it,
    See you there! :)
     
  30. DGordon

    DGordon

    Joined:
    Dec 8, 2013
    Posts:
    649
    Does this work well on most modern mobile devices? If theres a device it doesnt work well with, will it fall back to the default Unity shadows or do something else to handle it gracefully? Meaning ... is there a downside to using this on mobile anywhere I would use the built in unity shadows? If I use this instead of a hard shadow directional light, should I expect it to look better and still perform okay on mobile?

    Thanks so much!

    PS: I own your original ... never had a reason to use it for real, but I do remember it was very nice so hoping to finally use this in something we launch :D.
     
    tatoforever likes this.
  31. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,366
    Hi,
    Yes it works fine on anything that support SM3.0 (metal and GLES3.0) or newer. If the hardware can't handle it, will fall back to hard shadows automatically. Performance depends on quality but NGSS is quite optimized for what it does. And yes, expect it to look way better than Unity shadows! ;)
     
  32. Pheck

    Pheck

    Joined:
    Jul 9, 2009
    Posts:
    225
    Hi!
    I did a compare on the current autolight from 2019.4.8f1 with ngss and saw unity has started to use some new (new to me at least, maybe they are old) functions/macros in their setup. Do you have an eta when NGSS will update again so there is less difference from the built in autolight? This type of thing is just a wrapper to a texture sample in unity, but the code concept supports that it may not always be...
    UNITY_SAMPLE_SCREEN_SHADOW (instead of UNITY_SAMPLE_SHADOW) is an example of what unity is using in their current autolight.

    Thanks, hope your week is going well!
     
    tatoforever likes this.
  33. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,366
    @Pheck
    Yes, im updating to the latest diff in v2.4.
     
    m4d likes this.
  34. Pheck

    Pheck

    Joined:
    Jul 9, 2009
    Posts:
    225
    roger! thanks
     
    tatoforever likes this.
  35. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,366
    @Pheck,
    If you want close to instant answers/support, head to our discord channel. :)
     
    Pheck likes this.
  36. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,079
    I have already reached keywords limitation can you please tell how many keywords this asset use?
     
  37. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,366
    Hi,
    NGSS_FrustumShadows uses 4 shader_feature_local keywords, so it doesn't count in your global one (which are the ones you are running out). However NGSS_Directional uses 3 shader_feature in current version but already patched for the next update as shader_feature_local.
    I suggest to upgrade to Unity 2019.4 and change NGSS_Directional shader_feature into shader_feature_local to get back those keywords. Ain't that much but can save lives if you are close to the limit. :)
     
  38. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,079
    I installed this asset again because of Frustum Shadow to make distance shadow but it looks it doesn't work for me! I use Unity 2018.4 and I installed NGSS for directional lights
     
  39. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,366
    Are you using any custom shader framework? If so, which one?
    Are you on Deferred or Forward rendering?
    Do you have any picture to share?
     
  40. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,079
    I use UBER it seems when I change Build-in shader from Uber to Build-in shader it works. That mean it doesn't work with Uber?
     
  41. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,366
    You need to use the custom UBER libraries provided in the NGSS/Libraries folder
    Copy and replace them in the Uber directory, where they reside.
     
    hopeful likes this.
  42. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    871
    I miss NGSS after switching to URP T_T

    Shadows are fine for environment it mostly just sucks for characters... It's deffinitely better than standard renderer shadows, so i can tolerate it. But man I'd take anything that would let me blur the shadows more DX.
     
    Gooren likes this.
  43. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    332
    Same here, just with HDRP.
     
  44. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,079
    I couldn't make Frustum Shadows to work it always disappear on the camera corners when I rotate camera shadow disappears sooner than the camera rotation
     
  45. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,366
    That's how it works, is screen space based. Data outside the screen won't cast shadows cause is not visible.
     
    ksam2 likes this.
  46. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,366
    Hold it tight, is planned for later this year! :)
     
    m4d likes this.
  47. Darioszka

    Darioszka

    Joined:
    Jan 22, 2015
    Posts:
    12
    Hi
    I would like to bake Ngss shadows to lightmaps in Unity but when bake was done there is no shadow. I'm trying to bake point lights.
    Before baking, shadows were on the scene. Are there some options which I must set?
     
  48. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    871
    That would be fantastic T_T

    Really? I thought HDRP had some manner of better shadow solution. I remember seeing PCSS support.
     
    Gooren likes this.
  49. Zapan15

    Zapan15

    Joined:
    Apr 11, 2011
    Posts:
    186
    We have a problem with PCSS (v2.3.3). We get noise when using small objects like in the screen below. The complete robot arm is ~1x1x1 unity size (e.g. the default unity cube fits into the boundary). When scaling the model larger, e.g. 3 times the shadows are looking nice again (e.g. no noise). Do you have a tipp for us (besides upscaling)?
     
  50. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,366
    @Zapan15,
    Hi, yes rise the amount of test sampling (from 16 to something around 32). It should start to go away.
    Also is important to import your models to the correct scale or shadows could behave wrongly.
    Did you installed the directional libraries (to get the denoiser too)?
    PS: If you are using cad models you can benefit from this asset (it can improve edges by beveling and gives a soldering touch):
    https://assetstore.unity.com/packag...fects/next-gen-screen-space-edge-bevel-173286
    Cheers,