Updated Outline Edge Method:

I’m new to Unity, especially when it comes to shaders and post-processing effects. I’m having difficulty creating an edge outline effect because all the tutorials and GitHub projects I’ve found are outdated. For example:

[https://www.youtube.com/watch?v=8Xq7tU5QN1Q
GitHub - DumoeDss/AquaPostOutline: Edge detection with Depth, Normal and MeshID.
Edge Detection Outlines
GitHub - jpgtzg/Outline-Shader-URP-: Outline Shader for the Unity Universal Render Pipeline
GitHub - AGM-GR/EdgeDetection: Edge Detect / Outliner for Unity Post-Processing Stack v2](https://www.youtube.com/watch?v=8Xq7tU5QN1Q GitHub - DumoeDss/AquaPostOutline: Edge detection with Depth, Normal and MeshID. Edge Detection Outlines GitHub - jpgtzg/Outline-Shader-URP-: Outline Shader for the Unity Universal Render Pipeline GitHub - AGM-GR/EdgeDetection: Edge Detect / Outliner for Unity Post-Processing Stack v2)

There are two methods that sort of work:

The image below shows the outline effect I’d like to achieve:


My project is using Unity 2023.1.19f1 with URP.

I thank the attention

I’m not sure about 2023.1 as that is somewhere between tech releases, but even 2022 LTS seemed to have changed things from before and a lot of examples were not working well when I looked at post process effects or not setup in the easiest way.
But it is easiest to use a fullscreen shader graph for sure and to use a custom function node to do multiple reads of depth and/or normal buffers etc. within that which takes some effort since reading those textures in a custom function node does not seem documented.
It would be a very good idea for Unity to add an outline post process effect as many people are questioning doing one and more documentation on custom function node use in fullscreen shader graphs.

If you want to remove image edge detection in #2 you will have to learn a bit about shader graphs to edit the example one

I think post process effects are changing again in some way in Unity 6 - hopefully the ability to add your own custom post processes instead of this some-Unity-post-processes and then before or after your full screen graph effect!

Welcome to the general state of everything :stuck_out_tongue:

There are in general two major ways of doing outlines.

  1. Inverted hull (or any geometry based) outlines
  2. Post processing outlines

They both have different use cases, different advantages and disadvantages.
The links you posted all link to solution for post process outlines.

I would have thought that the danielillet video should get you pretty far.
Since you want outlines on everything, depth buffer based edge detection with a low depth difference threshold sounds like it should work.
The resources you choose are good and you are on the right path, but you need to adapt it to the up to date engine. It’s difficult to help without knowing what exactly you stuck at.

Apart from that the asset store could have something that works?

This no longer works in the latest URP as they have deprecated the entire workflow. Raised an issue but there doesn’t seem to be any traffic on the repo.

I have no idea how to use the new workflow. We’ve tried a few options but haven’t been able to make a functional port. Please post an update if you happen to solve this one.

After checking the repo, I think it should work in non render graph mode. (compatibility mode)

Have you enabled “Compatibility Mode” in graphics settings?
9902742--1430502--URP_RG.jpg

It did not seem to work for me, have you tried it? I don’t even think it compiled out of the box.

There is a package on github with a simple example of an outline effect with shader graph here: UnityShaderGraphCustomFunctions

But you should follow the instructions here also: How to create a custom post-processing effect | Universal RP | 14.0.11 (unity3d.com)

I’m having an issue with this where whenever I move the camera it takes the outline like an extra frame to move into position. It ends up making the outline have a really bad motion blur effect that’s exclusive to it and I’m not sure why.

I implemented it into the project without changing any code so if you or anyone else has an idea of how I could fix it I would appreciate it greatly.

We simply stopped using it. We’ll roll our own later.

@marlon1748 : I was able to get one of Daniel Ilett’s full screen shaders to work for Unity 6 (6000.0.22f1) from here: Outline Post Process in Unity Shader Graph (URP). The page contains a link to the GitHub repository so you can download the shader graph.

In the Renderer Feature I had to set Pass to “DrawProcedural (0)” and in the material I had to set “Overlay” to True for it to work properly (the post says to set Pass to “Blit (1)”). This will give you the result in your second image.

On a side note … I found a simple toon shader graph (not full screen) which will work with this effect: https://www.youtube.com/watch?v=MXZ578OXOog

An example of both shaders:

Hey you linked my article I see

→ I updated it for Unity 6 + Render Graph API so that should help some people hopefully

https://ameye.dev/notes/edge-detection-outlines/

2 Likes

Thank you so much for sharing this!! This was not only the only outline render feature that actually worked for me (unity v2022.3.41) but also the easiest to setup and edit. Took me less than 10 minutes to read the article and implement.
You, sir, are a hero.

1 Like

is there a way to make it so just one object is higligthed- outlined? or better use inversehull for my case?