Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

[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,409
    Forgot to remove some dependencies of my game. I've replaced the file with the correct one in my previous post but also attached here in case.
     

    Attached Files:

    atomicjoe and Invertex like this.
  2. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,409
    If you render it to a RT that has a depth bind to it, you can read it or copy it (depending on the platform, Windows = blit to copy it, most consoles you can just read it directly).
    Worth mention that im not reading the depth buffer, im just rendering scene color and depth to temporary RTs and using it. ;)
     
    atomicjoe likes this.
  3. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    OOOOOOoooooohh....
    That's a super neat trick!
    I was under the impression that consoles would behave like PC and force you to blit.
    Do you know if this works on GLES3 and Metal too?
     
  4. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,409
    I've never tried on powerVR (tiled deferred and the likes) GPUs tbh. Give it a go? :D
     
  5. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    I only do PC and GLES3 on the Nvidia Shield, which uses the Tegra like the Switch, but I'll tell you if I find out on other GPUs :)
     
    tatoforever likes this.
  6. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,759
    wow, is it hard to convert this to Single Instance for VR? Depth buffer is very buggy on oculus quest and having this working in VR would be great because I need it to calculate water depth. I'm basically trying to replace the "grabpass" from Unity since it seems to fail a lot in vr
     
  7. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,409
    I don't have a VR device sorry. But this should be compatible with VR, all this script do is set color/depth buffers where the camera will render and set the depth texture globally (to replace _CameraDepthTexture). Maybe I miss a rendertarget argument to be compatible with VR? I'm not sure, will check it out soon. Head to my discord if you want to discuss more about this.
     
  8. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,759
    yeah the problem with VR is that you need to retrieve it per eye. Unity has built-in functions to do that math and they are open source so they should be easily adaptable.
     
    Josh_He likes this.
  9. wilgieseler

    wilgieseler

    Joined:
    Oct 17, 2013
    Posts:
    85
    How's the URP version looking? Haven't been able to buy since I don't use the built-in renderer for projects anymore.
     
  10. Bwacky

    Bwacky

    Joined:
    Nov 2, 2016
    Posts:
    218
    Not looking at all sadly, I've been waiting since last year when I got told it's coming soon and still no info on it :(
     
  11. chaos456

    chaos456

    Joined:
    Aug 22, 2013
    Posts:
    10
    Hi, as a new user to NGSS I got a small question, so if I wanted to add an option to switch NGSS on/off as a performance option (just in case), is there a way to do it for the local component? It seems to work for the directional component but disabling local doesn't seem to fall back to default shadows for local lights.

    If it can't be done this way then it'd be wonderful if a future version supported something like this. Though if it's too complex to implement it's totally understandable. Thank you for reading!
     
  12. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,409
    Hi,
    Unfortunately since NGSS changes internal shader files for local lights, is not possible to fall back to a hard shadows. However you can just reduce the number of samplers to 4 and it will behave as default soft-shadows. NGSS auto detect if the shadows are not supported (Shader Model < 3.0) and falls back to hard shadows.
     
  13. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,409
    You can follow live updates and support about NGSS (including upcoming URP port) in my discord.
    PS: I rarely use the forums, im on discord 24/24 7/7.
     
  14. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    Dude don't you sleep? :p
     
  15. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,409
    When I said 24/24 i meant 48/24! :V :D
     
    hopeful and SammmZ like this.
  16. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,759
    yeah, while in discord lol
     
    atomicjoe likes this.
  17. chaos456

    chaos456

    Joined:
    Aug 22, 2013
    Posts:
    10
    Thank you so much for the help!

    I forgot to add one more bit of a question to my previous post if you wouldn't mind looking into it.
    One of my biggest most far into development projects is stuck in Unity 2019.2 due to big changes in PhysX ruining a lot of mechanics using physics checks. Since NGSS only goes 2019.3 up, it is unfortunate that it's not available for this one project I work on the most.

    Although when importing the package to the project in 2019.2, it seems to work as indended for the most part, only thing that doesn't seem to work at all is essentially the sampler option mentioned for the local component; so in conclusion, local lights are stuck looking like soft shadows.

    No idea how hard this would be to fix or make a quickfix for, it's not a big deal in the end, but it'd be amazing if there was a possible way to make those parameters work. Again thank you for reading!
     
  18. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,409
    Hi,
    The 2019.3 limit was imposed by Unity, you should be able to use the package even on Unity 2017.4. Just import to an empty 2019.3+ project and copy the Psychose Interactive folder into any project Asset/ folder.
    As for local lights, not having parameters to work. First, make sure you have only one instance of NGSS_Local in your scene (you can't have more than one as is a global manager for all local light shadows). Then to change individual softness/shadows type use the Light component shadows strenght and shadows type.
     
  19. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    off topic but I can't wait to play Forgotten Memories! :p
    I have a Silent Hill 2 crave and Blooper Team's remake isn't gonna cut it, I know it.
     
    tatoforever likes this.
  20. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    *Bloober Team (I can't edit on mobile)
     
    tatoforever likes this.
  21. sirleto

    sirleto

    Joined:
    Sep 9, 2019
    Posts:
    151
    Hello Georges Paz,

    i have purchased NGSS2 and have the following problem: i have a scene with deffered camera, a "desert" terrain on ground, some localized high mountains and at end of horizon standard cubemap sky. when i look with the camera on which frustum shadow is attached, towards a directiion that the sun (directional light source) would be aprox visible on screen, i get this strange pattern artifacts on frustum shadow:

    upload_2022-11-1_0-9-14.png

    if i turn away (other direction) the frustum shadows seem to work (more or less well, i am still learning to tune the parameters, not sure if have usual quality / artifacts or anything else unusual).

    have you seen such artifacts, any idea what i should / can do?
    currently it is unuseable to me :-(
     
  22. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    That's called Shadow Acne. Fix it adjusting the Shadows Bias in the Frustum Shadows Script.
     
  23. sirleto

    sirleto

    Joined:
    Sep 9, 2019
    Posts:
    151
    Thanks, but that isnt solving it.

    Shadow Bias 0.0
    upload_2022-11-1_0-31-14.png


    Shadow Bias 1.0
    upload_2022-11-1_0-31-4.png

    All Values in between do also not solve the Problem.

    It happens in Editor (Scene View, with any fov or near or far clipping plane settings) as well as Game View (Camera with any fov and any near or far clipping plane settings.

    This is my scene depth visualized, so the resolution seems fine and not be the reason for these strange banding effects:
    upload_2022-11-1_0-35-38.png
     

    Attached Files:

  24. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    Is this actually happening in the game camera or only in the editor's scene view?
    The scene view in the editor has a variable render depth and can cause depth precision issues.
    If it happens in the in-game camera view, try reducing the maximum render distance.

    edit:
    Oh! and more importantly, try to set a larger close clipping distance: making the camera near distance to low will give lots of depth issues.
     
  25. sirleto

    sirleto

    Joined:
    Sep 9, 2019
    Posts:
    151
    As I wrote above: both. Fixed depth. All already tried.

    I have tried from 0.3 to 10000, to 1000. From 3. The visual Artifact is not changing at all.
     
    tatoforever likes this.
  26. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,409
    That looks like a lack of depht precision, could you please get into my discord so we can take a look at that issue (without spamming the forums thread)? :)
    PS: Discord link on my signature:
     
    sirleto likes this.
  27. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,409
    I think is related to an issue someone else reported last week. If we confirm is the same issue, I will submit an update tonight. If you can get onto my discord so we can quickly test (I know what to do) to double confirm is the same issue.
    Cheers,
     
    sirleto likes this.
  28. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,409
    I can confirm is a bug and it just got fixed.
    I'm also doing other minor improvements to Frustum Shadows, will submit the update in a day or two.
     
    sirleto, hopeful and Lars-Steenhoff like this.
  29. sirleto

    sirleto

    Joined:
    Sep 9, 2019
    Posts:
    151
    Great, thanks for the dedicated time you invested with me, very appreciated!
     
    tatoforever likes this.
  30. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,409
    Just to let you know that i've finish update 2.4.0 which has lot of improvements (performance and QoL).
    Features and Changes:
    - This update has major changes to NGSS, so is important to uninstall NGSS libraries before upgrading to this version
    - Overall improvements to all NGSS shadows, both quality and performance
    - Frustum shadows now fully support both forward and deferred rendering with cascades on or off
    - Removed the frustum shadows clipping pass
    - Removed frustum shadows temporal filtering. Instead a jittering is implemented to leverage projects own temporal filtering
    - Added support for spherical and linear early out for frustum shadows start distance to match directional shadows projection
    - Added multi-blur iterations for frustum shadows, allows more blurry shadows
    - Added frustum shadows resolution change
    - You don't need to install directional libraries for cascaded shadows anymore (still need to install directional libraries for non-cascaded shadows or frustum shadows)
    - Directional denoiser is now applied directly to the screen space shadows (aka cascaded shadows)
    - Added the ability to switch between hard and soft shadows without having to remove NGSS libraries, for all shadows types
    - Bias improvement for point shadows, you can now lower the bias even more (you might need to adjust your bias values if you see artifacts)
    - Shadow screen position moved to the vertex shader, less fragment computations
    - Removed shadow bias button from the installer as it creates issues with shaders that has custom ShadowCaster passes (you can still manually replace the file in the CGIncludes folder if you want)
    - Added namespace PI.NGSS as required by Unity submission guidelines. Make sure to include that namespace if you access NGSS components in your code
    - Updated documentation

    Couple of images (less samplers, smoother shadows and does not require install any directional library):

    Upclose (default settings):

    Upclose (lowest possible settings, cheaper than default Unity shadows, only 8spp):
     
    Last edited: Nov 9, 2022
    Recon03, OCASM, SammmZ and 11 others like this.
  31. sirleto

    sirleto

    Joined:
    Sep 9, 2019
    Posts:
    151
    great work!
    could you please tell for these 3 screenshots which are frustum SSS and which are visible when overwriting unitys defaults.
     
  32. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,409
    None, that's directional shadows, also FrustumShadows does not overwrite anything in Unity. :cool:
    Here's frustum with extra blur:
    upload_2022-11-6_17-51-31.png
    Now downgraded(quarter ress):
    upload_2022-11-6_17-51-55.png
     
  33. SammmZ

    SammmZ

    Joined:
    Aug 13, 2014
    Posts:
    176
    Great work! Excited to put my hands on the new version!
     
    hopeful and tatoforever like this.
  34. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,409
    NGSS v2.4.0 is live on the store!
     
  35. Bwacky

    Bwacky

    Joined:
    Nov 2, 2016
    Posts:
    218
    Cries in craving URP support
    Is URP that much of a pain to get some early version working? Genuinely curious about what the main roadblock is with it. I am scouting the discord almost bi-daily since a year nonstop. Pleas let my suffering end. :oops:
     
    Radivarig and PutridEx like this.
  36. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,409
    Oh man im really sorry, I had to put it aside because i got late on my scheduled with my game, so working non stop on it and only providing support for current NGSS version. But I should be okay sometime by December (Christmas vacations) to finalize port of NGSS on URP.
     
    Recon03, tspk91, Bwacky and 1 other person like this.
  37. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    850
    @tatoforever, great asset and used it again in our AD4 video. Thanks for the great tool and making it so easy to use!
     
    tatoforever likes this.
  38. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,409
    Beautiful,
    I saw all Apollo's parts. Wonder what you will do next? And how you'll use NGSS in your next creations? :D
     
    dsilverthorn likes this.
  39. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    850
    Thank you!
    We are working on ideas, but haven't found one that sticks yet. But we are not going to quit, we are having too much fun! :D
     
    tatoforever likes this.
  40. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,409
    That's the spirit! Keep it up! :cool:
     
    dsilverthorn likes this.
  41. Barliesque

    Barliesque

    Joined:
    Jan 12, 2014
    Posts:
    128
    Hi @tatoforever
    Just wanted to check in to see if there's been any progress on a URP version of NGSS?
     
  42. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,409
    Soon (Christmas) :)
     
    graskovi and Radivarig like this.
  43. Barliesque

    Barliesque

    Joined:
    Jan 12, 2014
    Posts:
    128
    Oh boy! It will be a merry Christmas after all!
     
  44. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,928
    It seems like there's some major issues with the latest versions of this. It used to look the same as Unity's shadows, just blurred.

    Unity shadows and then NGSS defaults. Denoiser on creates a gap on right of brown cubes and between green and brown.
    [Unity] [NGSS]
    001_unity.PNG 001b_ngss.PNG

    Denoiser off shows pixelation clearer:
    001c_ngss_denoiser_off.PNG

    Distance shadows are very blurred, even when all softness is off. Only the denoiser is on.
    [Unity] [NGSS - Shadow softness 0, PCSS off]
    002_unity.PNG 002b_ngss_softness(0)_PCSS(off).PNG


    The Quality Settings option for Shadow Resolution doesn't work.

    Cascades blending doesn't disable. Blending 2 and Softness 0 seems a better quality default.
     
  45. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,409
    Hi,
    There's no gap in the demo scenes, so it might be an old setting you inherited which doesn't behave the same way in the latest version. You need to tweak the denoiser settings. Try default and see how it looks.
    Unity default shadows and NGSS default shadows softness will look different that's for sure, one has a very small kernel size, the other is a lot bigger. You need to tweak the settings to make it look the way you want, it won't look the same by default.
    In any case, if you still have any gap or can't make it look the way you want, you can reach me on discord with a test project and I will make sure any problem/settings issue is fixed.
     
  46. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,928
    There are no inherited settings. It's a new 2022.2 project.

    The demo scene has gaps if you rotate the light.
    1.PNG 1b.PNG

    When I install my old HD I'll have access to some older projects to compare to older versions of NGSS.
     
  47. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,409
    Will look into that.
    Thanks,
     
  48. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,409
    After further investigation, I broke the denoiser in v2.4.1 (in v2.4.0 was fine). Working on a minor patch to fix it, sorry for the inconvenience.
     
    Stardog, Bwacky and hopeful like this.
  49. AlexTuduran

    AlexTuduran

    Joined:
    Nov 26, 2016
    Posts:
    27
    Please prioritize SRP. It's probably not easy, but the "Next Gen" in the name should be next-gen rendering pipeline friendly. :)
     
    JesOb, RichardSim and Junior_Djjr like this.
  50. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,409
    My goal is to make NGSS as core as possible, but since shadows is not part of SRP core library, both URP and HDRP have different implementations, there's no way to support SRP, it's more of a mod for URP/HDRP. If you hav a custom SRP renderer, you can always try to port it, I can provide some extra docs for that.