Search Unity

[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:
    3,964
    Folks,
    I'm prototyping a Depthmap shadow caching feature for directional shadows to save drawcalls for static objects. And update the depthmap only for dynamic ones.
    This will save CPU time a lot because only dynamic meshes will get rendered to depthmaps, static meshes will only rendered once. This will once for all surpass Unity shadows performance by a very large marge. :cool:
    In the future give you control over which depthmap (static or dynamic) renders when. My initial prototype is displaying a gigantic perf gain, specially on large populated open areas and VR gaming.
    Shadow Caching is coming for v2.1. ;)
     
    Invertex, OCASM, Pawige and 7 others like this.
  2. Pheck

    Pheck

    Joined:
    Jul 9, 2009
    Posts:
    179
    When is 2.1 out... that improvement would be right up my design. :)
     
    tatoforever likes this.
  3. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    3,964
    Version 2.1 is a big update, is planned for this summer.
     
  4. 3d_Artist1987

    3d_Artist1987

    Joined:
    Jul 9, 2012
    Posts:
    719
    Hi,
    This asset can work with ios (metal)?
    Thanks
     
  5. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    3,964
  6. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    111
    What are the features of version 2.1 ?btw I hope you're not the using the Nvidia rtx because it is severely limited at the time and not so great either
     
  7. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    3,964
    @Ruchir,
    - Shadow Caching (first iteration, Directional Light)
    - Custom blue noise texture support (for all shadows)
    - Improved NGSS libraries installer (avoid UnityHub freeze)
    - Improved NGSS components (apply uniform changes when needed)
    - Local ContactShadows (first iteration on Deferred only)
    - Improved Shadowmask blending with real-time shadows (better than Unity one)
    - Improved light falloff (better than Unity one)
    - New friendly inspector
    - Primitive Shadows (experimental state, requires manual integration into shaders)

    The Unity DXR implementation is unfinished and un-optimized. It will get better over-time. In any case, I'm waiting for a more matured/close to finish version of HDRP before diving in deep anyways but I have plans to integrate raytracing into NGSS, just not yet. Once it make sense to use raytracing, I will use 1 ray to do raytraced shadows and NGSS to filter it. Im also testing other non traditional ways of shadowing such as voxels shadows and the like. ;)
     
    OCASM and alternativevisual like this.
  8. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,042
    I tried the suggestion above to improve performance by importing the Directional Light shaders, then setting cascades to zero, but it didn't help for me. So I uninstalled those shaders, but now I have a problem: With or with NGSS Directional Light component on the Dir. Light, I get shadows in the editor -- but not in a build.

    I've tried installing, restarting Unity, then uninstalling them again (all in Admin mode of course), and no help. I *think* the culprit is NGSS because if I enable the NGSS Directional Light component on the Dir. Light, then I do get shadows in the build, but I get notably worse performance -- and notably worse than in the editor (60-75fps in editor, 50-54 in build). This is on Windows, Unity 2018.3.9. Can you suggest anything to resolve this?
     
  9. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    3,964
    @gecko
    If you install the NGSS Directional libraries and you are looking for maximum performance, you should disable Cascaded Shadows in the Editor Graphics Settings (tiers). This is the fastest NGSS directional path (if you are looking for good looking shadows with max render speed). If you leave Cascaded Shadows enabled in the Graphics Settings, NGSS Denoiser will remain active.

    If you uninstall the NGSS Directional libraries, you still have to remove the NGSS_Directional component from your light as it will keep producing NGSS shadows if enabled. Before removing the component make sure to uncheck "NGSS_KEEP_ONDISABLE".

    After uninstalling NGSS, if you keep having poor performance is not NGSS is something else in your project. The only way you will have problem with NGSS is if you are already GPU bound. But like anything else, once you are GPU bound, there's nothing else you can add to render, you need to balance GPU resources.
     
    Last edited: Apr 7, 2019
  10. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    111
    In the hdrp github package it looked like they are doing something like the voxelized shadow maps ,maybe you wanna take a look
     
    tatoforever likes this.
  11. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    725
    Hi @tatoforever, I recently upgraded to Unity 2018.3.11f1 and I'm having issues with NGSS. Everything was fine in 2017. I tried uninstalling it and reinstalling it to no avail.

    The issue is the shadows from the sun's directional light tremble when I rotate the scene camera (the game camera doesn't exhibit any issues), almost as if the sun's position were changing a little and jumping back (which it is not).

    Is that a known issue? Also just so you know, I'm using Enviro.

    Here are the settings on the Enviro directional light, if that can help:

     
  12. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    3,964
    @Seith
    That is unknown. Do you have a video of the issue? Does it happen with Unity shadows?
     
  13. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    725
    Thanks for your quick reply! Well I feel silly but it would seem the issue was caused by the near-clip-plane of the scene camera. It was acting up but only with the directional light shadows (the point-light shadows were unaffected).

    Once the focus was reset by pressing "F" the directional shadows ceased to flicker like crazy. In other words, chalk this one up to user error! Sorry for the false alarm! :)
     
    hopeful and tatoforever like this.
  14. Onat-H

    Onat-H

    Joined:
    Mar 11, 2015
    Posts:
    79
    Hi @tatoforever, we just moved to Unity 2019.1 and HDRP already feels much more mature. Is there any roadmap for HDRP support already? Can't wait to try out NGSS in HDRP :) Besides of that, I guess it will have a great impact on performance right? Based on your experiments, do you already have an idea of the performance compared with Unitys own shadows?

    Cheers
     
    tatoforever likes this.
  15. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    3,964
    Hey ho Onat! :)
    Yes both HDRP and LWRP are planned for this year, starting with LWRP then following with HDRP. Before that we will have 2.1-2.2 versions that would bring couple of features to the Standard renderer version of NGSS. All that will be backported too SRP versions.
    PS: How is Harold coming along? Waiting to get my hands on it! :cool:
    Cheers,
     
    Onat-H likes this.
  16. Onat-H

    Onat-H

    Joined:
    Mar 11, 2015
    Posts:
    79
    That's exciting! We are making great progress, rendering looks even nice now, and with Unitys aquisition of Granite, I guess soon one of the key techs for us will be available directly inside Unity :) The other key tech is dependent on you ;) :D
     
    tatoforever likes this.
  17. Weendie-Games

    Weendie-Games

    Joined:
    Feb 17, 2015
    Posts:
    60
    Those are the new features comparing to the NGSS 1? Which are the main differences between the versions?
     
  18. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    3,964
    @Weendie-Games,
    Those are the features compared to NGSS v2.0.x.
    The features compared to v1 are numerous. Most notable ones: Denoiser, shadows dithering, quality improvements, libraries installer, optimized directional shadows, improvements to ContactShadows, among others.
     
    Weendie-Games likes this.
  19. lorddesu

    lorddesu

    Joined:
    Aug 20, 2014
    Posts:
    26
    Can you clarify one thing for me plz. So if I disable NGSS component on light sources my project now use build-in libraries right? Or I need to completely uninstall NGSS libs?
     
  20. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    3,964
    @lorddesu
    If you disable NGSS components in your project, you just disabled the components (NGSS libraries won't get feed anymore) but you still have to uninstall NGSS libraries if you want to use or get back to default built-in libraries.
    If what you are looking is to scale quality, do it by reducing the shadowmap resolution and sampling.
    Cheers,
     
    Last edited: Apr 22, 2019
    hopeful likes this.
  21. timsoret

    timsoret

    Joined:
    Apr 9, 2015
    Posts:
    14
    Stellar work. NGSS is becoming a key part of the look of our game, The Last Night.
    By blending the penumbras of colored lights, we are getting an insane next-gen look.

    However, we use a massive amount of volumetric lights (which sample shadows many times along their axis), and weirdly with NGSS, the combination of two completely tanks the performance, making it unusable for us. Any idea? Seems like the volumetrics are sampling the NGSS shadows, maybe we could directly sample into cheaper unfiltered shadows?
     
    alternativevisual likes this.
  22. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    3,964
    @timsoret
    Yes, you should sample hard shadows when using volumetrics as they have a multi-pass filter that blurs out the volumes anyway (no need to sample NGSS with any volumetric).
    It doesn't take much time to implement it. If you need help setting it out, poke me at support email. I can quickly make the changes to your custom renderer.
     
  23. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    3,964
    For v2.1 I improved PCSS algorithm for spot shadows. Instead of blurring over distance (which conflicts with hardening over distance) it behaves more physically correct. Similar to PCSS Point Shadows. PCF remains unchanged.
    I'm improving a bit more PCSS algorithms (specially the bias methods) and finding a way to add derivative gradient bias to Point Shadows. With point shadows it's a bit more hairy cause we are dealing with directions and looks like no body did it before. No worries, I'll hack my way through. :cool:
    Lot of shiny goodies (visual improvements, new features and performance enhancements for v2.1). :)

    Lastly, I'm getting shoulder surgery this Friday (April the 26th) so I won't immediate answer any support email or forum question for a couple of days cause my arm will be completely freeze, so do I. I injured my self playing baseball couple of years ago and I've been dealing with painful shoulder problems since then. Every year is getting worse and worse and it's starting to affect my sleep and my work considerably. I had enough and I'm proceeding to surgery to fix it. :(
    I'll take 1 week off but I'll do my best to answer when I can. Hopefully I should be able to get back to work with one arm on May the 6th. :oops:
    Plans remain the same, nothing is changed, 2.1 should land before summer and HDRP/LWRP should land afterwards.
    Cheers and love, :)
     
  24. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,010
    Best wishes on your surgery, and I hope you have a speedy recovery! :)
     
  25. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    3,964
    I also found a tiny bug with Spot shadows PCF algorithm (penumbra gets pixelated when light range and distance to receiver have similar values). For example if your light range is 15 and you move your light at 10units yo will see the artifacts. I fixed this for v2.1 too. :)
     
  26. DavoMyan

    DavoMyan

    Joined:
    Jan 5, 2017
    Posts:
    15
    Anyone know when HDRP support is coming?



    Also, is it better to use HDRP with the bad Unity shadows or just normal 3D with NGSS?
     
  27. id0

    id0

    Joined:
    Nov 23, 2012
    Posts:
    347
    DavoMyan it's up to you. I'm using HDRP, but still waiting for NGSS shadows. HDRP is cool and fast, but still has a lot of problems, because it is not yet released.
     
    tatoforever likes this.
  28. f0ff886f

    f0ff886f

    Joined:
    Nov 1, 2015
    Posts:
    168
    Hello, first off I hope the surgery went well and you will recover quickly :)

    Whenever you're back, I have a question and I'm not sure which asset is to be investigated since my build log references a warning in two simultaneously (Beautiful Dissolves and NGSS 2 :D)

    You are much more active so I thought I'd ask here first.

    I get this in my build log:

    Code (csharp):
    1.  
    2. [00:57:08]
    3. [Step 2/4] Shader warning in 'Beautiful Dissolves/Standard Dissolve': use of potentially uninitialized variable (UnitySampleShadowmapNGSS) at /Program Files/Unity/Editor/Data/CGIncludes/UnityShadowLibrary.cginc(375) (on d3d11)
    4. [00:57:08]
    5. [Step 2/4]
    6. [00:57:08]
    7. [Step 2/4] Compiling Fragment program with UNITY_PASS_FORWARDADD SPOT SHADOWS_DEPTH _NORMALMAP _ALPHAPREMULTIPLY_ON _DETAIL_MULX2 _PARALLAXMAP _METALLICGLOSSMAP _EDGECOLORRAMP_USE
    8. [00:57:08]
    9. [Step 2/4] 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_HARDWARE_TIER3 UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_RGBM_ENCODING
    10. [00:57:08]
    11. [Step 2/4]
    12. [00:57:08]
    13. [Step 2/4] (Filename: /Program Files/Unity/Editor/Data/CGIncludes/UnityShadowLibrary.cginc Line: 375)
    14. [00:57:08]
    15. [Step 2/4]
    16. [00:57:08]
    17. [Step 2/4] Shader warning in 'Beautiful Dissolves/Standard Dissolve': use of potentially uninitialized variable (UnitySampleShadowmapNGSS) at /Program Files/Unity/Editor/Data/CGIncludes/UnityShadowLibrary.cginc(585) (on d3d11)
    18. [00:57:08]
    19. [Step 2/4]
    20. [00:57:08]
    21. [Step 2/4] Compiling Fragment program with UNITY_PASS_FORWARDADD POINT_COOKIE SHADOWS_CUBE _NORMALMAP _ALPHAPREMULTIPLY_ON _DETAIL_MULX2 _PARALLAXMAP _METALLICGLOSSMAP _EDGECOLORRAMP_USE
    22. [00:57:08]
    23. [Step 2/4] 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_HARDWARE_TIER3 UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_RGBM_ENCODING
    24. [00:57:08]
    25. [Step 2/4]
    26. [00:57:08]
    27. [Step 2/4] (Filename: /Program Files/Unity/Editor/Data/CGIncludes/UnityShadowLibrary.cginc Line: 585)
    28.  
    line 375 for example seems to be:
    Code (csharp):
    1.  
    2.        #if defined(UNITY_FAST_COHERENT_DYNAMIC_BRANCHING)
    3.        } < LINE 375
    4.        #endif
    5.  
    Same for 585. I don't even know where UNITY_FAST_COHERENT_DYNAMIC_BRANCHING comes from, do you have any idea what could be going on?

    **EDIT** Actually it doesn't seem to be exclusive to Beautiful Dissolves, I get the same issue with the Standard shader:

    Code (csharp):
    1.  
    2. [03:05:35]
    3. [Step 2/4] Compiled shader 'Standard' in 13.36s
    4. [03:05:35]
    5. [Step 2/4] d3d11 (total internal programs: 58392, unique: 32921)
    6. [03:05:35]
    7. [Step 2/4] Shader warning in 'Standard': use of potentially uninitialized variable (UnitySampleShadowmapNGSS) at UnityShadowLibrary.cginc(375) (on d3d11)
    8. [03:05:35]
    9. [Step 2/4]
    10. [03:05:35]
    11. [Step 2/4] Compiling Fragment program with UNITY_PASS_FORWARDADD SPOT SHADOWS_DEPTH _NORMALMAP _SPECULARHIGHLIGHTS_OFF
    12. [03:05:35]
    13. [Step 2/4] Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF2 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_HARDWARE_TIER2 UNITY_LIGHTMAP_RGBM_ENCODING
    14. [03:05:35]
    15. [Step 2/4]
    16. [03:05:35]
    17. [Step 2/4] (Filename: UnityShadowLibrary.cginc Line: 375)
    18. [03:05:35]
    19. [Step 2/4]
    20. [03:05:35]
    21. [Step 2/4] Shader warning in 'Standard': use of potentially uninitialized variable (UnitySampleShadowmapNGSS) at UnityShadowLibrary.cginc(585) (on d3d11)
    22. [03:05:35]
    23. [Step 2/4]
    24. [03:05:35]
    25. [Step 2/4] Compiling Fragment program with UNITY_PASS_FORWARDADD POINT SHADOWS_CUBE _NORMALMAP _SPECULARHIGHLIGHTS_OFF
    26. [03:05:35]
    27. [Step 2/4] Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF2 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_HARDWARE_TIER2 UNITY_LIGHTMAP_RGBM_ENCODING
    28. [03:05:35]
    29. [Step 2/4]
    30. [03:05:35]
    31. [Step 2/4] (Filename: UnityShadowLibrary.cginc Line: 585)
    32.  
     
    Last edited: Apr 29, 2019
  29. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    3,964
    @f0ff886f,
    I'm in one hand slowmo typing through a cellphone but here is.
    The fast coherent branching is an if call that I do when test and sampling numbers are equals. In that case we don't need to test anything as its waste re-doing the same sampling and having the same result. We only test when the test sampling is smaller than filter sampling amount.
    The warning comes from some platforms doesn't define fast coherent branching. In that case, the branching will probably cost around 6 instructions but still better than performing multiple sampling for nothing. You can safely ignore those warnings.
     
    Last edited: Apr 29, 2019
  30. f0ff886f

    f0ff886f

    Joined:
    Nov 1, 2015
    Posts:
    168
    Ah jeez, now I feel guilty for asking, you should rest! Thank you, I will ignore these.
     
    tatoforever likes this.
  31. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    3,964
    No worries, i updated my initial answer with more details. :)
    PS: I'm doing great, its painful but I'm getting through!
     
  32. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    3,964
    @DavoMyan,
    HDRP is planned after v2.1 (which is coming around this summer). And before HDRP, LWRP will come first as it's a more stable and smaller to tackler renderer. All NGSS SRP versions are planned for this year.
    Obviously, NGSS shadows are nicer and smoother than any Unity shadows but the choice of the renderer must be carefully done based on your project current/future needs. Keep in mind that HDRP still evolving and will surely change before final release. It's not yet production ready.
    Cheers,
     
  33. Invertex

    Invertex

    Joined:
    Nov 7, 2013
    Posts:
    971
    I'm guessing it should be safe to comment out GLOBAL_CASCADED_SHADOWS and GLOBAL_CASCADED_SHADOWS_STATE correct? Since you have the code that uses it currently commented out. It leaves two annoying warnings in the console when scripts recompile about the value never being used.
     
  34. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    3,964
    @Invertex,
    Yeah, I'm taking care of it for v2.1.
     
  35. Rich_A

    Rich_A

    Joined:
    Nov 22, 2016
    Posts:
    222
    I have about 500 lights split over 30 scenes.

    I want to test NGSS before replacing everything.

    Can I add the ngss component to eg. 5 scenes and all their lights, just to test? What will happen to the other scenes after restart - will I break the project or just need to add the component into those other scene lights as well?

    Do I need to add the NGSS component to baked lights, or just mixed and realtime?
     
  36. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    3,964
    Hi Rich_A,
    You only need to add the NGSS component to only one of your scene lights and check the NGSS_MANAGE_GLOBAL_SETTINGS (this will feed globally the renderer for all active lights in your scene). To manage individual light properties such as soft-ness or resolution, you need to add the component to these lights too. It won't break anything in your current lighting setup.

    As for baked lights, you only add the NGSS components to dynamic lights, anything that is baked or does not produce dynamic shadows don't need the component. Plus, you only have to add to 1 light for the base global setup and to individual if you want to tweak soft-ness/shadowmap resolution.
    Cheers,
     
    Rich_A likes this.
  37. Sam512

    Sam512

    Joined:
    Jan 13, 2019
    Posts:
    178
    Hey!
    If I once install the NGSS, do I need to install again in other projects?
     
  38. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    3,964
    @unity_c1ndWE1Nn46iPg,
    You install the NGSS library once and it will remain within Unity install path till you update it (you can can always check if the library is installed with the NGSS library tool that comes with v2).
    If you have multiple projects, what you have to do is to delete their shader cache (Library/ShaderCache folder) only once so Unity will rebuild the internal shader cache folder (Default renderer files which contains the NGSS ones).
    Let me know if it's clear.
     
  39. Sam512

    Sam512

    Joined:
    Jan 13, 2019
    Posts:
    178
    I installed it in my backup project to test, then I imported the asset to my real project. And this appear to be already installed. So should I delete cache or leave it that way? sorry poor English
     

    Attached Files:

  40. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    3,964
    @unity_c1ndWE1Nn46iPg,
    If you installed the libraries with another project yes you have to delete the current project Library/ShaderCache folder in order to get the NGSS shadows. This step is done only once per NGSS/Unity/Project install.
     
  41. Sam512

    Sam512

    Joined:
    Jan 13, 2019
    Posts:
    178
    Delete only ShaderCache folder, not those two above, right?
     
  42. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    3,964
    Only the ShaderCache folder yes.
     
  43. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    208
    Hello

    I have a question to make my decision to buy this assett.

    My game is based on wide grounds. It's an off-road car racing game. In fact, when the cars are going at full speed, the details are not appreciated much, but I want them to be good when the car is stopped.

    My frames are very close. Between Vegetation Studio Pro, Aquas, Enviro, Trees, shrubs ... it is at the limit.

    And my question is the following.

    Does this tool "punish" the rendering or, on the contrary, improve the performance?

    Thank you.
     
  44. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    3,964
    @Barritico
    If you are already maxed out on the GPU, it will tax it if you abuse the quality. Shadows are by nature very heavy. If you want pretty shadows, allow some ressources to it! ;)
    Cheers,
     
    Barritico likes this.
  45. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    208
    Thanks for your quick and honest response.
     
  46. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    3,964
    @Barritico
    You can always give it a go, tweak shadows quality/performance and see if you like the results. I always offer full refund if you don't like it or if it doesn't fit your project after purchase.
     
    Barritico likes this.
  47. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,042
    Can you give any more details about this yet? So this is sort of like on-the-fly baked lightmaps in distant shadowmask mode?

    Specifically, would it work well in my situation? :) I have a large open outdoor world (7x7km), with a dynamic day/night cycle, and lots of trees (static) plus characters moving around (dynamic). With the shadow caching, could we set the cache to update every several minutes (so then the tree shadows would jump to match the sun's current position, which isn't ideal but tolerable on lesser hardware)? If so, any idea how big of a spike we'd see at those moments of updating?

    Also, is the savings only on CPU, or also on GPU? I'm not really clear on how the work of calculating and drawing shadows is divided between the two. We are GPU bound, so mostly care about that....

    thanks!
     
  48. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    3,964
    @gecko
    Yes, you can update both shadowmaps (static and dynamic) with a simple two bool properties check when/however you want. I have no idea how the spike will be but certainly if there's any, it won't be because of this technique. Probably Unity warming up some data (occlusion, mesh, material, using main thread on new instanced behaviors, etc) as what I do is simply switching rendering layers for the shadowmaps rendering. Both static and dynamic shadowmaps remains on the GPU from start to finish. So it's really up to the end user/Unity to provide ways to warmup data to avoid hickups/spikes.
    When you manually update the static shadowmap you will have similar performance to current version (drawcall number wont change). When you stop updating the static shadowmap the performance will increase and the drawcall will minimize. It will go from your current number (whole scene rendered twice) to whatever number of dynamic/moving entities (and their materials/passes) are.
    I believe based on the video conference we did that you are CPU bound. As your game is an open world and you have many drawcalls.
    Btw, I would like to get in touch with you soon (in a week or so) when v2.1 reach preview state and do some tests together with your open world game. :)
     
    OCASM likes this.
  49. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,042
    thanks for the detailed answer! We're definitely GPU bound (FPS goes up if I shrink the game canvas size, so fillrate is the big problem). Shadows on GPU profiler are 3-8ms at HD resolution on GTX 1060 (greatly affected by number of cascades). So caching will help, right? I'd be very keen to test 2.1 as soon as it's ready for that. Thanks!
     
  50. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    3,964
    If your game spend lot of time rendering, Shadows Cache will definitely help yes.
     
    gecko likes this.
unityunity