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

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

    arnoob

    Joined:
    May 16, 2014
    Posts:
    155
    Hi tatofever!

    Here is the package containing the cloud dome with its material and shader. Any one can use it, it (has also been posted on reddit here https://www.reddit.com/r/Unity3D/comments/6r7h9y/screenshot_of_my_basic_cloud_dome_shader_link_in/)
    Here is the github link https://github.com/Arnooby/Models_unity_free/blob/master/Dome.unitypackage

    Also I would be glad to test the new version with a lot of point lights, I might do a city at night scene, so it should be perfect for a quick test! :)
     
    tatoforever likes this.
  2. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,069
    @arnoob,
    Can you please email support to try out the new version? :)
     
    arnoob likes this.
  3. alternativevisual

    alternativevisual

    Joined:
    Apr 16, 2015
    Posts:
    75
    tatoforever likes this.
  4. one_one

    one_one

    Joined:
    May 20, 2013
    Posts:
    552
  5. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,069
    I call it "world space static noise". :)
    Same idea as in CryEngine 1/2 stratified poisson sampling using a screen space texture only that samplers are mapped world space this time (that's why they never jump). :cool:
     
    Last edited: Aug 3, 2017
    one_one, buttmatrix and Seneral like this.
  6. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,835
    @tatoforever Can you share more information on your custom renderer? Is there a WIP thread for it? What features/benefits will it provide? What platforms will it work on, etc.? Thanks.
     
    chiapet1021 likes this.
  7. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,069
    @magique,
    I've shared a couple of videos in this thread with plenty of lights in one pass though, that's all I can show cause that's where we are. :)
    I'm now 100% focused on NGSS 1.x/2.0 features (which will become parts of our custom renderer later on). Basically, we have an old mobile custom renderer that we are porting over Scriptable Render Pipelines. What it simply does, optional pre-pass, and up to (but not limited) to 32 lights in one single pass. A couple of those lights lights can optionally have shadows too, that's where NGSS 2.0 comes into play. The hardest part is making it works with the default standard like shader so we don't have to re-create all possible available shaders now and it can work out of the box on your projects. Coming later this year. :)
     
  8. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,835
    Yeah, the video looked great. Single pass with all those beautiful shadows is fantastic. I really look forward to that product as well as future NGSS updates.
     
    chiapet1021 and tatoforever like this.
  9. Invertex

    Invertex

    Joined:
    Nov 7, 2013
    Posts:
    1,078
    At this point Unity should just hire @tatoforever to upgrade their rapidly aging shadow system!

    edit: Forgot to tag @LucasCh ;)
     
    Last edited: Aug 4, 2017
    tatoforever likes this.
  10. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,069
    @Invertex
    I'm open to any possible deal with Unity but sadly not full time as I already got my company and we have games in the works too. ;)
     
    Invertex likes this.
  11. alternativevisual

    alternativevisual

    Joined:
    Apr 16, 2015
    Posts:
    75
    3 point light, PCSS, medium resolution - 60~70 fps. :)
     
    tatoforever and buttmatrix like this.
  12. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,069
    Folks,
    New version is on the store. As you can see, huge visuals and performance improvements on point light shadows. Other features in this update: bias fade, exposing directional shadows properties publicly and new noise algorithms. :)
    Upnext, new cascade spherical blending.

    @N3ON47
    Just in case, make sure you are not rendering in GameView and SceneView simultaneously (specially when benchmarking). It will drain bandwidth twice and if you run out of it your FPS will drop considerably.
    Btw, what you have there is 64 samplers. If you need more speed you can cut it half with 32samplers or even set it to PCF. :cool:
    Looking good.
     
    Last edited: Aug 4, 2017
    id0, punk, Lex4art and 3 others like this.
  13. Abuthar

    Abuthar

    Joined:
    Jul 12, 2014
    Posts:
    92
    Ever since the last update, my shadows have been really low res compared to before, even though all my settings are maxed in line with all the documentation. In this screenshot i'm using a directional light for reference. as you can imagine spot and point lights look even lower resolution.

    Would it be possible for me to get the previous version from you?

     
  14. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,069
    @Abuthar
    NGSS shadows uses Unity internal depthmaps. If shadowmaps look low ress you probably want to look at your project settings (Quality/Graphics).
    PS: If you want previews version, please email support with your invoice number (if your first time).
    Regards,
     
    arnoob likes this.
  15. Abuthar

    Abuthar

    Joined:
    Jul 12, 2014
    Posts:
    92
    Thanks for the response. I did set "prefer 32 bit shadow maps" but it made no difference. I'm considering reinstalling unity if the previous version doesn't work because I had no problems before. I got my graphical settings like I wanted and left them alone for a long time now. It's like these jagged shadows came out of no where.
     
  16. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,069
    @Abuthar
    Try disabling PCSS filtering. Or tweak the PCSS_Min value.
     
    Last edited: Aug 8, 2017
  17. arnoob

    arnoob

    Joined:
    May 16, 2014
    Posts:
    155
    Probably a dumb question, but just to be sure, did you play with your light's shadow strength?
     
  18. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,069
    @arnoob
    Since last NGSS version, directional shadow strength don't do anything to shadow softnes (it must be tweaked through the directional component). What he probably need is to tweak the PCSS min soft-ness. :)
     
    Last edited: Aug 8, 2017
    MarkusGod and arnoob like this.
  19. Zomby138

    Zomby138

    Joined:
    Nov 3, 2009
    Posts:
    653
    How come there's no PCSS for spot lights, when it works for point lights? Isn't a spot light basically just one sixth of a point light?
     
    arnoob likes this.
  20. alternativevisual

    alternativevisual

    Joined:
    Apr 16, 2015
    Posts:
    75
    Spot and point light have different shaders, i think tatoforever just missed that
     
    arnoob likes this.
  21. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,069
    @Zomby138
    Unfortunately, Unity do not provide rawdepthmaps for Spotlights and since NGSS works with Unity's own shadow/depth maps it's impossible to create a proper blockersearch on spotlights. It's not the case in NGSS 2.0 as I'm the one providing my own depthmaps. :)
    It's sad that we cannot chose the texture format for Unity builtin shadows. Would have been quite easy to integrate other shadow systems without being forced to render our own depthmaps. :)
     
    Last edited: Aug 12, 2017
    alternativevisual and buttmatrix like this.
  22. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,069
    Folks,
    I got a small update coming this week improving point lighting PCSS filter (provides better blocker/receiver shadow contrast) and other tiny improvements. Still working out the new cascade blending algorithm for StableFit projection.
    PS: How's the last update working out for you? :)
    Regards,
     
  23. ghiboz

    ghiboz

    Joined:
    Sep 7, 2012
    Posts:
    453
    hi @tatoforever
    the latest is more fast, about the quality I need to do some config tests, but looks better, also the fact you didn't use the shadow strength is cool!;)
     
    tatoforever likes this.
  24. nbac

    nbac

    Joined:
    Jul 7, 2015
    Posts:
    253
    just another one
     
    ZJP, tatoforever, Invertex and 2 others like this.
  25. ekergraphics

    ekergraphics

    Joined:
    Feb 22, 2017
    Posts:
    257
    Well, I finally got around to test this, and I have to say, out of the box, there's some pros and cons visually...



    But most importantly performance was absolutely murdered in VR on a machine with a 1080 graphics card (even though the SteamVR debugger reported very few dropped frames, it felt as if Unity locked itself to 45 fps, and that does not happen with default shadows).
     
  26. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    Contact shadows is not supported in SPSR due to an internal stereo coordinate conversion issue on Unity's side. Performance gets slashed as a result.
     
    hopeful likes this.
  27. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    @tatoforever would it be possible to get contact shadows for baked lights?
     
  28. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,069
    @roberteker
    Hi,
    On your NGSS image, all those artifacts are due to incorrect setup. Would you mind sharing that scene? I would like to give it a go and help you set it up.
    PS: It's me or you look to have two directional lights casting shadows in NGSS picture?
     
  29. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,069
    @buttmatrix
    What do you mean exactly? Blend contactshadows with shadowmasks?
     
  30. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    For example, if a scene contains no active realtime light sources, NGSS will not know how to draw the contact shadows, and thus will be missing. However, in cases for fully baked lighting, it would be nice to still be able to enable contact shadows to cover detail areas that the baked GI might miss.
     
  31. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,069
    @buttmatrix
    ContactShdows produces a screen-space shadowmask, it can be applied as an image effect (similar to how SSAO is done). Keep in mind that doing this way lights won't influence the opacity of contactshadows and results can be somewhat unwanted in presence of strong outdoor direct lighting.
    You can already use the resulting ContactShadows renderTarget and blend it with the screen rt. Or email support me if you want to know how to do it, is not that complicated. ;)
    Regards,
     
  32. Abuthar

    Abuthar

    Joined:
    Jul 12, 2014
    Posts:
    92
    Hello again, I've got a weird question. I've opened a new, empty project and set up NGSS with a point light and a simple bust to try and explore the problem. I've messed with light bias as well as all and any settings that have to do with lighting or graphic quality.

    The issue : The brighter or closer the light gets to the mesh, the weaker the cast shadow. So rather than having cast shadows that that are solid black unless i add ambient lighting or otherwise, my cast shadows are more transparent, the closer they are to the light source. ( top picture ) However if I increase the scale of my model, the strength of the shadows are full again, in other words, i have solid shadows rather than transparent shadows. ( bottom picture )

    Is this a known issue with a fix? Maybe I am missing something obvious? This just happened recently and I feel like I might have to reinstall Unity 2017.

    Also Just wanted to say i really appreciate the work you've put into NGSS and the support you're providing. I am anxiously waiting for NGSS 2.0 because this plugin has really elevated the level of realism in my project, which is what i'm striving for. So thank you.

     
    tatoforever likes this.
  33. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,069
    @Abuthar
    Yeah, I've identified this minor issue and got already fixed in next week version. It's caused by a large NGSS_BIAS_FADE value. If you can't wait for next update you can reduce the NGSS_BIAS_FADE value on both UnityShadowLibrary.cginc and NGSS_Directional.shader files to something between 0.05 and 0.015. This will however can cause shadow acne to be visible if light bias value property is very low. So keep that in mind when tweaking it.

    Hope it helps.

    PS: The default value now for NGSS_BIAS_FADE is 0.015 and light bias on most of my local lights are close to zero (0.001) and no visible acne at all.
    Regards,
     
    hopeful likes this.
  34. Abuthar

    Abuthar

    Joined:
    Jul 12, 2014
    Posts:
    92
    Wow thanks, i should've done a little more reading!
     
    tatoforever likes this.
  35. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,069
    Email support if you want the update (it's already submitted to the store and ready for public). ;)
    PS: This update improves point light shadows quality a bit more for free (without any additional performance cost). :D
    [EDIT] New version is on the store. Improves point light visual quality and fixes a tiny issue with bias_fade.
     
    Last edited: Aug 22, 2017
    Abuthar likes this.
  36. ekergraphics

    ekergraphics

    Joined:
    Feb 22, 2017
    Posts:
    257
    Hmm. I only added your asset according to your readme instructions. What did I do incorrectly?

    There should only be one directional light in the scene. I sent it to you via wetransfer.
     
  37. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,069
    @roberteker,
    I got your file, I'll take a look at tomorrow and get back to you asap.
    Regards,
    [EDIT] I'm taking a look right now. ;)
     
    Last edited: Aug 22, 2017
  38. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,069
    @roberteker
    Just gave a quick go to your scene and tweaked ContactShadows a tiny bit but in overall I don't see anything wrong with (other than it was quite too large and tick). ^^

    I'm not entirely sure what kind of object is in your example scene but I've included in my shots a builtin 3D sphere for scale comparisons. This sphere is supposed to measure about 1m (by default 1 unity unit = 1 meter) so if your object is too small shadows expectations can be wrong as shadow distances between casters and receivers varies and affect shadow softness quite a lot (if too small = less softer, if too big = very very soft).
    Let me know if you need any other kind of assistance to setup your scene shadows.
    Regards,
     
    Last edited: Aug 22, 2017
    buttmatrix likes this.
  39. ekergraphics

    ekergraphics

    Joined:
    Feb 22, 2017
    Posts:
    257
    I'm sorry if I'm missing something obvious, but which settings did you tweak?

    The object in this scene is a CAD model (for a client actually, which is why I hid most of it in my screenshots, so if you could please remove/edit yours I'd appreciate it). The object is to scale, and I believe that importing detailed CAD models into Unity for VR viewing is something that will become more and more common.

    Plus, in VR you also often lean into the model and observe it very closely, thus the need for really well defined and detailed shadows, even at small sizes.

    I wonder how ZeroLight does it... (
    )
     
  40. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,069
    @roberteker
    What I tweaked was the ContactShadows properties. Also you can reduce your shadows distance if your project allows it. This will provide higher resolutions to your shadows split resulting in better looking shadows.
     
    hopeful likes this.
  41. TeohRIK

    TeohRIK

    Joined:
    Jan 22, 2014
    Posts:
    90
    Hi, I love your asset but I get quite some error with the custom amplify shader with NGSS, should I ignore it or?

     

    Attached Files:

  42. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,069
    The reason for those warnings is that shader compiler is trying to unroll some loops and flat some dynamic branches but you can safely ignore them. There's a couple of keywords to avoid those warnings but produces slower code so I've leaved as it. :)
     
    TeohRIK likes this.
  43. arnoob

    arnoob

    Joined:
    May 16, 2014
    Posts:
    155
    Hi tatofever!

    I just found a bug with screen space shadows.

    I am creating a split screen game, where you can switch between FPS and TPS view. To to that, there is two cameras an each player : one TPS and one FPS. Each camera has a screen space shadow script on it. To switch view, I diactivate the FPS camera and activate the TPS one.

    However, the screen space shadow script seems to have some troubles knowing to which camera to apply the effect.
    At first it looks correct, like here :


    But as soon as I change one of the views, it start to mess up :




    Do you have any idea about what is causing that?

    By the way, I sent you a cloud scene some time ago in order to see if it was possible to make a better shadow dithering with NGSS. Is there any improvement on this side? :)
     

    Attached Files:

  44. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,069
    @arnoob,
    ContactShadows right now only works with one camera but I can make it works with two cameras. Added to my todo list for next update.
    Unity shadows dithering functionality is bad a fak. They should do it world space not screen space. There's no way to add alpha shadows dithering without modding more core Unity rendering shaders. With NGSS 2.0 correct alpha shadows will be supported as the rendering technique is completely different.
     
  45. arnoob

    arnoob

    Joined:
    May 16, 2014
    Posts:
    155
    That'great to hear! Thank you again for the awesome support. I really wish all asset creators were like you! :)

    By the way I think I recall you mentioned being working on some other tweaks for screen-space shadows, such as being able to choose some meshes not contributing to it. Is it still planned?
     
  46. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,069
    @arnoob
    It's possible using a screen space mask but constructing/decoding the mask doesn't come free as the effect is screen depth dependent. If your object writes to the depth buffer it will cas ContactShadows by default. For the mask you'll have to render the objects you don't want ContactShadows twice with a special shader (to create the mask) or you'll have to use special modified shader on those objects again to help construct the masks. Though, no plans right now for such a feature (probably on NGSS 2.0). :)
     
    arnoob likes this.
  47. strich

    strich

    Joined:
    Aug 14, 2012
    Posts:
    288
    This looks like a great plugin! I have two questions:

    1. How well does this solution scale compared to the default Unity solutions for real-time lighting? Our games typically have quite a lot of point lights.
    2. We're trying to replicate the kind of lighting conditions found in games like The Sims 4:
    Example: https://streamable.com/yoe2k
    We're trying to implement that kind of more diffuse lighting conditions, rather than stark lighting. Is this an effect that this plugin would assist in solving? Or should we bee looking at another technique?
     
  48. arnoob

    arnoob

    Joined:
    May 16, 2014
    Posts:
    155
    I'm kind of a shader newbee, I do them directly through amplify shader. Do you think it's possible to do it through this asset? Could you provide an example shader that does that? :)
     
  49. Lex4art

    Lex4art

    Joined:
    Nov 17, 2012
    Posts:
    272
    Hmm, there is something interesting in changelog of Unity 2017.2.b9:
    Graphics: When using custom shadow resolution on a light, this resolution won't be clamped as usual, allowing to reach up to 8k shadowmap if needed.

    How to apply that "custom shadow resolution" to a light (for non-programmer)? Anyway, it's good if it is finally possible to have more than puny 1024px shadow resolution at "Very high"! It's 2017 year god damn it! XD
     
    hopeful and tatoforever like this.
  50. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,069
    It provides better soft-shadows with similar performance. Point light however will remain heavy if you got lot of them.
    This kind of lighting is semi-dynamic. Baked for static objects and fully dynamic for dynamic objects. Unity lights are fully dynamic, always. In NGSS2.0 we provide this option not in the current version.
    Regards,
     
unityunity