[Released] Screen Space Cavity & Curvature for Unity - Inspired by Blender's Cavity effects


Screen Space Cavity & Curvature is an edge high-lighting and-low-lighting screen space effect for your game, inspired by Blender’s Viewport Cavity effect.

:white_check_mark:Built-In (2019.4+) • :white_check_mark:URP (7.1.8+) • :white_check_mark:HDRP (7.1.8+)

Compatibility:
:heavy_check_mark: Unity 2019 / 2020 / 2021.
:heavy_check_mark: Standard render pipeline, forward and deferred.
:heavy_check_mark: Universal Render Pipeline 7.1.8+ (Unity 2019+).
:heavy_check_mark: High Definition Render Pipeline 7.1.8+ (Unity 2019+).

• Super simple to use: simply add to your camera/render-pipeline and adjust parameters.
• The effect is split into two parts:

  • Control small scale highlighting with “curvature” settings,
  • And larger scale highlights with “cavity” settings.
    Separate settings are available, enabling you to dial in the desired effect:
  • Pixel radius of curvature, its brightness in outward curves and its darkness in inward curves.
  • World radius of cavity, its brightness in outward curves and its darkness in inward curves.
    • As a source of screenspace normals, all three sources are available to choose from:
  • G-Buffer normals, Camera normals, and Depth-reconstructed normals.
    New feature: Control the effect per-object.
  • Uses a new “output to global shader texture instead of the screen” mode. Example shaders included. Feature available for Builtin[2019/2020/2021], URP[2020/2021].

Assetstore page.

4 Likes

Hello, I just bought this asset, being a big fan of this viewport effect in blender, and I was wondering if it was possible to apply it only to certain elements.

For example, the effect is particularly good on rocks, but it also applies to vegetation, and it makes everything particularly ugly.

1 Like

Hi,
I am currently working on adding a feature where instead of rendering to the screen, it renders the effect to a global shader texture that you can then sample in your own shaders; thus allowing you to select objects which receive outlines etc. The feature is almost done, I just need to create some example shaders for urp on how to sample a screenspace texture (for all 2019/2020/2021 urp versions), and that turned out to not be so trivial a task.
If you can implement sampling a screenspace texture on your own, for you own shaders, I could submit the update to be live within a day or two. Otherwise it’ll take a little bit longer.
Thank you.

Big news:

Just finished the per-object effect control update. Uses a new “output to global shader texture instead of the screen” mode. Example shaders included. Feature available for Builtin[2019/2020/2021], URP[2020/2021]. With it you will be able to filter out any objects you don’t want the effect appearing on.

Should be live in a day or two. | Edit: Now live.

3 Likes

Looks great, I love this effect.
Does it support DOTS Hybrid Renderer V2?
Usually global effects like this do since the shader requirements for DOTS are mostly related to instancing.

EDIT: I tried it and can confirm, it works and it looks dope af!!

Hi everyone, discovered that a small bug has slipped through in the latest version of the package.
If you’re importing URP.unitypackage please move the imported “URP” folder from the root of your project into “Screen Space Cavity Curvature/SRP” folder, then right click on the “URP” folder and press “Reimport” to not get any errors.
The fix for this will be live as soon as the assetstore team approves it. Very sorry for the inconvenience.

–Edit: The fixed version is now live, fresh imports will not have to do anything, right click on “Screen Space Cavity Curvature” folder and press Reimport if you’re still having any issues.

1 Like

Hello and congratulations! Is it possible to apply a texture in the curvature only? Possibly through a texture node of the Shader Graph (such as “_ssaao_occlusiontexture3” for URP)?

Hi, this should be possible with the _SSCCTexture output mode, it outputs to a global shader texture with curvature in .r and cavity in .g
I am not too familiar with the shader graph so not exactly sure about using it to implement this, but there are example shaders for URP in the “_SSCCTexture Examples” folder that show how to sample the texture and have separate sliders for curvature and cavity, adding a texture on top of that should be an easy modification. Please let me know if you have any trouble with it. Thank you.

Hello, I bought this asset but I’m having some issues (maybe I don’t understand correctly) I’m using URP, and I already added the “SSCCRenderFeature” to my URP renderer, and I can see the effect, but the readme says that I need to add a “SSCC” to my post process volume, and here is where I’m stuck, I tried to add it as an effect, but it doesn’t appear in the effects of the post process volume. I’m doing something wrong?

Thanks

EDIT: I’m using URP 10.7.0 and Unity 2020.3.25f1

Hi, hopefully this image can help you:

Please let me know if “ScreenSpaceCavityCurvature” doesn’t appear in the effects list for you. Thank you.

1 Like

that was it, I was using the Post process volume, not the volume script, Thanks for the help!

This looks really nice

How performance heavy is it? Will it run fine on mobile phones (like OnePlus 8 Pro)?

And how does it look when applied to games also having more “organic” creatures with more rounded edges?

And how easy is it to exclude specific objects (like creatures) from the effect?

Also, does it work fine when you have light, fog, and particle effects (so that it renders behind fog and so on)

Hi,
Mobile is not officially supported (there’s just too much variance between mobile devices), but one person tested it on iOS and it worked perfectly for them. Your mileage may vary.

It is very easy to exclude specific objects from the effect (if you’re on Builtin or URP 2020+), consult texture output mode folder’s Readme.txt.

1 Like

Hey, does it support mobile? And this new feature with shaders, that means it doesnt work as post process but is like a texture, so performance is much better?

Hi, see the comment above about mobile.
The ‘texture’ output mode feature works like this: Render the entire screenspace effect, but output it to an intermediary global shader texture instead of the screen directly (what it does in default ‘screen’ output mode), then as the individual object’s shaders get executed, they can read this texture to use that information however they want for their shading, they can ignore it for example, etc. The sample shaders for all this (Built-In, URP) are provided with the asset.

Hey @JollyTheory does this asset work on all shaders or do I need to use the provided custom shaders?

Hi, the asset works with all shaders by default without any modifications required (applied on top of everything on screen), if you want to exclude certain objects from the effect you have to switch over to the custom provided shaders, or modify your own.

I needed to change the path in the URP_SSCC.shade file line 195 to the actual path of the Shared.cginc file to make the asset work. Other than that it works very well :slight_smile:

Hi, was that caused by moving internal folders of the asset, or was that a problem out of the box?

Im running Unity 2020.3.34f1and URP 10.9 but am unable to get the effect to work. I had it working in 2019.4, I’m not sure where I’m going wrong. I’ve added the feature, enabled depth texture, and made sure post processing is selected on camera like last time, but no results.

Hi, yeah Unity changed something about the screenspace normals texture in URP 10.9 and didn’t announce it anywhere. Working on a fix.