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. TeohRIK

    TeohRIK

    Joined:
    Jan 22, 2014
    Posts:
    106
    Just curious do I need to rebake my lightmap after I switch to NGSS?
     
  2. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @TeohRIK
    No, it will work out of the box. :cool:
     
  3. tspk91

    tspk91

    Joined:
    Nov 19, 2014
    Posts:
    131
    Hi, can I use cascaded directional shadows in one light and non-cascaded directional shadows in other light? My game divides the world in cockpit view, which needs lowres non-cascaded shadows, and the external world which does need cascades. An ugly workaround would be to use a spot light.
     
  4. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    395
    considering the scale of a cockpit, I'd think a spot light would be directional enough for the job, and they don't have cascades.
     
    hopeful likes this.
  5. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @tspk91
    It's possible yes but what @ceebeee suggested is way less heavier.
     
  6. tspk91

    tspk91

    Joined:
    Nov 19, 2014
    Posts:
    131
    Ok, I tried the spotlight and it sort of works but I would like to try the other way. Can it be done by tweaking some settings or shader lines or does it require deep work?
     
  7. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @tspk91
    No, Unity doesn't allow multiple directional lights with and without cascades. It's either all with cascades or all without cascades.
    PS: If I'm not mistaken, your secondary Directional Light won't even have screen-space shadows, standard cascaded ones with basic filtering. Disabled by Unity for performance reasons.
     
  8. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    I bought this asset sometime ago last year to try on the consoles, but I found it was slower than the Uniy one for me.

    In my case, I need to have fastest single directional soft shadow at lowest setting possible. So when I used default Unity one, I have set it to be low resolution with softshadow enabled.

    That was last year, so I was wondering if there has been any difference/improvement to this asset that I should know about? I am not sure if it is going to be worth while again to try this again.

    Is there any approximation mode to the softshadow that this asset provide to make it run faster than the default Unity directional soft shadow at the lowest resolution setting? (No cascade, Cloest fit)

    I would even go as far as considering spot light than directional light too. Will spot light shadow with this asset be faster than Unity's default spot light soft shadow?
     
    Last edited: Apr 13, 2018
  9. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    395
    The point of this package is to make the shadows softer and improve their quality, not to make shadows render faster. You don't get something for nothing (or negative nothing, which would be the case if it was faster). So i'm going to go with a bit no on that.
     
    buttmatrix likes this.
  10. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @castor76
    NGSS got improved lately, specially on the visual department but yeah as other folks pointed out, you never get something for free.
    If you bought the package I would invite you to try the last version and give it a go.
    You can always reach me out through support email and I'll be happy to help you get the look and feel (and rendering speed) you want for your shadows. :)
     
  11. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    By all means I am not asking for soft shadow to be free. Just wanted to find if it will be faster than default unity one if their look is comparable.

    Having said that i will try it again.
     
  12. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
  13. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    upload_2018-4-15_14-27-50.png

    Here is my setting. Is this the fastest setting I can get? I am looking the fastest soft shadow setting that is possible that is not default unity hard shadow. The softness quality is not important. I want the fastest possible setting.

    I don't have any cascade, and I use Closefit. Low resolution shadow map.

    Have I got this right?
     
  14. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @castor76
    Yep, that is the lowest/fastest setting.
     
  15. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Thanks. Does global_Softness affect performance in anyway?
     
  16. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    Not really, but you are free to experiment.
    Also lowering the amount of cascades gives you even faster results.
     
  17. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    Side note.
    My brother runs a Rust community server with custom Mods.
    He recently told me to helm him out with some custom server side code in Rust and I found this:

    It's an old version of NGSS (before the command buffer was removed).
    To any Facepunch folk outhere, update to the latest version of NGSS! It's prettier and faster! ;)

    PS: For those who don't know, Rust is one of the most successful commercial Unity game, it's a multiplayer survival game and it's also one of my fav all-time games. :)
     
    Last edited: Apr 16, 2018
  18. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    Current works on NGSS hemispherical omni shadows for LW pipeline is looking good. Only 3 render faces sharing the same main shadow atlas for a 180 degrees of shadows (the other half is skipped as un shadowed saving twice the cost of rendering omni shadows in default/HD pipeline). If you need 360 degrees of shadows you can combine two of those (I will provide 180/360 light prefabs ready anyway) or I'll do it internally and let you tick a flag on the light component for 180/360 shadows rendering.
    Denoising and bilateral shadows filtering requires screen depth to avoid light leaking in shadows. Fortunately LW pipeline gives you the option (and it's free if you have Directional shadows enabled). In case of no directional shadows or screen depth presence, you can opt-out entirely of bilateral filtering and apply more taps and denoise only. In any case it will be faster than current NGSS. :cool:
    I'm also testing out the initial dual-paraboloid technique using only two render faces (stretched out to 180 degrees) but is not looking really great and the cost in rendering is similar to the 3 face technique as both techniques shares the same shadow atlas. So I'll probably ditch it out. Expect more screens soon. ;)
     
    ekergraphics and Invertex like this.
  19. ekergraphics

    ekergraphics

    Joined:
    Feb 22, 2017
    Posts:
    257
    Will NGSS enable shadows from more than one shadow caster in LWRP?

    (A massive limitation, currently.)
     
  20. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @ekergraphics
    Yes,
    Depending the target shading model level, If targeting SM2.0 you will remain with the same limitation as default LWRP (no point light shadows). If targeting SM3.0+ you will be able to have all 8 closest lights casting any kind of shadows (if they are not all point lights). If all lights are onmi that amount can vary. It can go from 2 to 4 closest point lights casting shadows due to the heavy nature of point shadows (3-6 faces instead of just one). I know some people will try to abuse it on very weak low-end hardware but it's up to the user to configure it depending on it's target hardware.

    There's also the Primitive Shadows system which to my knowledge will probably be the fav default shadows system for low-end devices. I'm working now on culling groups for casters culling and looking for some ways to give users the choice of stream buffers data directly to shaders to avoid iterative recursion. This may work on some APIs and not on others, more news of this feature very soon.
     
    ekergraphics likes this.
  21. rstorm000

    rstorm000

    Joined:
    Aug 19, 2010
    Posts:
    229
    hi @tatoforever . I've just seen this. Sorry I haven't read every page of this thread, but are you saying the current version of this is faster than Unity's soft shadows? If so do you know by how much? Is there anything this is dependent on? I have a scene with ~ 300 shadow casters
     
  22. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @rstorm000
    Hi, it's hard to say exact numbers but in general NGSS rendering speed depends on the quality settings of Directional shadows and your GPU.
    NGSS is a replacement for Unity build-in shadows, so it works on the same platforms and depends on the same things.
     
  23. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    The quick answer is no. I bought it to test for mobile and it did not work better than Unity shadows for me so a bit disappointed there. If you are running a high end game then it should be fine.
     
    Last edited: Apr 25, 2018
  24. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @SilverStorm
    Unity shadows on mobile are forced by default to HardShadows, you cannot expect multiple samplers vs 1spp to be faster. NGSS rendering is similar in performance when similar amount of fetch per frag are used on both sides.
    The upcoming version of NGSS will provide high quality raytraced primitive shadows on mobile at interactive speeds.
     
    Last edited: Apr 25, 2018
  25. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    Hmm sounds good....
     
    tatoforever likes this.
  26. candycat

    candycat

    Joined:
    Jun 5, 2014
    Posts:
    29
    NGSS_ContactShadows.cs will cause memory leak due to that it gets temporary RTs without releasing them. Take a look at the Init() function in NGSS_ContactShadows.cs:
    Code (CSharp):
    1. void Init()
    2.     {
    3.         ...
    4.  
    5.         AddCommandBuffers();
    6.  
    7.         int cShadow = Shader.PropertyToID("NGSS_ContactShadowRT");
    8.         int dSource = Shader.PropertyToID("NGSS_DepthSourceRT");
    9.        
    10.         // Get temporary RTs without releasing them
    11.         computeShadowsCB.GetTemporaryRT(cShadow, -1, -1, 0, FilterMode.Bilinear, RenderTextureFormat.R8);
    12.         computeShadowsCB.GetTemporaryRT(dSource, -1, -1, 0, FilterMode.Point, RenderTextureFormat.RFloat);
    13.  
    14.         computeShadowsCB.Blit(cShadow, dSource, mMaterial, 0);//clip edges
    15.         computeShadowsCB.Blit(dSource, cShadow, mMaterial, 1);//compute ssrt shadows
    16.         computeShadowsCB.Blit(cShadow, dSource, mMaterial, 2);//filter ssrt shadows
    17.         blendShadowsCB.Blit(BuiltinRenderTextureType.CurrentActive, BuiltinRenderTextureType.CurrentActive, mMaterial, 3);//mix with screen space shadow mask
    18.  
    19.         computeShadowsCB.SetGlobalTexture("NGSS_ContactShadowsTexture", dSource);
    20.  
    21.         isInitialized = true;
    22.     }
     
  27. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @candycat
    No, it won"t:
    Release the temporary render texture using ReleaseTemporaryRT, passing the same nameID. Any temporary textures that were not explicitly released will be removed after camera is done rendering, or after Graphics.ExecuteCommandBuffer is done."
    No worries. :cool:
     
    Last edited: Apr 26, 2018
    buttmatrix likes this.
  28. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    395
    I know this is kind of out of left field, but I'm pretty curious.

    As you may or may not know, there's a package Unity has on the asset store to make 'Unique Character shadows":

    https://www.assetstore.unity3d.com/en/#!/content/39921

    It's kind of broken with the latest Unity versions, but people in the comments have stated fixes, and I finally got it working the other day.

    Off:


    On:


    So the thing is, it has it's own very simple implementation of PCSS. And I can't keep help but wonder, what if this was brought up to the quality of NGSS. Is this something you'd ever considering making an NGSS-ified version of? Would it be worth the effort even? I guess it doesn't look bad as it is, I'm not sure how much it could be improved, I don't know enough about shadow rendering. But I know someone who does... ;) Had to ask.
     
  29. No0B25

    No0B25

    Joined:
    May 2, 2016
    Posts:
    70
    I guess that's what you'd use the NGSS-integrated contact shadows for. I haven't used this character shadow package personally, but judging from screenshots of its settings I'd assume it's probably a little more flexible, but also more taxing on performance.
     
  30. brisingre

    brisingre

    Joined:
    Nov 8, 2009
    Posts:
    277
    It's a pretty different approach from contact shadows. Basically it uses regular shadow mapping, but instead of drawing a map that covers a whole light, it just covers one object in a lot of detail. It's like having a special directional light cascade that just covers one object.

    Couldn't tell you anything about the pros and cons of that vs contact shadows. More flexible but less performant sounds about right.
     
  31. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    I also took a look at this package a while back and it does detailed character shadows by using a huge shadowmap texture with a really short range (very close to the camera). So yeah, it's taxing cause it re-render your close up scene twice. Also integration wise is not something that can be plugged easily, you need to modify shaders.

    Shadowmap wise, besides the optimizations (that will bring more quality) I think we are pretty much done/stuck with. People and I'm pretty sure Unity itself they are just waiting for some raytraced approximations in combination with denoising (that's what I'm researching now btw).
    I think a combination of contact shadows and Primitive raytraced shadows will be huge. You are limited to primitive casters (and down the road to static meshes) but geez the quality and the speed is just soo good. I also added GPU and CPU multithreaded primitive culling using a combination of native culling system and C# Jobs, it will allow you to deal with a huge amount of casters (in case you want to fill your whole scene with). The bottleneck will remain your GPU instruction count but it's bandwidth friendly as nothing is being fetch or copied to. The cost of one light casting raytraced primitive shadows is pretty much none. You can have as many light casting primitive shadows as long as you are not running out of shader instructions.
    There's a console project that will soon integrate an early version of it using HD pipeline and will be showcased at Unite in June. Hopefully we can have some beatiful imagery/videos to show the power of new NGSS raytraced primitive shadows. :)
     
  32. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    I still don't understand the workflow using primitive raytraced shadows. I took from it that static proxy meshes would need to be in place for the effect to work, but how is this generalized to arbitrary geometry?
     
  33. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @buttmatrix
    You will approximate it placing multiple primitive casters within. If the mesh is organic or complex then you will wanna use a distance field volume representation of that mesh (similar to what UE does). If you want to cast super ultra soft shadows you don't really need to be 100% accurate with your shadow casters as shadows will be cased all over the place anyway and this is when Contact Raymarched shadows will fill that gap, seft shadowing, incorrect placement, etc.
    Remember back in the stencil shadows days? When dev placed simple geometry within complex meshes to cast hard fil-rate intensive shadows? Pretty much the same, only that you will have raytraced ultra soft-shadows. :D
    It will pretty much depends on your game. For example on mobile it will be highly requested as we won't see good looking shadows on mobile in a while. This can be a good chance to put out something new on that side.
    Primitive Shadows will primary be used for characters and dynamic objects (and furthermore for static meshes). Buy it's fine if you want to fill your whole scene with, it's cheaply fast and looks gorgeously nice. :)
    Another good plus of raytraced shadows is that you can cast it from pretty much any distance, 10000000m, it will look fine, artifacts free.
    PS: The primitive casters you will be using, will never be rendered (besides in the Editor view and it's only for a visual representation of the caster transform) cause they are just analytical functions that are created in the GPU when shading your scene.
     
    Last edited: Apr 26, 2018
    OCASM and buttmatrix like this.
  34. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    395
    Ok, thanks for the feeback on the Unique shadows. I'm still not convinced it's that much more taxing than a screen-space effect like Contact Shadows, that has to render everything in view twice, versus just what is around a single character. but i'll do some tests and see :)

    As for the other, I'm not really clear what you're talking about, but anything that doesn't support skinned meshes doesn't sound like a complete solution. (However I have no plans to move to 2018 anyway, so probably doesn't affect me, my game is fixing at 2017, I can't afford to start over with a whole new render pipeline at this point)
     
  35. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @ceebeee
    Screen depth is free if you have cascaded shadows enabled or in deferred rendering mode. In HD pipeline they are free all the time as light clustering is done with a depth pre-pass. ContactShadows are mostly a screen space effect (equivalent to a basic AO effect). So yeah, character shadows are more taxing cause it have to be added on top of al that no matter what but if it provides the look/feel you are looking for and you can afford it, heck yeah go for it. :)
    The future of NGSS are both, improvements to shadowmaps techniques (visuals/speed) and distance field raytraced shadows.
    UE does capsule shadows on characters pretty much the same way, only that with Primitive Shadows you have more shapes (primitives) to work with, thus you are not really limited to characters, regular scene objects or structures/architecture can be approximated too.
     
    Elecman, OCASM and ceebeee like this.
  36. Danua

    Danua

    Joined:
    Feb 20, 2015
    Posts:
    197
    So what with develop? HDRp acutually realesed, but it preview of course.
     
  37. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @Danua
    New version of NGSS is targetted for this summer (for both pipelines). I've partnered with couple of developers that will soon have an early version of it.
    Small note, HD Pipeline will hit stable/final version in Unity 2018.3 an it was said it will keep changing/improving/etc from now to there.
     
    buttmatrix and hopeful like this.
  38. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    Couple of developers?
     
  39. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @buttmatrix
    Yeah, developers already working with HD/LW pipelines that will integrate early versions of upcoming NGSS in their projects and provide early feedback, etc.
    I'll provide videos of some of new NGSS shadowing working on those projects soon! ;)
     
    buttmatrix likes this.
  40. Danua

    Danua

    Joined:
    Feb 20, 2015
    Posts:
    197
    Anyone know what to do with terrain in HDRP? We just have pink land, cuz standart shader no longer support in HDRP.
     
  41. Invertex

    Invertex

    Joined:
    Nov 7, 2013
    Posts:
    1,539
    I assume when HDRP is actually properly released, there will be a terrain shader. Right now HDRP is still very much in a beta state. It's to be experimented with right now, but it is far from being finalized and shouldn't really be attempted to be used in production.
     
    tatoforever likes this.
  42. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    HDRP will remain in preview state till 2018.4 and lot of things will change, removed and added in between. Only use it if your project is not mid/end production stage.
     
  43. Tretiak

    Tretiak

    Joined:
    Jan 22, 2018
    Posts:
    49
    Hello, recently bought asset and today i finally got time to try this, i did every step of installation instructions (replace UnityShadowLibrary.cginc and deleted ShaderCache folder), then i started up Unity editor a plenty of red errors came out. 90% of them are like this

    Invalid pass number (8) for Graphics.Blit (Material "Beautify/Beautify" with 1 passes)
    UnityEngine.Graphics:Blit(Texture, RenderTexture, Material, Int32)
    BeautifyEffect.Beautify:OnRenderImage(RenderTexture, RenderTexture) (at Assets/PostProcessing/Beautify/Scripts/Beautify.cs:2817)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)


    and this


    Shader error in 'Beautify/Beautify': failed to open source file: 'BeautifyLum.cginc' at line 105 (on d3d11)

    Compiling Vertex program
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_RGBM_ENCODING


    Im using Unity 2017.3.1f1 and newest Beautify and NGSS versions. I will really appriciate if there is some help you can give me.

    Thanks in advance ! regards
     
  44. Tretiak

    Tretiak

    Joined:
    Jan 22, 2018
    Posts:
    49
    I reverted back my project that excludes NGSS and there were no errors anymore. Then I just deleted ShaderCache folder (without NGSS imported) and same errors appear... I dont know why is this happening.
     
  45. Tretiak

    Tretiak

    Joined:
    Jan 22, 2018
    Posts:
    49
    OK, im pretty newbie so sorry for that, i researched that i had to reimport all that files and now no errors are shown,

    BigUp for great asset

    Regards
     
    wetcircuit, tatoforever and hopeful like this.
  46. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @Felinsky,
    Hey man, no problem. Glad you sorted it out. :)
     
  47. travisschau

    travisschau

    Joined:
    Mar 27, 2013
    Posts:
    13
    Hi, when I open ShowcaseSceneDirectionalLight it looks great. However, if I switch my build platform to iOS, the shadows are returned to ugly standard unity shadows. Is there a quality / graphics setting I need to adjust to fix this when switching to iOS? I'm using Unity 2017.2

    Thank you!
     
  48. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    @travisschau
    Enable Cascaded Shadows in your project graphics settings (by default turned off in mobile platforms).
     
  49. travisschau

    travisschau

    Joined:
    Mar 27, 2013
    Posts:
    13
    Thanks for the quick reply!
    That's one of the things I tried already, unfortunately. Attached is an image of my current settings. Any other ideas?
     

    Attached Files:

  50. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    Show me your Graphics settings.