Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    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. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @alternativevisual
    Shadows are more softer like kernel size looks bigger or texel size? Both can produce softer shadows but one will be cause by driver other by Unity.
    ContactShadows breakup when changing rendering path. This is all Unity doing funny things with screen space depth, probably ContactShadows still referencing a null texture (cause the change of rendering path makes the renderer create a new one, hard to know without sources lol). Simple workaround is to hit play/stop, should be good afterwards.

    Your crash on v2018.3 is all Unity, I can put my right hand on fire. :D Pretty sure if you disable NGSS will probably trigger the crash. NGSS on default renderer does absolute nothing weird, not even a RT copy, it only replaces the builtin shadow rendering files.

    LWRP does not support AO but you can do depth based screen effects in LWRP if you enable screen depth (depth pre-pass). At this point you better just stay with builtin pipeline and use builtin deferred path if you are targeting PC.
    Yes, you need to add primitive casters to the scene.

    My future plans on LWRP (besides making NGSS compatible with) is to add semi-spherical shadows and more lights support to it (till SMs blew out), a sort of mini Forward+ renderer with optional light-prepass. Because why not? :cool:
     
    alternativevisual likes this.
  2. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,347
    Very nice results on Desktop.

    On Android I don´t get your plugin to show any changes to the Unity-Shadows.
    I have a simple scene with one directional sunlight only.
    Added NGSS_Directional.cs and nothing more as described in the documentation.
    None of the sliders change anything, except GLOBAL SHADOWS RESOLUTION.
    Tried Vulcan and OpenGLES3, Soft and Hard shadows - nothing.

    Whats wrong?

    EDIT:
    Didn´t read the docs properly and enabled cascaded shadow in the Tier GraphicSettings.
    Works now.
     
    Last edited: Nov 22, 2018
    tatoforever likes this.
  3. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,369
    You should at least ask 2-3x more for your asset. It is way to cheap for the quality and level of support you are giving.

    You might get even more sales as people tend to think that more expensive assets are better in quality.
     
  4. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @Elecman
    You are right. NGSS have been alive for two years now, receiving all kind of minor and major updates including my stellar insta support to users. All this was possibly because of this wonderful community of supportive developers. The next version will cost 2x (30$) but offer lifetime 50% rebate to previous owners licensees. :)
    NGSS is now used by a huge portion of commercial Unity games, including big names such as Rust by Facepunch studios and many undisclosed big titles. :)
     
    Last edited: Nov 26, 2018
  5. FreeReignPublishing

    FreeReignPublishing

    Joined:
    Oct 22, 2017
    Posts:
    52
    Does this support 2d games?
     
  6. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @FreeReignPublishing
    Good question, If your 2D sprites are not drawn in a 2DBuffer and are visible to the light buffers, you can make it work by faking 2D casters with 3D casters and will cast shadows. So the answer is, depends on your workflow and scene setup.

    NGSS 2.0 will support primitive raytraced shadows, this is something quite appealing for both 2D and 3D projects.
     
  7. FreeReignPublishing

    FreeReignPublishing

    Joined:
    Oct 22, 2017
    Posts:
    52
    Could you give me an example on how to do that? and I can’t
    Use NGSS 2.0 because I’m releasing the game I want to use this with next month.
     
  8. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
  9. FreeReignPublishing

    FreeReignPublishing

    Joined:
    Oct 22, 2017
    Posts:
    52
    Thanks for the reply!!
     
    tatoforever likes this.
  10. alternativevisual

    alternativevisual

    Joined:
    Apr 16, 2015
    Posts:
    75
    NGSS v2.0 release date?
     
  11. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @alternativevisual
    We are not too far away from announcing the release date, I'm planning to release either by end of December or debut January 2019.
     
  12. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    I've done the install replacing "C:\Program Files\Unity\Hub\Editor\2018.2.17f1\Editor\Data\CGIncludes\UnityShadowLibrary.cginc"

    And the deleted the project ShaderCache folder. yet none of NGSS slider settings have any effect in the showcase scene?
     
  13. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @Player7
    What are your target platforms?
    Which showcase scene you refer to?
    If you are looking for directional shadows replacement you don't need to install the provides UnityShadowLibrary.cginc.
    Cheers,
     
  14. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    ShowcaseSceneDirectionalLight

    and pc target
     
  15. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    What sliders in the directional light you are talking about? Can you post a video or images?
     
  16. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @Player7
    If you refer to GLOBAL_ properties you have to check the GLOBAL_SETTINGS_OVERRIDE first in order to be handled by the component, otherwise these properties must be tweaked through Unity Editor settings (Quality and Graphics settings) as they affect your project globally.
     
  17. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    Not sure why but I found that while the settings have no immediate effect in the scene, they do apply both in editor scene and game scene after hitting the light on/off button in the scene view..

    which is weird.. any thing I've missed? I tried it in a blank project and the component slider changes are immediate. So something in my setup ain't right for this that I haven't noticed since using this asset.

     
  18. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    I have no idea, do you have any Editor script that manages scripts globally? Maybe some of these scripts are blocking MonoBehavior updates (which is where NGSS_Directional updates its properties). Did you modified the NGSS_Directional script? Do you have scripts compile errors in your project? Look on the editor console.
    Btw, NGSS_TEST_SAMPLERS higher than 32spp won't improve quality, will probably be more harmful than anything else, just in case. Usually between 12 and 24 should be more than enough. :)
     
  19. Zyblade

    Zyblade

    Joined:
    Jul 1, 2014
    Posts:
    140
    I had that "bug", where the slider didn't change anything because I hadn't replaced the cginc file for the correct unity installation. I had multiple unity versions and replaced the file in the wrong one. Another thing I could think of is a version conflict of some new update of unity.
     
  20. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    Yeh I definitely replaced the correct cginc file in the right unity version I'm using, as i said I tried the asset in a new project and that does work, while the main project I was wanting to use this, seems to have some problem blocking it from live component editor updates, so I'm at a loss as to what is causing it because there is no errors.

    Also deleted the temp/ shader folder nothing
     
  21. Zyblade

    Zyblade

    Joined:
    Jul 1, 2014
    Posts:
    140
    Well, if nothing helps, make a new project. Import ngss. Make sure it works. Import 10% of your project, which is causing the error. Import it step by step until 100%. And in between those steps, look if ngss is still working. You'll find out what is causing the issue in that way.
     
  22. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    yeh it's a real hassle, think I'll just leave it for now end up wasting so time on issues like this
     
  23. Simunek

    Simunek

    Joined:
    Jul 15, 2016
    Posts:
    49
    Hi!

    Nice asset, my quetion is: Does it work with the cloud build?

    Also I have read, that you are planning to make it work as scriptable render pipeline. :):rolleyes: So I hope that there will be 3 versions for SD, HD and standard! :);) (I need standard!!!:):););))

    And last note: I did not work and then after 4 houd I realized, that I don't have script on my light :eek: so, please note this in your guide! :) ;):) Thanks!
     
  24. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    779
    Is there a V2 beta? :)
     
  25. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    515
    Latest version on the assetstore doesn't work with 2018.3.0f1, can you please fix this. Thank you very much!
     
  26. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @olavrv
    I'm looking at right now. What's the exact issue you are having?
     
  27. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @olavrv
    I just tested with the latest 2018 beta version and it works fine:
    upload_2018-12-10_12-45-40.png

    upload_2018-12-10_12-45-52.png

    upload_2018-12-10_12-46-46.png

    upload_2018-12-10_12-47-50.png

    Your problem is that you are not replacing the correct UnityShadowLibrary. If you use Unity Hub, make sure you are updating in the correct Unity install, Unity Hub does not install Unity directly on program files. If I recall correctly, by default it does within UnityHub folder. Look for your UnityHub install path and search inside for the installed version you want to work with NGSS, then replace the UnityShadowLibrary file there.

    Default Rendered didn't changed since Unity 2017.3 and I don't think Unity will add anything more to it (at least shadows-wise) so you don't have to worry much about Unity breaking NGSS in the future. Same for Unity 2019, it will work.
     
    Last edited: Dec 10, 2018
    ceebeee likes this.
  28. mehrankan

    mehrankan

    Joined:
    Apr 12, 2015
    Posts:
    61
    Hello, I bought NGSS some months back but have only started to use it right now.
    I wanted to know if NGSS give some hope to the pathetic omni light shadows that unity gives.
    My scene is roughly 700 meters across, lit mainly by a single point light, which is placed at a corner of the scene at a Considerable elevation. I will be having baked Lighting in the scene, but the omni I need for the terrain and the non-statics.
    I have done some tests and NGSS already seems to improve the look of the omni -shadows, but I can't seem to get the shadow softness parameters to work/have any effect.
    Your example scene files seem to work nicely so I reckon I have done the installation process correctly.
    Any ideas on how I can have dat nice softness.
    On a side note, what I do is
    1) Add an omni light to the scene,
    2) Add NGSS directional script to the omni,
    3) Enable globalb settings over-ride, and boom omni light shadows now have less jaggies.
    please do correct me if that's the wrong process here.

    -best
     
  29. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @mehrankan
    Hello and thanks for your kind words. :)
    First, no you don't need to add the NGSS directional script to the onmi/spot light, it's only for directional lights.
    Secondly, the local shadows algorithm is not made to work with such extreme distances (only Directional one). After all we are talking about local lights (lamps, bulbs, etc) not sun/moon light right? Technically* it should work but is not guaranteed and it's the first time I heard about a local light casting 700metters shadows. Not sure exactly what's your setup but the image that came to my head was an atomic bomb, I know it sounds funny (bright omni light for such large distance must be a huge explosion). :D
    I think the best to do is to hit me through support email with a small project with something that is similar to your current scene setup (or maybe small portion of your scene) and let me/do try couple of things on my end cause this setup is quite peculiar. Who knows, maybe I can do some custom hacks within NGSS that will satisfy your needs. It won't necessary be correct with small local lights but helps you in your particular case (extreme large point light distances).
    Let me know if that sounds good to ya? :)
    Regards,
     
  30. mehrankan

    mehrankan

    Joined:
    Apr 12, 2015
    Posts:
    61
    haha, naah it's not an atomic bomb, think more like a small sun.
    I am working in vr btw so it's a first person perspective scenario.
    And yes I will try to send you a set-up soon. watch out for the PM.
     
    Last edited: Dec 13, 2018
    tatoforever likes this.
  31. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @mehrankan
    I forgot to mention that for local lights, you require to replace UnityShadowLibrary.cginc file (located inside Data/CGIncludes/ folder of the Unity version you are working on) with the one provided by NGSS. Did you followed the install instructions described in the documentation?
     
  32. Kolyasisan

    Kolyasisan

    Joined:
    Feb 2, 2015
    Posts:
    397
    Hello, I wanted to ask for your opinion on one matter.

    I am currently making a shadowmap baking solution like in Fast Racing Neo. On the start of the scene I bake all the shadows from the static objects into a rendertexture, leaving truly dynamic shadows to be rendered for dynamic objects only.

    Then I plan to have a custom sampler that would sample the rendertexture and calculate additional shadow attenuation multipler, effectively reducing the cost of rendering objects into shadowmaps.

    Now, I am curious why so many games don't use this technique, not counting the dynamic nature of the light and scene bounds as reasons. Can it be because of performance overhead?

    I know that profiling is everything, but I am very curious how expensive the process of sampling a rendertexture for shadowmapping and calculating the attenuation really is.
     
  33. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @Kolyasisan
    The short answer is, in general we always tends to chose simpler and wider (or more general) solutions if it gives us an acceptable performance instead of harder specific rigid solutions that gives us a bit more performance but less flexibility.
    The reason why many games don't use that technique is that sometimes your bottleneck is not your CPU (issuing draw calls), it's your GPU bandwidth (sampling and resampling over and over) which is the case for advanced shadowmaping techniques. In those cases, we won't waste time building such a system as it won't help us with the main problem which is GPU. Plus hardware GPU instancing is becoming a modern thing and new graphics APIs allows us to save lot of drawcalls. In other words, laziness and new functionalities of modern graphics APIs. :D
    In my opinion game engines should give players the choice of pre-baking static depthmaps for static objects and combine them with dynamic depthmaps and this is something I discussed with Sebastien Lagarde (can't remember the specific thread but it's on the public forums). Still, the filtering still must be done for the final shadowmap using the depthmap combination at runtime. I think since Unity added shadowmaks (which is a lot faster than but different technique than depthmaps combination) they lose interest in the depthmap combination. Not sure if still planned for Unity, gotta ask Sebastien about it, maybe who knows.
    The depthmap (static & dynamic) combination is something I'm adding in v2 of NGSS (not initial release though).
     
    Last edited: Dec 13, 2018
    Kolyasisan likes this.
  34. Kolyasisan

    Kolyasisan

    Joined:
    Feb 2, 2015
    Posts:
    397
    I somehow seriously doubt that rendering depth maps is that cheap on GPU and that it all boils down to CPU bottlenecking with drawcalls issues. I did numerous tests with various situations and I can clearly see that generating depthmap for something is really taxing on GPU. Still, I wonder now if it'll be faster than blending of static and dynamic shadows...
     
  35. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    I'm not saying all boils down to CPU. It always depends on scene type and use case. You probably misunderstood me, I was kinda agreeing with you that in some cases you will benefit for rendering (in the same depthmap) static objects once and dynamic objects on every frame (or each X frames). However the combination of static and dynamic shadows maps must happen on the same depthmap (in a sort of shadowmap atlas), otherwise you will lose all the benefits cause you risk missing cache and other driver optimizations (plus creating multiple depthmaps and all that stuff).
    So to answer your question, it will be faster if you are rendering on the same depthmap and your static amount of objects is very huge. The downside of it is that it doubles your samplers per pixels when rendering the shadowmap (once for static and once for dynamic) and if you are doing advanced filtering like any modern game you will be hit very hard and eat all your GPU bandwidth.
     
    Kolyasisan likes this.
  36. Kolyasisan

    Kolyasisan

    Joined:
    Feb 2, 2015
    Posts:
    397
    Thanks for clarification.
     
    tatoforever likes this.
  37. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    395
    Enighten and the progressive Lightmapper in Unity can both bake shadows for static objects, so I wouldn't say it's novel or rarely used. probably many use it without even realizing.
     
  38. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @ceebeee
    The technique Kolyasisan meant was not the bake of final shadows, but the bake of static objects in the depthmap (which still need to be decoded as any regular shadows). The one you mentioned is faster because we are only reading the final shadows value from a shadowmask (no need to compare depths against receiver) but also can lead to shadows inconsistencies if the filtering is different from the encoded shadows in the mask.
     
  39. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    395
    I see, I never heard of that. I always understood the depth map is generated in realtime by the camera.
     
  40. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @ceebeee
    Yes is possible to pre-bake static mesh depths into a RT and reuse it later on many times. But it has couple of drawbacks. More memory, more fragmentation, cache miss in some cases (large kernels), couple of dynamic branches to combine static with dynamic depths, etc. The use case must be justified (way too many static objects) or you won't see any real benefits, it could be worse in some cases. Shadowmasking is a cheaper way to bake static shadows and is many many times faster than this.
    I talked with Sebastien back and fort about multiple ways of doing this technique, I will poke him out again as it seems there's a way to render both static and dynamic objects into one single depthmap (maybe he though about the same shadowmap atlas which is what I suggested to Kolysistan) but for the sake of clarity. :)
    I've plans for this feature but just not yet, after initial v2 is out i will come back to it.
     
    Last edited: Dec 15, 2018
    ceebeee likes this.
  41. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    Unity v2018.3 is live and in case you where wondering NGSS 1.9.6 was thoughtfully tested on it. If you encounter any issue (specially with local shadows) make sure you are installing NGSS local shadows library in the correct CGIncludes folder as it looks to be inside UnityHub/Unityversion/Data/CGIncludes (instead of regular program files Unity etc...)

    Still working on finalizing initial v2.0 so, keep calm and make great games while I'm finishing it! :)
     
  42. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    @tatoforever I just installed the latest version here and it does not seem to work in the editor as can be seen in the image. This is 2018.3.0.f2 targeting Android. Demo scene was unchanged.

    upload_2018-12-20_12-54-22.png

    upload_2018-12-20_12-53-57.png

    Update:
    It looks like it has started working somewhat but seems a little hit and miss. eg. Changing settings seems to not really show any visible change.
    Also, just built and it was working ok on device also.
     
    Last edited: Dec 20, 2018
  43. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @Baraff
    Please enable Cascaded Shadows in your Graphics Settings (Android Tab).
     
  44. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    Ah.... Yes. That made a difference. Thanks..
     
  45. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    @tatoforever I did a build after that change and it is visually working now which is good but it did kill the FPS.. Went from 30 fps down to 16 fps. So I guess I have a lot of tweaking to do yet.
     
    Last edited: Dec 20, 2018
  46. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @Baraff,
    Sorry for the late reply, for some reason UnityForums didn't notified me through email about new replies. It does this from time to time. :oops:
    Anyways, for mobile go to the lowest possible settings, low sampling, low ress, fewer cascades, etc. In version 2.0 you will have a performance boost as shadows will look prettier without any extra performance cost. On top of that I made a specific mobile first directional shadows that don't require screen space mask nor cascaded shadows, very fast. You should get back to your 30fps easily. Can you please hit me through support in case you want to give v2.0 a try before it gets out? ;)

    @Folks,
    Starting from v2.0, a new Setup Wizard for all NGSS file installs. Yes there's new files on top of the regular UnityShadowLibrary eg new mobile shadows, the new denoiser, primitive shadows, etc. No more digging through where you installed some specific version of Unity (UnityHub hidden Editor installs). It will be the central menu for all incoming wizard, setups and editor scripts.
    upload_2018-12-28_14-42-13.png

    PS: Merry Christmas and happy new year in advance! NGSS 2.0 is near the corner! :)
     
    Flurgle, hopeful, ceebeee and 5 others like this.
  47. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    779
    That will be very useful @tatoforever but might be best to put the wizard in the Tools menu instead of its own top-level menu. Getting crowded up there.
     
  48. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    Moved to Tools/Psychose Interactive/
    PS: This tool also removes your Project ShaderCache folder and gently askyou to restart the Editor to apply changes. ;)
     
    Last edited: Dec 29, 2018
  49. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    Small tool to install/uninstall upcoming internal shadow rendering files of NGSS 2.0:
     
  50. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Any update / change list for version 2.0? How much will it be for the upgrade?
     
    Flurgle likes this.