Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

[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. Kinami37

    Kinami37

    Joined:
    Jun 12, 2016
    Posts:
    7
    Hey I have a very weird issue, is there a way to contact you via discord?

    The issue is basically, sometimes when I start unity and the scene loads i have 0.1 fps because of the NGSS script.

    If i disable shadows its normal.
    If i delete the directional light with the NGSS script and create a new dir-light, its normal.

    If I the nadd the NGSS script again, fps back to 0.1.

    Running on a gtx 1080.

    Making a new scene fixes it, but its still very weird.

    /edit

    seems to be related to Mega Shadow res in NGSS
     
  2. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,011
    When you trigger the slowdown, are you able to profile and find where it comes in the NGSS script?
    What happen if you create a new scene and move your hierarchy objects to there. Does it happens again?
    What version of Unity do you have?
    Do you have any compile errors in the console?
    This is new and probably Unity doing funny stuff.
     
  3. marcrem

    marcrem

    Joined:
    Oct 13, 2016
    Posts:
    178
    I cannot just use one cookie texture to drop a pre-made shadow on my ground, it needs to be the shadow of the exact cloud that's in the sky. We're making a storm chasing game, sky realism is super important
     
  4. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,011
    In that case you have to push back the distance of your directional shadows and then try to adjust the ray settings so the remaining distance (at screen space) between your clouds and the ground can be filled by the FrustumShadows.
     
  5. marcrem

    marcrem

    Joined:
    Oct 13, 2016
    Posts:
    178
    So basically increase shadow distance in quality settings, then compensate the loss of quality by using the frustrum shadows for details?
     
  6. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,011
    Kinda yeah, increasing the shadow distance (Quality Settings) will increase the shadowmap texel size which can introduce more aliasing but NGSS is there for that reason (remove aliasing with various shadows filtering). And from there display FrustrumShadows. This might not solve your problem completly but still 10x better than trying to covert 5KM distance with only shadowmap (ugly shadows and really hard on your CPU).
    Give it a go and let me know how it goes.
     
  7. KokkuHub

    KokkuHub

    Joined:
    Feb 15, 2018
    Posts:
    221
    Usually games do cloud shadows with a light cookie instead of casting actual shadows. If your clouds are dynamic, you can make a dynamic cookie by using a second camera that render only the clouds using a black material against a white background via shader replacement.
     
  8. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,011
    That sounds a bit expensive. The best thing to do (performance-wise) is to project and sample a cloud texture using a matrix constructed from the directional light, directly into the shader and multiply it by the shadows attenuation (making it part of the shadows).
    With this method cookie shadows won't follow sky clouds but is fast. The method you described is one step before this one in case you are looking for cookies that follows the sky (instead of sampling the cookie, you sample the rendered clouds).
     
    Last edited: Dec 30, 2019
  9. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    415
    Purchased 2.0 today. Long time 1.0 Customer. Finally got some time to try and get my large project updated to 2018.2.0 from 5.6.3 What a NIGHTMARE. Not your asset... just all of them combined. lol. Whew!

    I removed the old GCIncludes file, Deleted the old NGSS folder int he assets folder. Deleted the ShaderCache Folder and then imported the new NGSS 2 that I just got today.

    Its still giving me this warning. Any help would be great. I loved the old NGSS 1 for years in my old project and would love to use it again. Thanks for all that you do.

    Assets/Psychose Interactive/NGSS/Scripts/NGSS_FrustumShadows.cs(43,6): error CS0246: The type or namespace name `Min' could not be found. Are you missing an assembly reference?
     
    tatoforever likes this.
  10. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,011
    Awesome!
    Yeah, please comment out that faulty line, looks like Unity removed it on 2018s. That line is just an attribute to avoid people having a negative value on that property. I've already patched that for the next update.
    Let me know how it goes and post few screens of your updated project! :)
     
    devotid likes this.
  11. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    415
    Will do. Thanks very much.

    Heres the game with NGSS 1 on 5.6.3 (lighting was built a year ago) https://store.steampowered.com/app/598980/The_Coin_Game/

    I have a couple days of free time so I am pondering if the upgrade of unity is worth it for my customers.

    Ill pop back in with some pics from NGSS 2 on 2018.2. I only updated to get some new weather effects and a better 24 Hours day to night cycle. This plugin helps so much with realtime lighting. I upgraded the project and had forgot about NGSS. I thought to myself "What the hell happened to the shadows?". haha.

    Thanks for the prompt service. Ill make sure to post a review. :)

    Kevin
     
    tatoforever likes this.
  12. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    415
    Prob a dumb question...but do I need to add the Local Point light script to every point light on NGSS 2? I have about 500 lights in this scene. haha. 90% of the lights are just baked and not on at runtime but I thought the shadows baked much better with NGSS as opposed to to using Unity default lights.

    I am familiar with the directional lights setup but on the old one I thought it was automatic on the point lights. Thank you for clarifying.

    Kevin
     
  13. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,011
    No,
    Only your main local light (or at least one in your scene) should contain the NGSS_Local script. The rest of your lights can be tweaked the same way as NGSS 1.x (Strength and Shadows type for softness and filters type).
    PS: With the next version I will redo a new tutorial and put this very upfront and clear. Many people think that they need to add the script every where and no, it was just me doing funny stuff in the initial tutorial video. :V
     
    devotid likes this.
  14. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    415
    Ok. I didnt watch the tutorial video. I only read the documentation.

    4 - If everything went fine you can restart the Editor in normal mode (not Admin) but before restarting the Editor add the NGSS_Directional component to your directional light and the NGSS_Local component to your spot/point lights, so when you get back after restart, internal shadow libraries are being properly feed by these components.

    I also closed my project too early and had to restart it again as it says "If everything went fine you can restart the Editor in normal mode" So I closed it only to read on a bit more and had to reopen two more times. haha.

    Maybe just reword the step 4 with the part about only needed one light to control global settings. Other than that I am amazed so far. Thank you.

    Kevin
     
    tatoforever likes this.
  15. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,011
    Yes,
    Both the documentation and a new tutorial video will clarify that in the next version. :)
     
    devotid likes this.
  16. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    415
    Ok Last question.... Is there still shadows on Terrain grass? I dont see any.
     
  17. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,011
    What kind of shadows? FrustumShadows or Shadowmaps? Do you have vegetation studio btw?
     
  18. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,011
    Shadows on grass depends on your terrain/grass shaders and if you are using FrustumShadows keep in mind that it only support Deferred right now.
     
  19. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    415
    No veg studio. Default unity grass. NGSS 1 had a script to drag onto the camera that took care of it.

    I am using deferred lighting

    Im just looking for realtime shadows. I dont know what Frustum shadows even are yet. Im not using them yet. Its a standalone PC game... should I enable them?

    I have not baked the scene yet. As I thought shadow maps are from the baked data.

    Thanks

    Kevin
     
  20. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,011
    What happen if you remove NGSS? Because having shadows or not is kinda a renderer/shader problem (terrain shader doesn't implements any shadows attenuation or grass are not being rendered into the shadowmap), not really NGSS.
    As for FrustumShadows you want to enabled it only if you want really fine shadow details and/or very large view distances of accurate shadows.
     
    devotid likes this.
  21. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,011
    @devotid,
    Did you managed to get shadows showing? :)

    PS: Btw, happy new year to everyone! :cool:
     
  22. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    415
    I think I got it. haha.

    I dont have shadows on the grass yet. Not too worried about it. This is the first time I have "turned on" the lights in the world. The game was developed with a constant night time vibe and now i am switching to a full day night cycle. SOOO much to decide what stays and what goes away. lol

    But the NGSS 2 shadows look great on the Directional Light with Enviro. Ill post more when I get more into the Point Lights.

    Happy New Year to you too!

    20191231224808_1.jpg

    20191231225950_1.jpg
     
    tatoforever likes this.
  23. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,011
    @devotid,
    If you can give me access to your game or a test example I can debug it for you and tell you why your grass aren't displayin shadows.
    Poke me through support email. ;)
     
  24. marcrem

    marcrem

    Joined:
    Oct 13, 2016
    Posts:
    178
    Hi,

    here's what I'm getting when trying to do a build, since I added NGSS
    errorr.png

    Not sure what I'm supposed to do now :(
     
  25. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,011
    @marcrem
    Try to make your shaders SM5.0 instead of SM4.0. Looks like you are hitting the limit with such complex shader.
    You can ignore the NGSS warning, that's the way it should work (by using the most recent value of j).
     
  26. marcrem

    marcrem

    Joined:
    Oct 13, 2016
    Posts:
    178
    Why does it suddenly reaches a limit, while before it worked just fine? And how do I make them SM5.0?
    Thanks.
     
  27. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,011
    Because your shader was probably on the limit before NGSS and NGSS adds to the instruction count = so it blew out. If you make it SM5.0 that should solve the issue.
    Normally, you open the shaders having the issue and near the top where just after the shader properties where all the #pragmas are defined you will probably see something like #pragma target 3.0, 4.0 or 5.0. If no #pragma target is defined then it default to SM3.0 which is probably why you are reaching the limit so fast. If it's already defined to 5.0 you'll need to lower your shader complexity or reduce the number of samplers in NGSS lights (if the sampling count is way too high).
    What are the quality settings of your NGSS Directional and Local lights?
     
  28. Janoooba

    Janoooba

    Joined:
    Feb 9, 2016
    Posts:
    32
    I've got a spotlight with range of about 120, but it's shadows are extremely grainy. It looks like the denoiser isn't working at all with this. Point lights and directional lights work just fine. Is this just a limitation of NGSS?

     
  29. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,011
    @Kmeier,
    Denoiser only works with Directional lights. If you want to reduce the noise rise the sampling count of your spot light in the Global Settings or try set the NoiseToDitheringScale to 1.
     
  30. Janoooba

    Janoooba

    Joined:
    Feb 9, 2016
    Posts:
    32
    Damn. Is this something in the works, or limitation of Unity? Upping the sampling test and filter do help, but not enough to be passable at these ranges I don't think. I was hoping to have some very dramatic spotlights in my game, but this puts a damper on that. Is there any way to switch to the old default Unity way just for certain lights?
     
  31. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,011
    No you can't have Unity and NGSS shadows, it's either one or the other. However, you can reduce the sampling and the softness of your shadows and you'll have something similar to default Unity shadows. Or simply remove the NGSS libraries.
    The Denoiser will get applied to all shadows type once I fully port NGSS to SRPs.
     
  32. tavovallejo

    tavovallejo

    Joined:
    Nov 22, 2014
    Posts:
    26
    how do i use contact shadows on spot light, i need some detail and i can go to HDRP right now.
     
  33. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,011
    Local lights with FrustumShadows is not officially supported (yet) but will be in the next version (v2.3). You can do it right now (drop your Spot Light in the Main Light property) but there's no shadows fall off and they will leak outside light range, it will look weird but it lets you preview the effect. In the next version you'll be able to do as in UE4, either local or directional (one at time) and with a nice blend and falloff.
     
    tavovallejo likes this.
  34. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    805
    Hi,

    I use Unity 2019.2.17f1 currently. For baking and sampling diffuse ambient lighting, I want to use standard Unity point lights.

    Additionally to changed:
    void UnityDeferredCalculateLightParams (

    atten *= tex2D(_LightTextureB0, att.rr).r;
    to my own texture
    atten *= tex2D(_LightTextureSpot, att.rr).r;

    This is all only for the ambient baking lights, and performance is not required.

    My questions:
    1) Do you change the UnityDeferredLibrary.cginc as well?
    2) Does your asset have an option for smoother light-fall-of like UE4-isf ? eg Another clever LightTextureB0 texture?
    did you have some experience with?

    Spotlight-Comparisons.png

    Unity is so ugly in this case. o_O

    3) Would it possible to have an mega extremely wide and soft shadows for point lights directly from position of the light? (rg. not only after 20m distance) So in this case to spread the shadow extremely wide, and passing the denoiser several times over to have a wider and softer shadow spread. Is there any change to hack this a bit by script or shader? Think about that performance is not the matter in this case.

    I really like to buy your asset.

    Thank you..
     
  35. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,011
    Hi,
    - The denoiser doesn't work on local lights, it will work with all lights on SRP versions in the future
    - Yes NGSS library contains a moddified UnityDeferredLibrary.cginc
    And finally, better light falloff have been asked by users for sometime now and they are coming in the next version (v2.3) :)
     
    Lars-Steenhoff, hopeful and Stardog like this.
  36. tavovallejo

    tavovallejo

    Joined:
    Nov 22, 2014
    Posts:
    26
    I found out that UBER deferred is not compatible with NGSS so I had to use the build in shader for deferred to make FrustumShadows work, its fine since I’m not using 100% UBER, I’m just using glitter and tessellation.
     
  37. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,011
    Hi,
    If assets make changes to UnityDeferredLibrary.cginc or provide their own copy/version of UnityDeferredLibrary.cginc (or any library used by NGSS) then yes, it requires a merge or tweaks in order to make it work.
     
    tavovallejo likes this.
  38. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    805
    That means, for my PC/XBOX project (one SRP, HDRP, URP) :
    * I can use only one directional light with soft shadows?
    * Does the new falloff works with the legacy renderer?
    * Btw, what time line you peek for V2.3?
     
  39. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,011
    With NGSS all your directional lights will have soft-shadows but only one have denoiser (the first one).
    The new falloff will work with NGSS built-in version and with future SRP versions too. HDRP and URP versions will have parity features but also new optimizations and features that aren't available due to the black boxed nature of built-in renderer.
    Version 2.3 will come in a couple of weeks.
     
  40. Rich_A

    Rich_A

    Joined:
    Nov 22, 2016
    Posts:
    253
    Something in this asset is overriding my quality settings for shadow distance and cascades. Any way to stop this? Do I have to hunt through the game and find the gameobject light with the script that is doing this?
     
  41. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,011
    Hi,
    This was removed a couple of major versions back. If I remember correctly since v2.1 NGSS doesn't change neither the shadow distance nor the cascade count, you can double check it by editing the NGSS_Directional script, you will see that nothing changes neither of those values. You might want to look on some other assets that are changing these values in your Quality Settings.
    PS: Make sure you have the latest version of the store.
     
    Last edited: Jan 14, 2020
  42. Rich_A

    Rich_A

    Joined:
    Nov 22, 2016
    Posts:
    253
    I'm on 2.08. Is there is an upgrade guide? I can't see anything in the documentation PDF (you should host the documentation online somewhere to avoid it becoming out of date) or on the first post of this forum.
     
  43. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,011
    @Rich_A,
    You can safely upgrade to v2.2.5.
     
  44. Rich_A

    Rich_A

    Joined:
    Nov 22, 2016
    Posts:
    253
    Is this just by downloading NGSS from the asset store and replacing all the Psychose interactive files in the project? Do I need to replace those manual shaders using the wizard?
     
  45. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,011
    Just download the latest version and proceed to install the same way you did for v2.0.8 (using the wizard with Unity on Admin mode). The documentation is also updated in v2.2.5.
     
    Rich_A likes this.
  46. unity_dev3194

    unity_dev3194

    Joined:
    Apr 17, 2017
    Posts:
    61
    @tatoforever Are frustum shadows limited to deferred rendering? My project is restricted to forward for performance reasons.

    Edit: Just saw that forward frustum shadows are WIP, meant to be released this month. Any ETA on the update? Thanks for the wonderful work.
     
    tatoforever likes this.
  47. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,011
    @unity_dev3194,
    Yes, FrustumShadows Forward support is coming in the next update.
    Can't say exactly how long, I'm super busy splitting my time on SRP ports and new upcoming features.
    Thankyou for your patience! :)
     
    Lars-Steenhoff and unity_dev3194 like this.
  48. Rich_A

    Rich_A

    Joined:
    Nov 22, 2016
    Posts:
    253
    You neglected to mention, according to your documentation (which still needs to be hosted online, not as an embedded PDF) that I need to uninstall the old shaders first.

    Now I've broken my project, and manual replacement of shaders is not working. I'm getting this error:
    "Assets/Psychose Interactive/NGSS/Scripts/NGSS_FrustumShadows.cs(43,6): error CS0246: The type or namespace name `Min' could not be found. Are you missing an assembly reference?" and the Tools menu is not showing up.

    Update: I've tried opening the project in a new Unity verson (the latest 2017 LTS) but this console error is still appearing.

    I think you need to rewrite the Update section of the documentation to make it significantly clearer what to do, and separate it out from the install section.
     
    Last edited: Jan 17, 2020
  49. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,011
    @Rich_A
    You don't need to delete the OLD shaders. That only applies when upgrading from the old v1.x. With 2.x versions you just upgrade the package and use the wizard tool to install/uninstall the libraries.
    As for the Min attribute, this was something that Unity itself removed from their namespaces and I forgot to remove it. You can comment out the Min attribute in the FrustrumShadows, it's already fixed for the next update.
     
    Rich_A likes this.
  50. Rich_A

    Rich_A

    Joined:
    Nov 22, 2016
    Posts:
    253
    Forecast date for next update?
     
    Gooren and hellstorm like this.
unityunity