[Next-Gen Soft-Shadows 2] Sophisticated dynamic penumbra Shadows for Unity

https://www.youtube.com/watch?v=O41aKiVjwdA
https://www.youtube.com/watch?v=suD5ctbKeBo




Asset Store link: http://u3d.as/1qNz

The next iteration of the smoothest and fastest dynamic soft-shadows solution for Unity is here. Easier to integrate, faster to render, prettier than previous versions! Featuring powerful new tools, shadowing algorithms, optimizations and user friendly self-descriptive light components to improve the quality of your scene lighting. NGSS is complete shadows package to skyrocket your projects quality to the next level!

Shadows algorithms:
A PCSS filter (Area-like soft-shadows) and a PCF filter (uniform soft-shadows). A powerful denoiser that skyrockets the base filters, acting as a separable filter and features screen space Contact Shadows with bilateral filtering and edge tolerance. Chose between white noise or dithering. Samplers are stabilized at screen-space thus the shadow samplers jitters less while being Temporal friendly.

Optimizations:
NGSS uses the least amount of sampling to filter out shadows while skipping fully lit or fully shadowed areas making it one of the fastest solution on the market for realistic penumbra shadows.

Inspirations:
NGSS features a ground-breaking combination of kernel filters mainly based on Monte Carlo. The result is a high quality smothered dynamic penumbra shadows similar to raytraced shadows with superior banding and aliasing removal, making extremely tiny shadowmaps look outstanding.

The package:
This new version comes with one Wizard tool to install NGSS internal shadow libraries and is one click to install and one click to uninstall. Both Local shadows and Directional shadows provides it’s own libraries, they are independent from each other. NGSS provides shadow components to attach to your scene lights (all lights) that allow you to tweak shadow properties such as quality, softness opacity, etc at runtime.
Finally, NGSS replaces Unity shadows libraries internally, this allow NGSS to behave the same way as Unity shadows while being compatible with any packages on the AssetStore that uses the Standard (built-in) renderer.

Works locally by installing NGSS libraries or with remote cloud builds system by including the libraries directly into your shaders. Easy and quick setup.

Compatible with VR, DX11, DX12, PS4, XB1, SWITCH, GLES3.0, Metal, Vulkan or equivalent/new APIs/Platforms. Requires a minimum of SM3.0 on supported APIs/platforms. Not compatible with DX9 and GLES1/2!
Unity 5.6 up to 2019 (Built-in Renderer), HD & LW pipeline support coming in the future.

Support:
Stellar customer support. Custom inquiries and code modification for free. Most requests are answered almost instantly. Two years ago NGSS 1 launched, many updates and features where implemented since then resulting in lot of happy customers!
For any question, issue, bug, custom inquiry, custom framework or renderer integration:
You can use this forum thread, the support email: support@psychozinteractive.com or discord channel: https://discord.gg/jWEUXYw

5 Likes

It looks great!! I will buy it if it works for iOS especially apple tv

It works everywhere Unity support shadows because it uses Unity build-in shadowmaps. :slight_smile:

@Lars-Steenhoff
If I remember correctly, Unity doesn’t do any point/spot light shadows on mobile as a performance consideration (only for directional lights), so my solution won’t work for those lights on mobile. If you need a custom lighting solution with any kind of soft-shadows for mobile, PM me please.

I’m working out the documentation and preparing for AssetStore submission.

1 Like

I’ve put out a small video showcasing the shadowmap custom filtering, the video quality isn’t that good (visible this time only point light shadows):

NOTE: The rock on first post is casting dynamic shadows, not in this video. The idea was to showcase how nice this kind of shadows blend with high quality raytraced baked shadows.

@tatoforever That looks very nice! I have 2 question for you: what is the impact in terms of performance compared with default shadows? And what would you say are the drawbacks/limitations (if any)?

@Seith ,
The filter is fast, faster than anything on the Asset Store, because it achieves better shadows smoothing and with no banding with few samplings and instructions (16 samplings in the images above). Compared to the default Build-in Unity Soft-Shadows is not really noticeable, hard to say.
As for the limitations, I don’t really see any drawback/limitation, it works anywhere Unity support shadows because it uses Unity shadows.
Something to note: This filter don’t do anything to Directional Shadows (only to point and spot shadows) and the reason is that Directional shadows already does a 5x5 PCF filtering plus screen-space rotated poison disk sampling. I’m doing something similar to that technique to unify the look of all shadows in Unity (with the dynamic adaptation of penumbra size based on caster-receiver distance).
This technique is also faster than PCSS filtering, way way faster, because again, it requires less sampling and instructions.
Your FPS doesn’t change if you use this filter or default build-in soft-shadow filter. I’ll see if I can record a video of it.
Thanks for your interest. :slight_smile:
[EDIT] Nice game btw you got there.

1 Like

@Seith ,
Some performance tests made today. I’ve used the same scene but all camera effects where disabled so there’s no interference with the shadows performance.

Video:
https://s3.amazonaws.com/uploads.hipchat.com/43289/288706/KtKFUdv3oKoGMgW/SSFS filter test.mp4

Video encoding eat a lot of CPU so here are images of the same test:

As you can see it’s hard to notice any performance degradation as there’s probably none. Some times with the [SSFS] filter it goes even faster than no filter at all (hard shadows) as shown in the images above.

Looks good, what are steps for setup? Just curious if it’s compatible with the Alloy3 shader framework

