Hey guys,
I’m currently working on a post-process material that also includes an outline.This part of the shader is drawing the outline:
Unfortunately, I made this after a tutorial, and to be honest I don’t completely understand how it works. So that’s also part of the issue.
The thing with this shader the way it is, is that it’s drawing the outline always with the same size, no matter how far the objects are away. Which looks pretty ■■■■■■ for more distant objects, or also when things are in the background like the sky sphere here.
So I want it to get thinner and fade out with distance.
I first thought I could achieve this by copying this whole segment, changing the outline thickness to something very thin and then lerping both together with a distance fade, sphere mask, or the scene depth itself. But the issue with that is, that the outline is drawn on the outside of the object.
So let’s say I use the image below as an alpha to lerp the outlines together, the mask is actually portraying the distance of the object behind, instead of the distance of the object I want to define the outline thickness for.
which then leads to a result like this:
which is obviously not what I want.
Does anyone have an idea how to solve this?
If I can somehow move the outline to the inside of the object this would also be fine for me.