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
    @thelebaron
    On Visual Studio, right click on the scroll bar and chose "Scroll Bar Options..." then do the same as in this picture (in red):


    PS: Keep this thread about NGSS related posts, don't want to pollute the forum with non-related posts. But you can always PM me any question if not related to thread. :)
    Regards,
     
    brisingre likes this.
  2. thelebaron

    thelebaron

    Joined:
    Jun 2, 2013
    Posts:
    851
    oops sorry & thanks tato
     
    tatoforever likes this.
  3. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    Arkade likes this.
  4. ghiboz

    ghiboz

    Joined:
    Sep 7, 2012
    Posts:
    465
    hi @tatoforever
    I've just purchased your asset.. great job!!

    I can't reach to obtain a good shadow looking: here is my situation:

    this is the light set:


    the camera script:


    and the shadows settings:


    thank you in advance
     
    tatoforever likes this.
  5. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @ghiboz
    Rise your shadows softness (Strength value in your light) way more, this will help hide shadows low resolution aliasing. Can you afford 4 cascades? It will increase the shadows quality way more.
    Btw have you tried turning on/off PCSS filtering and see how it looks? Sometimes people just want uniform soft-shadows everywhere so PCSS shadows is not what they want.
    Next week update improves shadows quality by a very large marge. More performance, stable noise patterns, high depth precision and more samplers per frag for free. It will also let you chose min and max soft shadows for PCSS shadows. Please email support if you want to have early access.
     
    Lex4art, hopeful and brisingre like this.
  6. ghiboz

    ghiboz

    Joined:
    Sep 7, 2012
    Posts:
    465
    thanks for your reply!! I used 2 cascades for performance issues.. try with 4... and how can I turn off PCSS? thanks for the early access, I write the mail ;)
     
  7. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    You can disable it in the shader and cginc, there is a description in the documentation.
     
  8. ghiboz

    ghiboz

    Joined:
    Sep 7, 2012
    Posts:
    465
    thanks, but I'm a bit in trouble: I made these things:

    after for the contact shadows I added these settings:

    but for the PCSS the manual tells this:

    but the .cginc is used on the spotlight shadows, and the shader NGSS_Directional doesn't exists:

    if I import again the package:

    the NGSS_Directional.shader doesn't exists....

    thanks
     
  9. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @ghiboz
    Looks like Unity mixed up files when upgrading. Delete the NGSS folder and install NGSS package again.
    PS: To enable disable NGSS features please follow documentation guidance.
     
  10. ghiboz

    ghiboz

    Joined:
    Sep 7, 2012
    Posts:
    465
    thanks @tatoforever , now the shader appears!!!
    to unuse PCSS I need to comment these lines?
    Code (CSharp):
    1. //#ifndef NGSS_PCSS_FILTER_DIR
    2. //#define NGSS_PCSS_FILTER_DIR
    3. //#endif
    seems a bit better!
     
  11. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @ghiboz
    Well just the one in the middle one but commenting the whole compile conditional does the job too. Disabling PCSS filtering gives you NGSS PCF filtering.
    PS: Next NGSS version, quality is improved for both PCSS and PCF filtering by at least 2-3 times. I've posted few videos in the last two pages.
     
    buttmatrix and ghiboz like this.
  12. ghiboz

    ghiboz

    Joined:
    Sep 7, 2012
    Posts:
    465
    tatoforever likes this.
  13. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    Gentle reminder about SPSR (please!)
     
    tatoforever likes this.
  14. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
  15. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    Hi, just purchased your package to use for directional and contact shadows. I had no problem setting up the directional shadows. They look great.

    My only issue is with the contact shadows. I have added the component to my camera but I cannot enable the NGSS component. The proper shader was added (as in your images above) but when I try to enable the component it simply will not turn on.

    I do use CTS shader for my terrain and Enviro for weather. I am wondering if one of them interferes and if there is something I can do to fix that.

    Thank you.
     
  16. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @Teila
    The only reason it will never turn on is probably because the component can't find the shader to work on. Try this:
    If you've already added the shader to the component, then copy the component (right click on the component name), remove the component and paste the component again in your main camera. Then click on enable the component.
    If still not work, try moving the NGSS folder to a Resources folder and do the same procedure again. This have something to do with Shader.Find where sometimes it returns null, even in the editor.
    PS: NGSS don't need any specific path to work, you can place it anywhere you want. Except when Shader.Find start to act funny you need to move it temporary to the Resources folder. I will try to add a note on documentation for this week update.
     
  17. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    Another tip to workaround the Shader.Find issue is to open the example ContactSahdow scene, copy the ContactShadow component and then go back to your scene and paste it on your camera.
     
  18. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    Okay, I think I know the problem. I have to use the directional light from Enviro and it does not work. I was able to get it all to work as long as I took out the light, which of course sort of defeats the purpose of shadows. lol Oddly, it apears to work fine with the directional shadows.

    Not sure if there is any way to fix this unfortunately.
     
  19. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    Your main directional light (the one casting shadows) that's the light you have to set ContactShadows with. Let me know if you are able to set it up correctly.
     
  20. ghiboz

    ghiboz

    Joined:
    Sep 7, 2012
    Posts:
    465
    i had the same issue, solved forcing the camera to deferred instead to 'use settings' and the script is going enabled
     
    hopeful and tatoforever like this.
  21. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    Thank you so much, ghiboz! That worked.

    My terrain is 100% more beautiful! :)
     
    hopeful likes this.
  22. ghiboz

    ghiboz

    Joined:
    Sep 7, 2012
    Posts:
    465
    you're welcome!! now I wish a shot of your terrain! :)
     
    tatoforever and MarkusGod like this.
  23. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    I will post some. :)
     
    tatoforever likes this.
  24. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    This is early stages of the terrain so not polished at all. Testing Vegetation Studios and using CTS.

    GreenGrasssmall.png DryGrasssmall.png
     
  25. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    Hey! I turned on wind on my Speedtrees and am getting really bad artifacts using the directional shadows. I really love the way they make the forest dark but the foliage looks so bad that I can't really use them at all.

    When I took them off the directional light, I lost even the regular Unity shadows on trees and houses. Anyway to fix that? I did restart unity and no difference. This morning there was a contact shadow around my house which acted just like the ones on the grass and did not stay stationary near the house.

    Any idea how to fix this? If not, can I just use the contact shadows without the directional without losing the unity shadows? Thanks.
     
  26. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    Here are some pictures of the issues I am seeing with wind.

    With Directional and contact shadows enabled. Notice the stretching of the foliage.

    DirectionalNGSS.png

    With no directional NGSS. Notice the leaves look okay, but no shadows at all, not even Unity's. I turned off NGSS under the directional light and removed the buffer.
    NoDirectionalNGSS.png
     
  27. ghiboz

    ghiboz

    Joined:
    Sep 7, 2012
    Posts:
    465
    @tatoforever today is appeared a strange thing, I changed some code not relative to the light and now, if I change the shadow strenght it changes the shadow strenght, like without NGSS, and the shadow is like a Hard shadow.. I tried to deactivate the script and reactivate but is the same, also tried to reimport the asset...
     
  28. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @Teila
    Not sure to understand your problem, if you add wind your foliage stretch too much?
     
    Last edited: Jul 18, 2017
  29. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @ghiboz
    Re-install NGSS (following documentation guidance), close the editor and delete your project cache folder. Then open it again and let me know if it solved?
    PS: Did you changed your platform to Mobile?
     
  30. ghiboz

    ghiboz

    Joined:
    Sep 7, 2012
    Posts:
    465
    i'll try, no, I've removed the directx9
     
    tatoforever likes this.
  31. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    I get stretched shadows as the wind moves the trees which looks really bad. I am still looking at it to see what I can do.
     
  32. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    Can you please post more images close up or videos? Can you email that scene to support, so we can take a look at?
     
    buttmatrix likes this.
  33. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    Or if you can just email the SpeedTree folder with your tree model and assets?
    I'm currently testing a Broadleaf SpeedTree and trying to reproduce your issue. More feedback soon.
    PS: Can you set shadows type to hard-shadows and check if the issue still there? If so then you may probably need to re-generate SpeedTree materials (there's a button in the tree prefab for that).
     
    Last edited: Jul 18, 2017
  34. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    I will post more videos and I can email the speedtree. I will check with hard shadows.

    It may also be a problem with another asset, so will check on that.
     
    tatoforever likes this.
  35. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    Setting it to hard fixed the problem with the tree foliage but it made the shadows on the ground disappear. I do not think the problem is with the Speedtree because it is not the textures stretching, but the shadows stretching. I notice the grass on the contact shadows does that too, stretches a bit too much.

    It is difficult to troubleshoot since after removing NGSS, I no longer have Unity Shadows. Even replacing the directional light with another one does not bring back the shadows but gives me a lot of errors.

    So...could be something else, but short of rebuilding the project, I am not sure how to test it. So putting NGSS in and ignoring the bad shadows on foliage for now so I can move on.

    As for pictures, I posted a couple of them above and close ups do not seem any different. You can see the stretching on the tree. The tree is fine with NGSS off. So not sure I need to send it to you. :)

    Right now, my only issue with NGSS is the inability to take it out of my project without causing issues. I never changed the shader file so that is not the problem. Once in, it seems you cannot take it out.
     
  36. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    If you want your Unity shadows back go to Graphics Menu and set Screen Space Shadows to Built-in. Shadows won't appears till you to hit Play and Stop (this makes Unity refresh internal shadowmaps again).

    Upcoming version of NGSS will replace back default Unity shadows automatically if you disable/remove the NGSS_Directional component.

    As for shadows strech, I'm not experiencing that on my SpeedTrees, would be nice if you can send me one of those trees to inspect.

    PS: Have you tried enabling/disabling ContactShadows and see how it looks? Maybe you need to tweak Contact Shadows settings.
     
    Last edited: Jul 18, 2017
    Seneral likes this.
  37. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    Would contact shadows appear on tree foliage as well? Turning them off or changing settings does very little.

    Not only did I play and hit stop, but I exited Unity and went back in again. :)

    Next time I get errors, I will post them here. Unity is crashing for me now but I am not ready to blame any asset on the crashes yet. Very concerned though as we have a deadline for this project. My fault for trying new things.

    I still love the contact shadows on the grass though. :)
     
  38. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @Teila
    Anything that writes to camera depth produces ContactShadows when the component is enabled.

    NGSS Directional script should not produce any crash, it's just a small CommandBuffer with some light properties.

    PS: If you have the chance to send your SpeedTree file to support, I would love to see it.
    Regards,
     
  39. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    With next update also comes big improvements to ContactShadows.
    Added the possibility to turn on/off noise filter (off now by default) and a shadows bias value to remove screen artifacts some of you guys where experiencing:
     
    Last edited: Jul 19, 2017
    Teila, nxrighthere, Seneral and 3 others like this.
  40. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    Folks NGSS 1.4.5 have been submitted to the Asset Store for review. From release notes in v1.4.5:

    - Improved visuals on both PCF and PCSS Shadows using stabler noise patterns that maps to screen pixels

    - Can now chose min and max softness for PCSS Directional shadows (tweaked on Shader)

    - Ability to chose the amount of banding/noise (Tweaked on Shader)

    - Noise patterns dithering function, converts small dots into little texels mapped to screen pixels (enabled on shader)

    - Improved ContactShadows quality. Ability to turn on/off the noise filter (by default off). Added a bias functionality that removes screen artifacts

    - Added cascade blending in Unity 2017 for Directional Shadows (only when CloseFit projection is enabled).

    - Updated documentation for new features and changes. Please read the documentation.

    Upcoming version will feature more overall performance and quality for all shadows and first iteration of cascade spherical blending for directional shadows. :)

    PS: If you want to give it a go please email support and don't forget your invoice number if it's your first time requesting pre-release. :)
     
    Last edited: Jul 19, 2017
  41. churi24

    churi24

    Joined:
    Sep 17, 2013
    Posts:
    98
    Hi, we are using Unity 2017.2.0b2 and we have a performance problem. Our fps drop down to 30fps o_O
    On the other version, Unity 5.5.3f1, using hard shadows, worked perfect, over 60fps.
    In the scene we only have one light (the candle).
    With the values on this screenshots, on Unity 5.5, works perfect. But here, on Unity 2017, we encounter 2 problems..
    Soft shadow kills our performance and the fps goes down below 30fps. In the other hand, hard shadow doesn't seems to work unless you set up Strenght parameter close to 1, but the shadow is worst than the hard shadow on Unity 5.5.


     
  42. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @churi24
    To the look of your image, rendering cost around the same for soft and hard (1.8 - 2.0 ms) which is where you have to look if soft-shadows are enabled. It's the CPU that is taking too much time (Hard 14.4ms, Soft 33ms). Try to profile more see where the CPU is spending time.
    If you set shadows type to Hard, NGSS then uses Unity hard shadows. Also, when hard shadows are enabled strength value changes shadows opacity, when Soft shadows are enabled strength value changes the shadows overall penumbra size and that's usually where NGSS sits.

    Volumetric lighting is really expensive, make sure you are not cranking the quality too much, or you will run out of bandwidth really quick (even on PC). Try disabling every other effect and profile with just soft-hard shadows and see where the CPU is spending time.
    Shadows are heavy to render, good looking shadows are even heavier. Typical shadows budget in a commercial game are between 5ms and 10ms. This is quite challenging to achieve in Unity as Unity does not provide top of the line shadow optimizations so you have to carefully take care of your scene design to occlude as much light with shadows as you can.
     
    Last edited: Jul 20, 2017
  43. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    Latest NGSS version is live on the store. :)
     
  44. chiapet1021

    chiapet1021

    Joined:
    Jun 5, 2013
    Posts:
    605
    @tatoforever, how's NGSS 2.0 and the custom render loop coming along? I've read that SRPs are getting quite a bit of attention on the development side for 2017.2, but not sure if it's progressed enough for you to feel more confident about implementation and timing yet.
     
  45. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @chiapet1021
    Both are moving forward quite well though right now I'm more focused on having a NGSS 1.x that performs and is visually appealing. I will finish one more major update in NGSS 1.x before getting back 100% on NGSS 2.0/custom renderer. NGSS 1.x will continue have minor bug fixing updates till NGSS 2.0 came out.
    The big NGSS feature besides the new shadows rendering techniques are optimizations. The system will be similar to UE3.0 shadows which separates static and dynamic objects. Dynamic objects will cast ultra soft-but very cheap projected shadows with hard self-shadowing. Using a single RGBA that will split 24bit depth into three 8 bit channels + 8 bit soft shadow masks.
    In one single pass you get very soft projected shadows that are controlled using a real depth buffer.
    We already did this sort of shadowing on our mobile game and runs gazzillions faster than any other combination of soft-shadows (many many times cheaper than any PCF technique) and the cost is exactly the same as rendering one hard shadows.
    Shadows will also get updated only if entities are moving inside light and two atlas will get rendered (one for static objects that will get generated by user any time and one for dynamic objects that will updated when entities are moving wihtin the light frustum). Atlas size will be twekable in a per scene/light fashion so you will have full control of your shadows aliasing.
    They will all play together with baked lighting/shadowmasks.
     
    Last edited: Jul 20, 2017
    ilmario, Cynicat, OCASM and 5 others like this.
  46. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,676
    Thank you, I appreciate this very much. I look forward to 2.0, but I'll need something dependable to use in the meantime. :)
     
    chiapet1021, tatoforever and Teila like this.
  47. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    Should we remove the old version or will it write over it? Thanks. :)
     
  48. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @Teila,
    You can overwrite it but setup still need to be redo for Spot/Point shadows replacement (if you still want those shadows).
    Since v1.4 all shadowing types are independent, they can be installed separately in whatever order you want and you can chose the shadows type you want (eg: only directional, only contactshadows, only spot/point or any combination of those).
     
    Teila likes this.
  49. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    Last edited: Jul 21, 2017
    magique, OCASM, buttmatrix and 2 others like this.
  50. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    ^that mannequin tho lol
     
    tatoforever likes this.