Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. 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. brisingre

    brisingre

    Joined:
    Nov 8, 2009
    Posts:
    274
    So I finally actually got to give this a try.

    It's a night and day difference from the built-in-shadows. These look fantastic!

    I am having some problems with shadow acne however.

    On surfaces facing the light everything's fine, but on surfaces closer to parallel to the light I get a lot of artifacts.

    At low bias values (which is what I'd prefer to use, as higher ones cause peter panning and leaks) these are pretty serious. Even at very high values it doesn't disappear entirely on some surfaces. (The first screenshot is at bias 0.05, the second is at bias 1.0.)

    Any tips for dealing with this? I don't know much about shadows. I tried fiddling with Normal Bias, which sounds like it could help, but it didn't seem to do anything.

    There also seems to be a bug with spot light shadows if you stand right on the edge of the light.
     

    Attached Files:

  2. Flurgle

    Flurgle

    Joined:
    May 16, 2016
    Posts:
    389
    Are you able to upload a basic project file so we could recreate this?

    (I just got NGSS last week so might be able to help)
     
    tatoforever likes this.
  3. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,082
    Hi brisingre,
    Some general tips about shadowmap setup:
    Spot light shadows bias must be lowered (try lower than 0.05) because it works a bit different than the rest.
    Point-light shadows should be fine between 0.05 and 0.1. Try to reduce the soft-ness of your shadows (Strength value on your light).
    Also, local lights (point/spot) are not recommended larger than 20-30 range units (that's why scene scale it's important) if you want shadows fidelity, otherwise shadows texels must cover larger distances (and in this case samples will separate a lo more) you'll see the empty gaps between samples. That's not just for NGSS shadows, that how any shadowmap works, the bigger your light ares, the more space they have to cover with the same texel.
    Try to provide more information about your objects and lights setup. Like objects scale, lights properties any information that will allow me to see where the problem comes from. Or if you can provide that test scene that would be better (use the email provided in the documentation file).

    Normal Bias only works on Directional shadows and it's not even usable with other shadows because Unity renderer doesn't feed the shaders with if it's not a Directional Light.
    Bias and petter panning problems will always be present in a way or other with any shadomap type. Shadows acne depends on all other mentioned factors (light size, shadowmap size, surface and light position) but will be a lot more visible on soft-shadows because kernels gets displaced in light space (parallel surfaces to light will get those samples).
    Most important to the most out of your shadows is to reduce your local lights size as much as you can and rise your shadowmap size (if your hardware allows it) so your surfaces reviving shadows can have at least one texel per pixel (avoiding multiple surface pixels per texel).
    Regards,
     
    Last edited: Feb 12, 2017
  4. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,082
    Folks,
    Directional Shadows:



    I'm fixing some issues with shadows cascades and also see if PCSS can be implemented, more shots soon.
    Enjoy! :)
     
    Last edited: Feb 13, 2017
    OCASM, Seith, No0B25 and 9 others like this.
  5. MaDDoX

    MaDDoX

    Joined:
    Nov 10, 2009
    Posts:
    761
    Awesome! ;)
     
    tatoforever likes this.
  6. brisingre

    brisingre

    Joined:
    Nov 8, 2009
    Posts:
    274
    I was indeed trying to make a larger point light. A size 15 light is fine under most conditions, even at relatively low bias values, but not all conditions-- acne's still present on smaller lights when you're close to a surface at a certain angle.

    Screenshots are of a size 40 and size 5 light, both with "very high resolution" shadows and 0.05 bias. I'm using max brightness lights to make the acne higher-contrast, but you get the same stripes on less-bright lights. High bias values in the 0.2-0.5 range do take care of the stripes, but they cause other problems.

    Obviously this is a big point light, and the edges of the shadows are starting to get jaggy, which is a limitation of shadow maps in general. But if it weren't for the acne I think the shadows would still look very good at this size -- if you set a high bias value they look alright except for the issues a high bias value always causes.

    Interestingly, with strength set to 0, the shadows for the big point light are only jaggy nearer the light. After a certain distance they tend to resolve into nice straight lines. This distance does not seem to be affected by the size of the light.

    Spot lights with low bias values seem to have some artifacts as well.

    I don't know if there's any way to increase shadow map resolution further. I would if I could, my hardware could handle it.

    Here's a link to a test scene.

    https://drive.google.com/file/d/0B2L9OwqI24DicWNUajg3aDZIU3c/view?usp=sharing
     

    Attached Files:

  7. Olafson

    Olafson

    Joined:
    Aug 7, 2012
    Posts:
    252
    How long until you think that directional shadows are done? I have some uses for point lights, but directional lights would be much better.
     
    tatoforever likes this.
  8. thelebaron

    thelebaron

    Joined:
    Jun 2, 2013
    Posts:
    613
    Looks great, I love this product(unfortunately i dont have anything really worth sharing yet). One guy goes and does what unity has failed to address for so long, great work.
     
    tatoforever likes this.
  9. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,082
    @brisingre
    I'm working on a new bias technique for all NGSS shadows (light, spot and directional). It works by shifting the shadows kernels based on surface depth, this will help a lot with shadows acne problems. I'll provide some shots as soon as I'm done with Directional shadows. :)
     
    brisingre, punk and Lex4art like this.
  10. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,082
    Dusting out some old papers from the AMD graphics library. Depth-plane bias example from Isidoro on a standard 8x8 PCF kernel:



    Shadows acne are less present on hard-shadows or kernels that are non distant (less softer). But this technique alleviates shadows acne without producing Petter panning (displacement of shadows).
    In the future, I'll simply shift shadows away and add contact-shadows on top of a full screen filter algorithm for all lights (not just directional) with the help of directional buffers. Not possible right now under current renderer but 100% doable with ScriptableRenderLoops.
    Contact shadows reference from Unreal Engine (producing realistic hard-shadows close to surfaces):
     
    Flurgle, brisingre, id0 and 2 others like this.
  11. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    7,552
    Doesn't UE4 do it in a screenspace fashion?
     
  12. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    10,207
  13. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,082
    @AcidArrow
    Yes, unreal does it only on directional shadows (screen space) but I was talking about a screen space filter using directional buffers to filters all shadows types and add them all contact shadows. :)
     
    punk, AcidArrow and chiapet1021 like this.
  14. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    7,552
    Right, awesome. I just missed the "full screen filter algorithm" in the other post, so I wondered if it was some sort of non-screenspace technique I was completely unaware of.
     
  15. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    390
    That whould be so cool ;)
     
  16. Deleted User

    Deleted User

    Guest

    First of all I wanted to say that this looks simply amazing! I would even pay twice as much without hesitating, since I was waiting for something like this since seeing the Last of us Soft shadows :)

    But i have a problem... is it just me or doesn't it work on unity 5.6 (b7) yet?
    Thank you for this wonderful product!
     
    tatoforever likes this.
  17. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,082
    Yeah,
    What I'm doing is extending contact-shadows (aka screen-space raymatched shadows) to all light types, not just 1 directional-light. Furthermore, what I got in mind is to filter them in one single pass (reusing buffers from previous step, on paper now). Still, you need to render shadows in light space anyway, otherwise objects that get on the screen will pop in.
    It is however not possible with CommandBuffers you cannot inject back any modification without light indexes. With ScriptableRenderLoops you have more control as you are the one making them from scratch and indexing them.
     
    Last edited: Feb 13, 2017
  18. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,082
    It works but I have to submit the update, I was waiting to finish with directional shadows first. ;)
    Please contact me through support email with your invoice number and I'll give you the NGSS version compatible with 5.6. :)
    Regards,
     
    Deleted User likes this.
  19. Flurgle

    Flurgle

    Joined:
    May 16, 2016
    Posts:
    389
    @OnatHekimoglu looks like tato has the shader already ready which is awesome, though just FYI i've been running this on 5.6.0b7 for a while, and works great, but had to add in shader functions from the old shadow shader to get it working.
     
    tatoforever and Deleted User like this.
  20. Deleted User

    Deleted User

    Guest

    Thanks tato, just sent you a pm :)
     
    tatoforever likes this.
  21. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    7,552
    So I just bought it :)

    I like it. One comment I want to make though, since if you push the softness too much and you have too much contrast and you use only monochrome materials, it does look kinda noisy, is there a possibility for the noise to animate somehow? So that it would get picked up by TAA and smoothed out or something.
     
    tatoforever likes this.
  22. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,082
    @AcidArrow

    TAA jitter buffer works with scene objects, and since shadows are computed in (light space) before TAA jitter buffer, It should works perfectly fine with TAA. The provided example scene does not have TAA though but it should work fine (we are using it on our game).
    I would recommend using high frequency materials, any shadowmap issues will always be visible on low frequency/big contrast scenes, either noise, acne, petter panning or banding.
    Cheers,
     
    Last edited: Feb 14, 2017
  23. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    7,552
    You're right, I spoke before actually trying it (or, actually, I did try it, but I think I had an old TAA installed at that project, which wasn't even working properly).

    It seems that it cleans up really nicely actually. (for the record, I think it looks fine even without TAA for 99% of the situations).

    I also really like how medium resolution is now totally usable.
     
    tatoforever likes this.
  24. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,082
    @AcidArrow
    We have plenty of tiny shadowed point lights at low-med resolution and works fine. It's actually faster than any standard Unity shadows with higher resolution.
     
    id0 and AcidArrow like this.
  25. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,082
    Folks,
    If you need support for 5.6 I got one version of NGSS that works on all Unity versions including 5.6 with baked shadows. Email me (use support email) with your invoice number and I'll provide you.
    I will soon submit v1.1 with directional shadows support that includes the same support for 5.6. Version v1.2 will improve shadows bias with depth plane bias implementation.
    Furthermore, raymatched shadows (contact shadows) support won't be free because it's a separate system on top of NGSS but it will be 50% upgrade discount if you previously own NGSS and it will be an addition to NGSS. Will start implementing as soon as I'm done with depth-plane bias (after v1.3).
     
    Last edited: Feb 14, 2017
    punk likes this.
  26. Deleted User

    Deleted User

    Guest

    Harold Soft Shadows.PNG
    Thank you, looks Beautiful! I'm already looking forward for the contact shadows ;)

    There's also another question:
    The Console now spams the following two errors repeatedly:
    RendererUpdateManager only synchronizes renderers that are added to the scene, so AssertIsTransformInfoUpToDate can only be called on renderers that are added to the scene
    In order to call GetTransformInfoExpectUpToDate, RendererUpdateManager.UpdateAll must be called first.

    How can I solve this? I'm running Unity 5.6b8 right now.
     
    OCASM, eskovas, wetcircuit and 4 others like this.
  27. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,082
    Omg, your game lighting it's beautiful, NGSS shadows makes a huge difference:



    OK tears to the side, can you please send me your Editor Log (after spawning that error), I don't think it comes from NGSS but I'll check and try to help whether or not it's the case. :)
     
    Deleted User likes this.
  28. Deleted User

    Deleted User

    Guest

    Thank you :) Yes NGSS was the missing puzzle Piece i was looking for for a long time now :) It also seemingly breaks my Eye Shader (Eye Advanced, which I can change if it doesn't work... NGSS is far more important :D) but it would be nice to know what to look at in terms of compatibility with other shaders.
    Will send you my log in a few minutes. I really appreciate your support.
     
    tatoforever likes this.
  29. Deleted User

    Deleted User

    Guest

    Just sent you the log. I also just saw that two of my shaders have an error that says unexpected identifier "cbuffer", if that helps...
     
    tatoforever likes this.
  30. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,082
    @OnatHekimoglu
    If you have custom shaders that access shadows internal data such as _LightShadowData.r, make sure you comment that line and set the value to 1.0. For example if you got something like this:
    Change to:
    Because _LightShadowData.r is the value NGSS use to control shadows softness.
    So it should work with any shader framework that doesn't do funny things with that value, if that's the case you know what to do (there's a small note about it on the documentation just in case). :)
    PS: Reading the log now.
     
  31. Deleted User

    Deleted User

    Guest

    Yes I already saw that in the documentation, but neither one of those two shaders does try to do anything with that. It seems to be related to the cbuffer identifier, which i found in your replacement script, but since I am not a Programmer, i have no idea what to do :D
     
    tatoforever likes this.
  32. chiapet1021

    chiapet1021

    Joined:
    Jun 5, 2013
    Posts:
    604
    The possibilities of scriptable render loops seem really awesome. I do worry a bit that it will become harder to integrate assets from multiple developers once custom render loops are released, but I suppose the tradeoff for newer/better/more performant graphics is worth it. :)
     
    Flurgle likes this.
  33. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,082
    We'll be following UnityHDR renderer standards, which means if it works with standard frameworks it should works with our renderer. ;)
     
    Flurgle and chiapet1021 like this.
  34. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,082
    @OnatHekimoglu
    Just sent you a file without CBuffer, you should be good now but let me know if it doesn't work.
    PS: Let me know about the other error in the mail you got.
    Cheers,
     
    Deleted User likes this.
  35. Flurgle

    Flurgle

    Joined:
    May 16, 2016
    Posts:
    389
    Started on a preliminary test scene with light and ref probs, real time GI, spotlights, point lights, post processing stack (including temporal AA), and NGSS. Looks very good - (like a rendered ray tracing scene):


    More intense GI


    (Video here of slightly different color / darkness setup: https://gfycat.com/SelfishCarelessDiamondbackrattlesnake)

    Less intense GI
     
    Last edited: Feb 15, 2017
    ikazrima, ZJP, chiapet1021 and 3 others like this.
  36. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,082
    @Flurgle


    Ambient Occlusion as as post-process is not physically correct. We need to inject it to the light buffers so they will contribute to scene lighting instead of dirtying the display buffer. I got plans for that too. ;)
     
    Last edited: Feb 15, 2017
    Flurgle likes this.
  37. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,082
    Folks remember,
    If you need a compatible version of NGSS with Unity 5.6+ trow me an email (the one provided in the documentation) with your invoice number.
    Almost done with Directional shadows. NGSS v1.1 will soon head to the store then I'll start on the new bias improvements (v1.2) that also includes 3 quality levels.
     
    punk, id0 and Flurgle like this.
  38. Flurgle

    Flurgle

    Joined:
    May 16, 2016
    Posts:
    389
    @tatoforever oh noooo what have I done!? I won't mention my version number on my Unity beta screenshots, it's probably confusing people.
     
  39. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,082
    @Flurgle
    Not publicly, only when you email us about NGSS pre-releases. :D
     
    Last edited: Feb 15, 2017
    Flurgle likes this.
  40. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,082
    Commercial products using NGSS. All lighting are dynamic point shadows (including shadows on characters face):


     
    Last edited: Feb 16, 2017
    chiapet1021, Lex4art and punk like this.
  41. MaDDoX

    MaDDoX

    Joined:
    Nov 10, 2009
    Posts:
    761
    If you pull that off I'll throw in the towel and buy it already ^_^

    @OnatHekimoglu , could you post that screenshot with standard Unity shadows? I'd love to see a comparison, apparently the difference is huge.. :eek:
     
    tatoforever likes this.
  42. chiapet1021

    chiapet1021

    Joined:
    Jun 5, 2013
    Posts:
    604
    @tatoforever, are you planning on selling something like a custom render loop that would incorporate NGSS and the other enhancements you've mentioned? My fingers are crossed your answer is "yes" :p, but I know supporting popular assets is time-consuming and can detract from your own game development.
     
  43. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,082
    Exactly yes. Those systems we develop are being used in our games and are a collateral revenue resource on the Asset Store. Which means, if no one buy them, we still need to develop them anyway. :)
    What's planned for that system. Some of those features will land in a limited way on NGSS and others are being/will be developed separately with ScriptableRenderLoops as we speak, more or less in this order:
    - NGSS (with all planned features)
    - Full screen contact shadows for all lights (not just 1 directional)
    - SSAO/SSHO injection into light buffers (they won't dirt the display buffer as an image effect but contribute to scene lighting/shadowing correctly)
    - Shadowmap Extreme optimizations, atlassing for all lights, configurable atlas size, zero memory fragment, faster fetching, write depth only if there's moving objects on it, reuse depth if nothing is moving inside it (18-20 shadowed lights in one pass at first then more to be added depending on SM5+ instructions limits)
    - Forward+ (At first 18-20 shadowed lights in one pass but also plans for a pre-pass to cluster around 300+ lights on the screen)
    - Massive full screen soft-shadows filtering for all lights (possibility to blend between contact shadows and soft-shadows = nVIDIA Hybrid Frustum Tracing Shadows)
    - Lastly volumetric lighting for all light types
    A fully featured HDR renderer that works with MSAA and any standard compatible Unity shader/frameworks out of the box (like NGSS). The system will probably be called NGSS 2.0 (who knows). ^^
    PS: Will require DX11+ (or similar OGL/ES/Metal/Vulkan) API level.
     
    buttmatrix, Flurgle, punk and 4 others like this.
  44. chiapet1021

    chiapet1021

    Joined:
    Jun 5, 2013
    Posts:
    604
    Oh my goodness, this looks like the holy grail of rendering. It will be an insta-buy on my side, once it's available. :)

    Well, if you can also figure out some sort of runtime, dynamic GI lightmapping for procedural scene geometry assembly, that would be the final cherry for me. I know, I know, I ask for too much. :p
     
    tatoforever likes this.
  45. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,082
    @chiapet1021
    Here's a set shadows examples comming to NGSS using nVIDIA ShadowWorks.

    Hard (Faster but ugliest, notice aliasing problems):


    Frustrum Traced (best hard shadows ever):


    HFTS (Blend between PCF and FT):


    Frustrum traced (constructing rays with light direction and frustum depth):


    PCF (Easiest but not fastest way to soft shadows, also notice bias and Peter Panning):


    HFTS (Mix between PCF and FT):


    Note: Nvidia Shadoworks is slow with HFTS because their ray length is large (it covers the entire light range). Normally if you blend between PCF (or PCSS) and FT it should be faster as FT shadows ray length won't be as large as that when mixing with any soft-shadows technique.
    It's worth notice that ShadowWorks PCF filtering is basic at best, they bruteforce shadows to reduce aliasing/banding with plenty of sampling which is bad on low-end hardware.
     
    Last edited: Feb 16, 2017
    buttmatrix, Flurgle, punk and 2 others like this.
  46. chiapet1021

    chiapet1021

    Joined:
    Jun 5, 2013
    Posts:
    604
    Gorgeous. I remember back when contact hardening shadows were previewed when Jove 2.0 was still in development, and I salivated at the screenshots. These look even better and have a much better chance of seeing the light of day. :)

    Is it right to assume Shadoworks plays nicer with NVIDIA cards over AMD? Seems to be a general bias for DX11-based features, but I'm not sure if Vulkan helps even things out a bit.
     
  47. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,082
    @chiapet1021
    ShadowWorks works both on AMD and NVIDIA cards it's more of a set of common new/old shadowing techniques for DirectX11+ based games. Nothing specific to NVIDIA cards. Those techniques are also possible with similar capable APIs.
    Current version of NGSS should work even with DX9 and mobile (where Unity supports shadows) but v2.0 (made with ScriptableRenderLoops) wont as it will require SM5 feature hardware.
     
    IgorAherne and chiapet1021 like this.
  48. chiapet1021

    chiapet1021

    Joined:
    Jun 5, 2013
    Posts:
    604
    Ah nice. Thanks for all the explanation!
     
    tatoforever likes this.
  49. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,082
    If you guys have a custom renderer with custom shadows and need help integrating NGSS on it, please let me know.
     
  50. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,646
    Nice. I hope this will not be an abandoned version.
     
unityunity