Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    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,337
    @claudius_I
    Yeah based on your images, you need to tweak the ContactShadows settings (and if you don't need it at all just remove it). Also, shadow settings it's hard to get a default preset as every project has different needs and different mesh sizes, scene scales etc which make default settings sometimes "wrong". The default recommended settings are tailored for the included example scenes but it's always a case of "by hand" tweaks till you get the look and feel that you want.
     
  2. tri-stratos

    tri-stratos

    Joined:
    Jan 29, 2013
    Posts:
    152
    @tatoforever
    I am attaching the settings for quality/camera/scene/light respectively (btw DX11 in player settings)

    I have also uploaded below some videos captured from my mobile, so excuse bad quality.
    Still the shifting effect is visible in all cases.
    1) BUG_GameCameraRotation (rotating-actually happens also with moving) the main camera in Game view)
    https://www.dropbox.com/s/9gc7mwftkvoaiyk/NGSS_BUG_GameCameraRotation.mp4?dl=0

    2) BUG_SceneLightRotation (rotating the light in Scene view)
    https://www.dropbox.com/s/18fyz3wiy7z88jy/NGSS_BUG_SceneLightRotation.mp4?dl=0

    3) BUG_SceneViewRotation (rotating viewport in Scene view)
    https://www.dropbox.com/s/6vx1o5ibp79x4a8/NGSS_BUG_SceneViewRotation.mp4?dl=0

    Please let me know if this is a bug that needs to be hunted out, or a setting that is not set correct for some reason.
     

    Attached Files:

    tatoforever likes this.
  3. alternativevisual

    alternativevisual

    Joined:
    Apr 16, 2015
    Posts:
    75
  4. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,630
    All kinds of strange things can happen in a Unity beta. Lots of engine bugs in those, and on that one it is way too early for plugin developers to try to investigate it and make fixes. Better to wait until it is released.

    2017.2 was officially released weeks ago, and I have been waiting for a Unity patch to fix a particular regression so I can use it. Fortunately the patch I need just arrived. ;)
     
  5. alternativevisual

    alternativevisual

    Joined:
    Apr 16, 2015
    Posts:
    75
    I know, just warned about this issue ;)
     
    hopeful likes this.
  6. Deleted User

    Deleted User

    Guest

    Hi, we are using this plugin but we have encountered really long build times for our asset bundles. It looks like unity goes and rebuilds all shader cache every time we build asset bundles. I taught it would only do it once and then keep using the cache but it seems like it rebuilds the cache every build. Is this a common issue or something on our side?
    We are using 2017.2 btw.
     
    Flurgle likes this.
  7. Flurgle

    Flurgle

    Joined:
    May 16, 2016
    Posts:
    389
    Same here, it gets stuck on "packaging assets - sharedassets0.assets", then has an error first time every build. Second time works fine.

    Version is 2017.2
     
  8. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    @N3ON47
    Yeah, Unity already broke cascade blending in v2017. 1. In v 2017.2/3 it looks to be a lot more broken. I'm looking for a way to completely replace their default cascade blending. Hopefully they fix it by the mean time. At least cascade blending as they where in v5.6.

    @Nikodem, @Flurgle
    Unity only rebuilds shader cache when there new shaders added to the project (for that given shader) or when the shader cache folder gets deleted. If you see Unity rebuilding cache over and over you probably want to report bug that to Unity.
     
    Last edited: Nov 9, 2017
    alternativevisual likes this.
  9. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    @tri-stratos,


    Try making your light Dynamic or Mixed otherwise the renderer won't update shadowmaps and ContactShadows needs shadowmaps to work.
     
  10. alternativevisual

    alternativevisual

    Joined:
    Apr 16, 2015
    Posts:
    75
    Hello there. I have some questions.
    Can shadowmask be forced to cast shadows from static to dynamic objects? :confused:
    And when Unity fix these issues (will it? :oops:), will low quality close fit shadows looks beatiful? :rolleyes:
    Thank you. :)
     

    Attached Files:

  11. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    No,
    Static object shadows are only baked and blended with dynamic shadows but not casted onto dynamic objects. And it's not a NGSS limitation, it's Unity default renderer that works like that.
    NGSS 2.0 will provide ways to bake static shadows and cast onto dynamic objects though. ;)
     
    Last edited: Nov 9, 2017
    alternativevisual likes this.
  12. ThisGuyThatsHere

    ThisGuyThatsHere

    Joined:
    May 4, 2016
    Posts:
    11
    Hey, it may have already been asked, but is there a way to change shadows strength? I mean, I know it's not possible through the editor since it changes penumbra size, but somewhere in the .cginc maybe?
     
  13. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    You can do that by changing a couple of lines on the .cginc file (just before returning the shadow value) but it will be the same opacity for all your lights. Keep in mind that this code runs for every setPass and properties are set on the fly. In other words, I don't have access to light indexes to be able to identify each light property and set them separately. Pretty much like using default standard shader, you have plenty of objects using it with different properties etc, but if you change something on the shader it will affect everyone using the standard shader. Kinda similar idea.

    With directional shadows it's a bit different because we mostly only have one of those on every scene. So setting stuff globally on them won't matter much.
    In NGSS 2.0 you will be able to change both shadow soft-ness and opacity on all lights and what's better it's directly on your own light. No additional script or anything else. ;)
     
    Last edited: Nov 9, 2017
    alternativevisual and Lex4art like this.
  14. tri-stratos

    tri-stratos

    Joined:
    Jan 29, 2013
    Posts:
    152
    @tatoforever
    Unfortunately, none of the 3 availabe light options (realtime/mixed nor Bake) solves this nasty issue
    Any further clue ?
     
  15. alternativevisual

    alternativevisual

    Joined:
    Apr 16, 2015
    Posts:
    75
    Unity 5.6.4p2 :confused:
     

    Attached Files:

  16. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    @N3ON47
    Upcoming version of NGSS will provide a better cascade blending than the built-in one (which only works fine with built-in default shadows).
     
  17. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    Folks,
    Got an answer from the Unity QA team regarding the issue of NGSS on mobile forward renderer (Case: 916195). Here's what they said:

    Hey,

    Thank you for contacting us. We can see that this issue has been reported by many users and it is affecting them. Our team will have a bugfixing week at the beginning of December. No promises but we will definitely investigate this case more during that week to take a decision. We can see that this wasn't a regression (the issue always occured), thus it may not take a priority but we'll update you.

    If Unity open source it's default renderer I would had fixed this ages ago. I'm pretty sure to know exactly where this bug comes from. :\
     
    ilmario, Flurgle and buttmatrix like this.
  18. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    Can you provide a small test scene that produces this issue? Submit to support and I will take a look at quickly.
     
  19. tri-stratos

    tri-stratos

    Joined:
    Jan 29, 2013
    Posts:
    152
    Tatoforever,

    Unfortunately, we decided to use post process effects’s AO to provide grass shadows instead, as we had real issues in using next gen shadows, and we don’t have the time to troubleshoot.
    Thank you for your assistance anyway
     
  20. Flurgle

    Flurgle

    Joined:
    May 16, 2016
    Posts:
    389
    This kind of situation makes me hope Unity opens up the renderer more soon
     
    tatoforever likes this.
  21. Invertex

    Invertex

    Joined:
    Nov 7, 2013
    Posts:
    1,496
    They are with the scriptable render loops system. You can download the preview from the repository.
     
  22. Flurgle

    Flurgle

    Joined:
    May 16, 2016
    Posts:
    389
    Yeah but its not ready, can't wait when it is :)
     
  23. ilmario

    ilmario

    Joined:
    Feb 16, 2015
    Posts:
    70
    Can't wait for this to happen. I must say you have some great persistence not just in making your assets top-quality but also useable for everyone, despite Unity bugs!
     
    buttmatrix, Akshara and tatoforever like this.
  24. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    506
    As unity 2017 shadows are good enough is there any advantage I should use this asset?
     
  25. alternativevisual

    alternativevisual

    Joined:
    Apr 16, 2015
    Posts:
    75
    They not good enough, for me :D
     
    buttmatrix likes this.
  26. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    506
    Sorry but is there any pic shows the difference? specially shadow of tree with distance set to 500.
     
  27. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    @Crossway
    Unity default shadows are basic at best. Directional is just 5x5/7x7 PCF no shadows penumbra size adjustment and spot/point shadows don't have any filtering at all. On the other hand, NGSS has two shadows builtin, PCF and PCSS, early bailing out optimizations, bias correction, upcoming better cascade blending, contact shadows, 8x8 filtering for all shadows optimized with 16taps. Shadows quality and look options are configurable too. No visible banding and stabilized noise pattern algorithms make them look even better than any default 8x8 PCF.
    All in all, if you are looking for better shadows with no noticeable performance hit, NGSS is the way to go. :)
     
  28. Markstam291

    Markstam291

    Joined:
    Mar 23, 2015
    Posts:
    12
    Hello, i want use direction light - soft shadow for Iphone 6s or more(using ARkit)
    I try setting like document, but it not work on iphone, please help me!
     
  29. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    @Markstam291
    This is a well known bug by Unity where it replaces back custom shadows with default platform shadows. It's have been reported a long ago and they will take a look at soon (December).
    Current workaround only works for some people and is to set the rendering path to deferred.
    Other than that we must wait. I will report any advancement on the bug as soon as I get anything from Unity staff. If you want to up vote the case here is:
    https://issuetracker.unity3d.com/issues/mobile-forward-unity-ignores-custom-directional-shadows
    Regards,
     
    buttmatrix likes this.
  30. Markstam291

    Markstam291

    Joined:
    Mar 23, 2015
    Posts:
    12
    oh, I voted for this bug, hope unity fix soon! and now i must report for my boss haha.
    Thank for reply!
     
    Flurgle and tatoforever like this.
  31. Deleted User

    Deleted User

    Guest

    Hi tatoforever,
    a quick question about Android - since upgrading from Unity 5.5 to Unity 2017 the shadow quality on Android has become rather abysmal (see the screenshot - it occurs on all devices I have). Do you have experience with NGSS producing acceptably looking shadows on Android in Unity 2017? I've read this thread and I don't have a problem switching to deferred rendering path.
    Many thanks!
    Screenshot_2017-11-23-19-19-11.png
     
    tatoforever likes this.
  32. AdBar

    AdBar

    Joined:
    Feb 1, 2014
    Posts:
    17
    Hi tatoforever,

    I was looking to render your shadows onto transparent objects, but none of my transparent shadow receiver shaders work using the replaced shadows in forward rendering, most likely due to the shaders using the old shadow system to render. Is there currently a way to render the shadows onto transparent surfaces?

    Thanks.
     
  33. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    @pandastic_games
    The mobile bug happens on forward renderer, you should be good. Make sure you are not targetting SM2.0 or you will be prone to build errors. Unless your shaders are super simple and you really really need SM2.0, you can edit in the directional shadows provided by NGSS but again, no guarantee it will work. What works fine is 3.0 and up for your config.

    @AdBar,
    Transparent shadows casted/received by transparent objects in Unity is quite tricky due the way the default renderer works. For example shadows received by transparent objects requires an special shader that will sample itself shadowmap cascades, which also means you will need to do any sort of filtering yourself and it won't be as efficient as the screen-space filtering.
    Upcoming version of NGSS will provide clean ways to do proper transparent shadows (casted/received) by any kind of object (opaque/transparent).
     
    brisingre and AdBar like this.
  34. mgto

    mgto

    Joined:
    May 30, 2013
    Posts:
    22
    Hi there,
    I have a problem with the current version 1.5.8
    The NGSS_Directional.shader is automatically added (and removed!) in the graphics settings. This becomes a problem. Because during work - whenever I open a scene without a light / directional light script (eg. my start scene) - the override gets lost.
    Of course I can manually set the shader override each time I start a build but this gets really annoying.

    Any chance to change it back to as it was or any other fix?
     
  35. brisingre

    brisingre

    Joined:
    Nov 8, 2009
    Posts:
    277
    I'm not sure this is an NGSS issue, but that's my current theory.

    Do you know anything about this error?

    upload_2017-11-25_21-49-34.png
     
  36. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    @brisingre,
    It's not related to NGSS as NGSS doesn't support DX9 anymore.
    If you want to confirm, remove NGSS from your project and try to build again. I saw a couple of reports where Postprocess stack was creating such errors at build.
     
  37. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    @mgto,
    Can you please write to support, I'm going to provide you a small change in the NGSS_Directional script to add your request. This addition will be part of the next update you won't have to change it afterwards. :)
     
    Last edited: Nov 27, 2017
  38. brisingre

    brisingre

    Joined:
    Nov 8, 2009
    Posts:
    277
    You're correct about it not being an NGSS issue. Unity was just having a Unity moment, I fixed it by deleting my library and reimporting everything.
     
  39. monkeybrother

    monkeybrother

    Joined:
    Oct 14, 2010
    Posts:
    83
    I just bought this and followed the manual for installing. It works for directional lights (with the script), but I get no change on point/spot lights, they behave just like unity built in lights. I'm using a custom shader (Standard Plus), but I can find no mention of "_LightShadowData" when I search the code. Unity 2017.2.
     
  40. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    @monkeybrother,
    Did you deleted your project ShaderCache folder after installing UnityShadowLibrary.cginc?
     
  41. monkeybrother

    monkeybrother

    Joined:
    Oct 14, 2010
    Posts:
    83
    Yes, I followed the manual exactly.
     
  42. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    If they appears as Unity shadows it means the install wasn't done correctly. Can you please explain exactly what you did? Just to make sure you've followed all the steps.
    PS: If you can't find _LightShadowData in your shaders you don't need to change anything in your shaders.
    Regards,
     
    Last edited: Nov 28, 2017
  43. Monkeybro

    Monkeybro

    Joined:
    Sep 15, 2017
    Posts:
    5
    I closed Unity, replaced the file in the unity directory, renaming the old one as "*_backup", deleted the shadercache in the project and opened it (shadercache is regenerated). When I change the "shadow strength" it just behaves as default and shadows look like the standard unity shadows. Any step I've missed?
     
  44. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    You took UnityShadowLibrary.cginc from NGSS and copied inside CGInclude folder (where Unity is installed) right?
    How many Unity installations do you have?
    Can you please write to support and provide the UnityShadowLibrary.cginc you currently have in your CGInclude folder?
     
  45. monkeybrother

    monkeybrother

    Joined:
    Oct 14, 2010
    Posts:
    83
    Yes, original file size was 40kb, new (your) file is 54kb. I have 4 installations of Unity (since projects I'm still working on/updating uses them), but I've only tried 2017.2.
    Sure, what's the address?
     
  46. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    Can you try installing NGSS in all your Unity folders and see if it works?
    To me it looks like you are installing UnityShadowLibrary.cginc in one Unity version and opening your project with another Unity. Otherwise it should work, it always works.
     
    Last edited: Nov 29, 2017
  47. monkeybrother

    monkeybrother

    Joined:
    Oct 14, 2010
    Posts:
    83
    I'm very certain that I've replaced the file in the right folder, I started unity by clicking the Unity.exe from the folder just to make sure. But I can try installing it on every version.
     
  48. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    It also happens to me that Unity overwrites many shortcuts icons link inside them and opening other versions without even know (that could also be the reason).
    PS: I can do remote assistance if you want me to check if everything is fine on your side.
     
    Last edited: Nov 30, 2017
  49. monkeybrother

    monkeybrother

    Joined:
    Oct 14, 2010
    Posts:
    83
    I just noticed that spots and directs work like intended, but when I change shadow strength on point lights, the shadows change opacity.
     
  50. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    @monkeybrother,
    You need to change the _LightShadowData on them to avoid opacity change when tweaking the shadow soft-ness.
    Or you can send the shaders to support@psychozinteractive.com and I'll do the change for you (It's just one line tweak).
    Regards,