Can't figure out how to use Vertex Color instead of VertexNormalWS to create rim offset and offset outline based on Stylised paint shader breakdown

Really, there is no reason not to use a postprocess effect for at least half of this.

The outer outline is trivial in a PP.
Near impossible in a shader (the shader doesn’t know what is around the object).

As far as the effect itself.

Its not exactly Edge Detection.
That would be figuring out where the hard edge is, more so than figuring out where the mesh ends.

Fresnel is nothing but the dot of the camera vs the object’s single tris normal (vertexnormalws).

Basically, you are looking to isolate values of 1, as that is where the object is facing the camera straight on.(Or the camera is facing the tris squarely? Semantics).

That won’t necessarly highlight edges - you could have a plane facing the camera straight on. The whole plane would be solid colored.

It will work for a sphere 100% of the time like edge detection. Because every point on a sphere is equidistant from its center.
Your normals will always have one thats more or less 99% facing the camera, and the rest around it fading out.

The character mesh, will work somewhat - chin/neck area may have issues since the normals can become opposite on long chins.

I’ll try and think up a way to make something similar, without using a PP.

However you may benefit from opening up a dedicated topic out in rendering, others my have simpler solutions to this altready thought out…

I have to say that the best way to achieve what you want is exactly what you have drawn…

A solid model in the center, with a solid shader.
An outer shell thats got the panning corroded material all over it.

If its black over black in an unlit material the 2 will be rendered out as a unique merge.

If the material is lit it becomes problematic as the outer shell lighting may differ or the inside may bounce light onto the shell, so that aspect would need further PostProcessing.

Additionally, with 2 shelss you could put different stencils on each, and just use a post process to color both the same / making a cartoon like effect on top of any render…
Or you could render the inside of it always on top, which may just achieve the effect you want.

1 Like