It’s compatible with everything that support Unity shadows. The setup steps are as simple as to replace a “cginc” file in the Editor folder and optionally add a script anywhere to a GameObject to change the global soft-ness of the shadows. That all. :slight_smile:
PS: This shadows filter adjust the penumbra size of shadows automatically based on distance between caster and receiver but with the optional script let’s you make them a lot smoother or sharper.

To make thing more clear, this shadows filtering works only with Unity renderer. For instance any shader framework or custom shader that uses Unity shadows will work with this shadows. And the good thing, you don’t have to touch any of your shaders or frameworks, it will work.
I’ll see if I can use Unity build-in lights properties to control the global smoothness of shadows in a per light basis instead of globally so you wont have to add a script anywhere to your scene.
[EDIT] Found something interesting.
In the upcoming version of Unity with Mixed-Light mode, we will be able to set the shadows radius (or penumbra size) but only for baked shadows with this property:

I can use that property to change shadows smoothness on [SSFS]. As for now, this property isn’t available on 5.4 and 5.5. I can use the Strength property to change the smoothness but your shadows opacity will only be driven by ambient and direct/indirect contribution. Using some light property to drive the shadows smoothness avoids adding script to your scene and let you tweak it in a per-light basis (instead of globally).
What do you guys think?

I think unless it’s affects performance, I would rather add a script to each light. tieing it to the shadow strength or another property, sounds a little restrictive, the shadow strength is very carefully balanced in my game, so I wouldn’t be able to change it much. But that’s just me. With alloy’s area lights you have to add a script to the light and likewise with hxVolumectic lighting, so it wouldn’t be unusual. In fact with hx you have global settings and then the script on the light will override, so basically you can choose, which is nice.

When you say replace a cginc file inside the editor, do you mean where the exe is, ie if you want to go back to the built-in shadows for whatever reason, you’d need to copy the old one back? - I’d assumed you’d have done it through the graphics section now they’ve exposed the shadows or am I misunderstanding custom shadow shader they’ve exposed?

Either it’s sounding really interesting

1 Like

@punk_1 ,
I’ll answer those questions when I get back from work.

1 Like

@punk_1 ,
Back from work! :slight_smile:
Unfortunately, for Unity shadows it’s a bit different, their depth textures you can’t do that, because they are created in the C++ part of the engine, which we don’t have access. Unity handles light indexes internally and again I don’t have access to it, the C++ renderer feeds shaders with current light type and properties but we don’t know exactly which light on the scene is.

Keep in mind, this system automatically adjusts penumbra size based on caster-receiver distance. For instance, if the light is very close to the caster/receiver, shadows will get sharp, but if the light is far away it will tend to smooth out automatically (kinda more physically plausible). But still, you can optionally change how sharp/smooth shadows are globally at near/far ranges with one global script.

I can let people change soft-shadows smoothness in a per-light basis by adding scripts to all your lights but will require more MonoBehaviors laying around (on every lights), probably more ShaderKeywords and global properties (plus the fact that I have to set an array of unknown size containing all scene lights on the shader and can get messy), more manual setup to set only one value in the shadows. I’m trying to make the setup as much straight forward as possible (user friendly). But I’ll do it anyway if that what’s people want. :slight_smile:
Also, shadows opacity (or in this case strength) should never be handled the way it is (with a manual override on the light), it should be handled automatically with scene light contribution. For example, I’ve seen lot of people making their shadows almost transparent on very dark scenes, quite often looking incorrect. So what I want to say is that if you set your scene lighting properly (without touching shadows strength) you should be fine and it will give you more physically plausible results.
That’s why I wanted to use the strength property of the light to override the smoothness in a per-light basis. :smile:
If you have an example scene that I can take a look out and see how you setup your lighting, that would be awesome.

Now for the setup itself. I’ve already asked Unity folks to let us override point/spot shadows filter thorough Graphics menu (the same way we can do for directional shadows) but they said no. Tbh, I don’t know who came out with this poor laziness idea. :smile:
Anyway, there’s no way we can do that through the Graphics menu for spot/point shadows, only way is to override cginc files in the Editor folder. So yes, you have to backup the file you have to override first (in case something goes wrong). In the case of installing a new version of Unity, you have to do this again. I can create an Editor script that do this file overwrite automatically (In the case of insufficient OS privilege, print a console error asking the user to do it manually). Again if people want it.
Let me know what you think? :slight_smile:
Regards,

I think with that explanation it sure does sound like a cleaner way of doing things, I reckon I could live with it :wink:

1 Like

@punk_1 ,
Later today, I’ll try to put out a demonstration video to showcase the adjustable penumbra size based on distance with moving objects.

3 Likes

Here is folks:

At the end you can see the global soft-ness in action but still the shadows are sharper if blocker/receiver are close and smoother if blocker/receiver are far.
Let me know what you think. :slight_smile:

1 Like

So, what you got is a full PCSS filtering for spot/point shadows and a cheaper variant that simulates PCSS and requires less samples. Both techniques automatically changes penumbra size based on distance between receiver/caster and light positions, they are both visually similar but the PCSS is more physically correct.
The minimum and maximum penumbra size that the shadows can produce can be tweaked on the global script.

PS: I’ll soon record a new one but with spot shadows (which are extra prettier than point light shadows). :slight_smile:

2 Likes

@tatoforever Thank you very much for your thorough reply! :slight_smile:

1 Like