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:
    4,367
    @TimeTours
    NGSS_ContactShadows is not AO but kinda similar, its a raymarched shadows effect that uses the screen depth to compute distance between objects, thus direct occlusion. The difference is that AO rays are fired from surface normal direction and ContactShadows rays are fired from fragment position to lights pos (fragPosition - lightPosition = rayDirection).
    PS: Yes, all shadows in NGSS are independent, you install what you need. :)
     
    Last edited: Nov 3, 2018
  2. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,367
    @vincespeed
    NGSS_Directional component is required at all times in order for directional shadows to works properly yes.
     
    Last edited: Nov 3, 2018
  3. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,367
    NGSS 2.0 Gaussian Optimized Shadows for low end hardware:


    Cascades was disabled in this video.
    Intended for mobile or if you are looking for nice optimized shadows in your already taxed GPU
    GPU cache friendly, super fast, around 3times faster than current shadows on 16K ShadowsMap size with the largest kernel iteration 9.
    Zero noise, filter iterate through shadows texels only once and does a interpolation accordingly
    Highly dependant on shadowmap size the lower the resolution the softer the shadows the less iterations required the faster to render
    Features a depth gradient bias to fight shadows acne (notice the bias value always at 0 with no visible acne)
    It won't replace current shadows technique, it will be an addition as I'm also working new stuff on current shadows for NGSS v2
     
    Last edited: Nov 4, 2018
  4. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,367
    And coming very very soon to v1.9.6, Improved PCSS algorithm with more realistic distance and grounding effects of shadows, take a look:
     
  5. Brechtos

    Brechtos

    Joined:
    Sep 18, 2014
    Posts:
    18
    Been loving this asset for quite a while @tatoforever as it allows me to have good looking shadows on directional lights, even with very low shadow resolutions (needed for performance reasons on some platforms). The fine control allows me to tweak settings so the shadows don't feel like they are super low res.

    I do have a small issue however. I just updated from the 1.8.5 version I was using to the 1.9.5.2 version on the asset store and noticed that you can control things like the shadows_projection, shadows resolution and cascade count and splits. These however override the quality settings of my project as soon as the component comes into play.
    Meaning I can no longer configure these settings per platform from my unity quality settings (something that I need in order to scale up graphical quality based on my target platform).

    It would be nice if these global quality setting replacements could be disabled/enabled from the inspector and have the overrides turned of by default as it basically breaks the Unity quality scaling functionality completely.

    Having the ShadowResolutions override option for the directional light is also a really cool feature but, with the same idea in mind, it would be nice to have an enum option that basically says: Use the QualitySettingsValue.

    For now I have disabled those nice new features myself but it would be nice to have the above mentioned flexibility in perhaps a future update?

    Thx and keep up the nice work!
     
    Last edited: Nov 6, 2018
    tatoforever likes this.
  6. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,367
    @Brenchtos,
    You are right, they are globally set for all quality levels. I will try to add an easy way to set the level in next update (1.9.6). So you can tweak all levels in the Directional component and will get saved for every quality setting.
    The idea is to have one single place (the NGSS component) for all shadows settings, instead of having lot of Unity Editor panels and windows settings everywhere.
     
    ceebeee and gecko like this.
  7. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,367
    NGSS 2.0 - Extreme soft-shadows filtering with noise stabilizer and low sampling count:

    Still looks good as low as 4 samplers per frag!
    Denoiser was disabled internally to better showcase the difference and avoid any interference!
    Can be combined with denoiser to make it look zillions better and still softer, smoother and faster than Unity default soft-shadows by a large marge!
    Let me know what you think. :)

    NGSS 2.0: What do you folks think of releasing NGSS 2.0 for Standard Pipeline sooner than HD/LW pipeline? Also I'm thinking of adding support for Primitive Shadows into Standard Pipeline. Features will look like this:
    - What you already have in NGSS 1 plus
    - Noise stabilizer
    - Optimized Gaussian filtering
    - Denoiser filtering
    - Depth gradient bias (bye bye peter panning and shadows acne)
    - Primitive Raytraced Shadows*
    - Will require SM3.0
    Primitive Raytraced Shadows can delay initial release if we decide to include it in v2.0 or we can release 2.0 without it and I'll include it in v2.1.
     
    Last edited: Nov 7, 2018
  8. alternativevisual

    alternativevisual

    Joined:
    Apr 16, 2015
    Posts:
    75
    YES YES YES YES!!! Made this!! And add Primitive Shadows into Standard Pipeline! Pleeease!
     
    tatoforever likes this.
  9. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,683
    Using 2.0 for standard pipeline on desktop, would there be any performance improvements? I know this product is normally looking for quality improvements, but just checking. :)
     
    tatoforever likes this.
  10. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,367
    @hopeful
    Yes, lot of performance improvements. Starting from the new Noise Stabilizer which allows you to reduce the sampling as low as 4spp. On top of that, add the new Denoiser and you can get the equivalent of 128 smoothly softly taps with only 24taps! Here is how is possible: 8taps for the base filtering (PCSS or PCF) multiplied by 16taps for the denoiser which acts as a separable filter equals = 128! :)
    So yes, you can get even lower than that and still have extreme soft and nice shadows never seen before.
    In the video below I've demonstrated the new technique with few samplers without Denoising. In my next video I will demonstrate a combination of the Noise Stabilizer + Denoiser with very low sampling 8 for filtering and 8 for denoising.
    PS: The new Noise Stabilizer is only getting values from a tiny array of precomputed values, cheaper than the old noisy version. Still you will have the choice to switch from both techniques as shown in the previous video. :)
     
    Last edited: Nov 7, 2018
  11. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    Considering it's a nice upgrade over NGSS (1.x) and your price point is really fair, I'm all for this. SRPs are out of preview on 2019.1 earliest anyway.
     
    hopeful and tatoforever like this.
  12. Brechtos

    Brechtos

    Joined:
    Sep 18, 2014
    Posts:
    18
    That's great but please do make this optional if possible, specifically regarding the global quality settings that affect the entire project.
    For our project for example we also control some of these settings from our end (related to user determined quality settings, etc etc). Having the option to say: "Use the current Unity quality settings" would give the user the option and control to decide what they would like, based on their needs.

    Preferably with the "Use the current Unity quality settings" setting as the default to avoid unexpected quality setting changes caused by adding the component to your scene (as the script runs in editor mode and directly alters the current quality setting options).

    We already had to deal with a case of "what the hell happened to all our quality configurations" before with other packages and that was one of the reasons why we moved away from them as they didn't provide the needed flexibility :)
     
  13. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    yes yes!
     
  14. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,367
    @Brechtos,
    That's what I did for next version. A checkbox that affect all your shadows settings for the current Quality Settings level within NGSS_Component itself. By default will be disabled. But keep in mind cascades needs to be set in a certain way (consecutive splits must be exponentially bigger) or it will break the Stitch algorithm and seams might become very visible.
    This is how it looks now (NGSS 2.0):
    NGSS_2_Inspector.png
    PS: I added the same override to v1.9.6 btw. ;)
     
    Last edited: Nov 7, 2018
    NeatWolf, Brechtos and ceebeee like this.
  15. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,367
    Folks,
    If you have any tiny issue that needs to be pushed in v1.9.6 let me know, I'm about to submit for review. Then shift focus on v2.
    For v2 I need to cleanup Denoiser code and Primitive Raytraced Shadows still need to be properly integrated, though the core is there and is working fine. I'm thinking of making it part of the Directional Screen Space Mask or with Deferred Lighting Pass so we can push a maximum of casters independently of shaders. More of that soon.
     
    Last edited: Nov 7, 2018
  16. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,367
    Side note,
    In Unity 5.6, directional soft-shadows cost ~0.5ms vs ~0.8ms in 2017/2018. Same thing for NGSS Directional (with default settings), ~0.5ms in Unity 5.6 and ~0.8 in 2017/2018.
    The only thing I know that could explain that is the shadows culling they introduced in 2017 for Directional lights which is probably doing more harm than good.
    This shadows culling system seems to cull objects horribly wrong at seams intersection which make them cast shadows that pops in/out at cascade intersection. You can notice this if you make shadows super soft and move the camera, small objects crossing cascades will have their shadows pop in/out. We can even see this popping problem even with default Unity shadows, only that is less visible cause they use a smaller kernel for soft-shadows but still visible!
    Coincidentally, none of these issues happen in Unity 5.6 so I guess it might be related to their Directional Shadows culling. I submitted a bug report about a year ago with a small reproducible project but they didn't wanna listen to me. :rolleyes:
     
    Last edited: Nov 8, 2018
    hopeful likes this.
  17. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    395
    Yeah I think sometimes the cure is worse than the disease with things like that.
     
    tatoforever likes this.
  18. wwg

    wwg

    Joined:
    Apr 2, 2014
    Posts:
    130
    @tatoforever A few questions:
    1. Are you still planning to support two cameras? UFPS uses a second camera for weapons and the contact shadows aren't working with that (e.g. shadows display on my FPS arms and weapons).
    2. I'm using Unistorm which has a directional light for the sun and the moon. Should I add NGSS script to both lights? Any suggestions for this scenario?
    3. I'm still getting a lot of shadow shaking/flickering in my scene (stock and NGSS). Have you ever encountered this?

    Thanks!
     
  19. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,367
    @wwg
    1 - Remove NGSS_ContactShadows from all your game cameras. Attach the NGSS_ContactShadows to your hands camera only. If it doesn't work keep NGSS_ContactShadows on your main camera, make your hands camera write to depth and set it clear to DepthOnly. Couple of folks asked for this already and we solved the problem easily. :)
    2 - Add NGSS_Directional to your main directional light, the one that cast shadows. If both lights should cast shadows then add NGSS to both. Keep in mind that the properties in the main one will be the same all directional shadows. Contact Shadows is not designed to work with two directional lights casting shadows, so you have to chose which one is your main one.
    3 - If you have a giant dome (clouds) casting shadows, this problem is produced by Unity alpha depth dithering and there's no way around it. Either disable semi-transparent shadows (through Graphics Settings panel) or find another way to cast shadows from your clouds (Directional cookies for example).

    Side note, all the three described setups are a bit inefficient. Specially the 2nd and 3rd one. You should be able to find a weather system that does not requires either a giant dome casting shadows. Maybe try to set directional light rotation when day/night instead of having two directional lights casting shadows. If your moon light is really really low, you probably don't need shadows at all from that light.
    That's way too overkill and you will soon be GPU bound. :)
     
    Last edited: Nov 8, 2018
  20. alternativevisual

    alternativevisual

    Joined:
    Apr 16, 2015
    Posts:
    75
    I've added a list of directional lights to NGSS_DIRECTIONAL to set same properties for both Moon and Sun lights.
    upload_2018-11-8_21-17-1.png
    I disabling my moon/sun light when they goes down, so only one light will be enabled, and i still will be overkilled and GPU bounded?:confused:
    And what if i want to add a Thunder lighting? Most of the time it will be just disabled, and it will still hit performance?
     
  21. Brechtos

    Brechtos

    Joined:
    Sep 18, 2014
    Posts:
    18
    Awesome! Thank you! :)
    Will the cascade blending parameters and other non quality setting altering properties still function as well? As the non quality settings altering params were just setting some shader params. For instance the CASCADES_SOFTNESS_NORMALIZATION, CASCADES_BLENDING & CASCADES_BLENDING_VALUE.
    Hard to tell because they are all located under the quality settings header in your screenshot.

    Again thank you for the support!
     
  22. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,367
    @Brechtos
    Correct, If off, you will be able to tweak every property in the component except things that directly affect your Quality/Graphics settings. You have to drive these properties yourself through Unity Settings panels.
    CascadesNormalization, Blending and BlendingValue are not in Quality/Graphics so they will still work if you the option is off.
    Reworked the inspector so it's more clear. Properties starting with GLOBAL affects your Quality/Graphics settings globally and properties starting with NGSS_ only affects things locally:
    global_vs_local_settings.png
    This image btw is taken in Unity 5.6, there's no support to PCSS in 5.6 thus a compiler define disables it from inspector.
    PS: All properties are self documented with extensive tooltip description texts.
     
    Last edited: Nov 8, 2018
  23. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,367
    @alternativevisual
    No, if you manage to have only one directional light casting shadows it's OK
    If you want to have a thunder lighting, rise the directional light intensity? Whatever you do, try not to have more than one directional light casting shadows. If you really need more than one dir light, make the less important not cast any shadows.
     
  24. wwg

    wwg

    Joined:
    Apr 2, 2014
    Posts:
    130
    1. Yeah, I have tried attaching the script to weapons camera only. It doesn't work: no SS shadows and it causes other issues. The UFPS weapons camera is automatically set to DepthOnly at runtime. However, if I put the contact shadow script on both cameras it all works as expected and no contact shadows are rendered over the FPS arms/weapons. I dialed the ray samples way down on the weapons camera and there is no perceptible performance hit that I can see.

    2. I think Unistorm disables or reduces intensity depending on day/night. You're probably right that I don't need it at night.

    3. I don't think Unistorm clouds are casting any shadows (I don't see any cloud shadows). I also disabled semi-transparent shadows and still flickering. As a test, I added Unistorm to your demo scene and there was no flickering. So, something else is causing it. I'll keep looking.

    Thanks
     
  25. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,367
    @wwg
    1 - That is one of the solutions yes. I don't know exactly what UFPS does to cameras but you can still try to get your hands camera write to depth and keep ContactShadows in your world camera see if it works. Otherwise what you did should be just fine.
    2 - Good. If you really really need a secondary dir light, don't make it cast shadows, specially for a moon night. AO should be more than enough to ground your objects.
    3 - Maybe we are not talking about the same, if you can send me a picture of your scene setup and how shadows look, that will help me identify that pixelated issue you are having. I've seen some crazy setups with giants meshes over the whole scene casting ultra pixelated shadows... :eek:
     
    Last edited: Nov 8, 2018
  26. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,367
    So yeah,
    In case you where wondering how shadows will look prettier and perform better in v2, I took some inspirations from signal filteing (Images from Wikipedia):

    Basic image, this is the equivalent of naive banding you see in modern shadows filtering with large kernels and low sampling, in this case color palette is severely reduced:



    Now apply a magic dithering algorithm (blue noise, bayer matrix, etc) and it gives you something like this:


    Then a low pass filtering or denoiser:
    Dithering_example_dithered_web_palette.png
    Note: The last image I used a Gaussian filtering on the second image with one texel offset, a simple denoiser will be the equivalent of Gaussian plus a sharpening in one pass.

    In the case of shadows well is a lot easier, we are dealing with black and white. First and second steps happens in the base filtering pass and the third step happens as a separable blur in the second pass.

    [EDIT]
    This is how PlayDead fixed color banding on INSIDE, using a blue noise then in a later pass TAA to remove remaining visible artifacts.
     
    Last edited: Nov 9, 2018
    AthrunVLokiz, Invertex and ceebeee like this.
  27. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,367
    Folks,
    I'm reworking contact shadows in v2, it will be faster and prettier (using the same dithering/denoising basis as shadows).
    The idea is to be able to use it as a Directional Shadows replacement for very large distances. Once the directional shadows fades out = raytracing will continue up to camera far plane and due to the far distance they will be shown, it won't matter if they are pretty or inaccurate. Still you have to live with the screen space limitation but will always be better than no shadows at all! :)
     
    alternativevisual, gecko and hopeful like this.
  28. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,367
    NGSS v1.9.6 just got submitted for review. Features and changes:
    - NGSS no longer enforces shadows properties globally. You now have the choice to control global shadows properties though Quality Settings or NGSS_Directional component
    - Tiny improvements to distribution of samplings for directional shadows
    - Cleaned up Directional shadows C# and shader code
    - Removed noise grid, was doing more harm than good. A better method is awaiting in v2.0

    And that's it for v1. Only bugs fixes will be submitted. Otherwise, I'm 100% now on v2.0. :cool:

    List of planned features for NGSS v2 (Standard Pipeline):
    -New shadowmapping algorithms: box, gaussian, rotated disk (all shadows)
    -Dithering (all shadows for v2.0)
    -Denoiser (for directional in v2.0, for local shadows in 2.1)
    -Gradient Bias (all shadows for v2.0)
    -Improved contact shadows (shadows draw beyond shadows fade for v2.1)
    -Primitive Shadows (for directional in v2.0, for local shadows in 2.1)

    Raytraced shadows and the like will be added in the future once

    Calling out for projects. If you got an interesting project that can showcase NGSS 2.0 and wants to get early access to it, email support! :)

    PS: I'm still researching and prototyping other crazy stuff for lighting & shadows and will update you accordingly! :)
     
    Last edited: Nov 10, 2018
  29. jcarpay

    jcarpay

    Joined:
    Aug 15, 2008
    Posts:
    561
    Great stuff. Will NGSS v2 support Unity 5.6?
     
  30. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,367
  31. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    Do you have an ETA on v2?
     
  32. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,367
    @gecko
    Couple of weeks away at most.
    I'm cleaning up primitives & denoiser code and it should be ready for beta testing. :)
     
    Last edited: Nov 10, 2018
    gecko likes this.
  33. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,367
    Couple of things to keep in mind with Primitive Shadows, at least for initial v2. Shadows are computed screen space thus requires Camera depth. This has lot of benefits:
    - Fully raytraced, no shadowmapping, no shadows artifacts, no acne, no peter panning
    - Super fast! using only 1 depth fetch for all casters and lights
    - No need to render casters, they are computed analytically on the GPU!
    - Produces a Screen space shadow mask similar to directional shadows mask that can be fetch at lighting pass
    - Works with MSAA and other screen space filters (but you won't really have to AA, these shadows are raytraced)
    - You can have a very high number of shadow casters (in the future, will add support to Unity ECS and you can multiply that number exponentially till you blew out SM instructions)
    - Not limited by base shader as is not included in any base shader (won't blew out your shader instructions/interpolations etc)
    - Does not require any special shader for your scene, you can use your existing ones, custom or default
    - Computed in parallel (v2.0 through a command buffer, but in the future will be 100% compute shader based)
    - Can be combined with directional shadows (extend current directional shadows)
    - Can also be multiplied with directional shadows (to fake world space occlusion with directionality as in Last of US)
    - Can replace directional shadows entirely by fetching the primitive mask directly without any directional shadowmap (not for 2.0, available in 2.1+)
    - Limited to 1 directional primitive shadows in 2.0 and support for multiple ones in the future

    Now the cons:
    - Requires screen depth (if you are using a Directional Shadows in Forward it's free though)
    - Requires a modified standard shader for local shadows in Forward Renderer as shadows must be computed directly inside the shader. I will provide one with v2.1. You can also modify your custom shaders and add the mask fetch to it.

    Note: All this applies to the Standard pipeline version of NGSS 2 which is due in a couple of weeks. With Scriptable Render Pipeline we have more flexibility but this not coming anyway sooner. Im waiting for SRP to be out of preview and 100% stable/final. (early 2019).

    Questions? :)
     
    Last edited: Nov 11, 2018
    Invertex, NeatWolf, gecko and 4 others like this.
  34. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    395
    I stumbled onto something the other day and I don't really understand what it is.

    https://github.com/chengkehan/ShadowVolume

    Is this a sort of Primitive shadows or is it something else? It seems to make a special object for every shadow. I'm just puzzled what it is doing to make the shadows so sharp, and yet not use a shadowmap.
     
  35. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,367
    @ceebeee,
    That's the old technique used for shadows, also called stencil shadows as it uses the stencil buffer. It was replaced by shadowmaps for a number of reasons. The biggest one it can eat fill rate a lot due to overdraw and works only on solid meshes, if there's a hole you will see artifacts. Another drawback of this is that is draw directly to the display buffer, you can't get the shadows and modulate light/spec, etc with. Unless you are re-rendering the scene twice which will make these even less optimal. Worth notice that shadows volume won't save you from drawcalls as you need to redraw your shadow mesh and your scene mesh either way.
    Primitive shadows is different, primitive shadows uses analytical functions to compute objects shapes and distances directly in the GPU thus doesn't require caster redraw.
     
    Last edited: Nov 12, 2018
    ceebeee likes this.
  36. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    395
    I see, thanks for the explanation.
     
    tatoforever likes this.
  37. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    I've just started having some terrible performance issues, not sure what's going on. I've deleted and redownloaded/reimported NGSS, no help. I've got the NGSS Directional component added to the Directional Light, and NGSS Contact Shadows added to the Main Camera. I noticed that in the Graphics settings, the NGSS Directional shader gets assigned automatically at runtime to the Screen Space Shadows slot, which is correct, I assume. (The UnityShadowLibrary.cginc replacement is only for local shadows with point/spotlight, right? Not needed for Directional/Contact shadows?)

    Profiler shows 23ms on the Shadowmap. This is on 2018.2.14 on Windows 10 with a 1060 card.

    Any idea what's gone wrong for me?

    shadows profiler.PNG
     
  38. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,367
    @gecko,
    Correct, you don't need to install local shadows replacement file if what you are looking for is just directional shadows improvements.
    I would need more info about your shadows setup and your scene. Like actual properties of all your lighting/shadows.
    Are you using other heavy GPU effects such as volumetric lighting?
    How heavy is your scene on your CPU, drawcalls?
    Lastly, what happen if you re-enable Unity soft-shadows (disable NGSS_Directional with NGSS_KEEP_ONDISABLE off)?
     
    Last edited: Nov 15, 2018
  39. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    I saw no difference with NGSS disabled....but then figured out the problem. I'm using Vegetation Studio Pro, and to test something else, I had increased the mesh tree distance greatly (to 600m or so). And when I reduced that back down to a reasonable distance, then the GPU load for shadows also dropped dramatically. So that was the cause...but I don't understand why. I had not changed the shadow draw distance, so why would having many more mesh trees do that? Any ideas? Or should I ask Lennart at VSP about that?
     
  40. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,367
    @gecko,
    I think you are having an overdraw issue. Or simply drawing too many trees?
    Something on your trees draw is hitting a cap or shocking somewhere.

    [EDIT] I think that if you reduce entirely shadows, you will have similar draw issue. Unity does some weird shadows culling on Directional lights which introduced performance issues since Unity 2017, maybe it has something to do with? Hard to say, I need to take a closer look to your project to give you a better answer. ^^
     
    Last edited: Nov 16, 2018
  41. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    487
    Really rudimentary question. But first.
    I playing with a large indoor scene using many point lights and reflection probes and my shadows are killing my performance. I've tried to gather what I can about this asset but I am still unsure - is the point to "replace" and therefore optimize Unity out shadows or is it to produce "nicer" shadows?
     
  42. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,367
    @jnbbender
    Only on Directional Shadows. Depending on how you set shadows eg: a high sampling number won't bring any performance improvement over Unity shadows. Though for local shadows you won't see a performance improvement only visual improvement over Unity shadows as Unity local shadows does not perform real soft-shadows so the hit can be noticeably on heavy point light scenes. If you are not bound by GPU you can go up to around ~20 point lights.
    PS: I have new improvement for shadows in v2 coming soon (visual and performance).
     
  43. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    487
    Thanks for the detail.
     
    tatoforever likes this.
  44. tspk91

    tspk91

    Joined:
    Nov 19, 2014
    Posts:
    131
    Hi, do contact shadows work with two directional lights active, if each directional light is rendered by a diferent camera? (layered cameras setup).
     
  45. alternativevisual

    alternativevisual

    Joined:
    Apr 16, 2015
    Posts:
    75
    Hi there! What about of Contact Shadows for Local lights? Top-down sprites looks gorgeous with them.. but there is no shadows for local lights.
    (i'm waiting for Primitive Shadows in NGSS v2.1 to try them out :D)
    upload_2018-11-16_22-48-45.png upload_2018-11-16_22-48-54.png
     
    tatoforever likes this.
  46. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,367
    @tspk91
    They should work yes. People does ContactShadows with multiple cameras. They will however share the same properties for all ContactShadows cameras. Giver it a go and let me know how it goes.

    @alternativevisual
    It's incredibly easy to do ContactShadows on local lights, what's incredibly hard (or should say close to impossible) is to tie individual properties for every light (like contact shadows buffers) on the Default renderer as we don't have access to individual lights properties, hence the reason why Scriptable Render Pipeline was invented! That's why there's no NGSS_Local component. :(
    So yeah, there will be ContactShadows and NGSS_Local shadows component for spot/point lights but not on default renderer, again Unity does not give me access to individual light properties I can only replace the renderer files. :)
     
    Last edited: Nov 16, 2018
    hopeful and alternativevisual like this.
  47. alternativevisual

    alternativevisual

    Joined:
    Apr 16, 2015
    Posts:
    75
    Soo, NGSS v2.0 will provide NGSS_Local shadows component?)
     
    hopeful likes this.
  48. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,367
    @alternativevisual
    Most likely not on Standard pipeline but SRPs yes as I have access to all lights components and indexes with SRPs.
    But no worries, Build-in pipeline still have lot of juice to offer and it will squeeze till the end! :D
     
  49. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,367
    @alternativevisual
    Your game could use some really nice Primitive shadows. Any 2D or top down game could leverage raytraced shadows.
    Btw, Massive Screen Space shadows filtering still a possibility in Builtin pipeline (deferred path). Basic idea is a sort of Deferred Shadows filtering. Render hard shadows at light pass into a buffer (find a way to mix them properly), then do a separable bilateral blur with edge tolerance on that buffer = all shadows get softer in one shot. :cool:
    This is something I have in mind for a long time and will come back to it after v2.0 is released! ;)
     
    Last edited: Nov 18, 2018
    alternativevisual likes this.
  50. alternativevisual

    alternativevisual

    Joined:
    Apr 16, 2015
    Posts:
    75
    Just tried my game on Linux, GTS 250 Palit videocard. And all works just fine with your shadows!
    bugs i've found: Directional shadows are more soften in build, than in the editor(
    When switching Rendering path on camera, Contact Shadows broke up, making directional light dark, or sometimes just won't work at all. Reenabling could fix this problem

    Unity 2018.3.0b8-10 bug: crash after a while when enabling shadows casting on SpriteRenderer.
    Console error: GetGfxDevice() should only be called from main thread

    I reaally want to use LWRP with Primitive Shadows! But.. as i remember, LWRP doesn't support Ambient Occlusion (MSVO)?
    And will i need to do a special setup for every object in game, to use Primitive Shadows? Or how it will work with sprites?:confused: