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

After thinking a bit.

The effect you eant is easily achievable with 2 shells, IF, you set the normals for the outside shell to be inverted - inside only.

Ill give you a quick blender made example if I can…

PP does it’s thing. UVs are on the object. the 2 are unrealated.
You can tell a mesh to belong to whatever stencil you want.
Most common use for this - with completely separate meshes in this case - is to hide water from inside a boat.

Anyway. let’s get to the example here
the model’s screenshot:

The forum upload smushes this into a 690px image, so use it as a reference more than anything.

Wierd model with complex geometry to the right.
It’s got 2 shells, the outer one has inverted normal.
The inner one’s normal’s point correctly.

To make the mesh you have to select all the faces, then duplicate, then extrude along face normals. This process is not without issue on complex geometry - and it simulates what the inflate shader will do, so you can deflate fine. Inflate, not so much. Depends on the way the model is made.

On the left you can see the UV(a mess)
and the material.

Jumping into the engine now
The model as is - without any material:

That’s already essentially what you want, so let’s throw together a quick shader for it.
Here is the result:

Here is the bits of the shader;
Isolating UVs - this is done based on how the UV was mapped in the DCC.


NOTE: the bottom example uses IF instead of a lerp. If you need more control than lerp offers. (might also cost less. you’d have to bench test).

These are plugged right back into the custom UV channel 0 and 1.
That’s important to re-use the nodes like I did, but you can probably also just plug in directly into textures. The savings of doing this on a lerp are minimal.

Here you have the part that allows you to isolate the 2 shells:

This plugs back into a custom UV 2, so that’s why 0 is appended. If you don’t use the custom UV you take the IF output as the alpha of the lerp.

Here’s the WPO output to inflate/deflate the outside mesh.

And ofc the texturing, which is likely to be different from inside to outside:

After that, to get the rim erosion effect going, you just apply a texture to it as the opacity. the UV for it is already isolated.

This will give you something something that operates like this:

(never you mind the crappy textures used. it’s just what sits in my test project.)

From then on, you can actually refine it.
Say the bits and pieces showing up on top of the mesh are an issue for you (those are normals that are essentially facing you but within the “BOUNDS” of the object)…


A little bit of SphereMask magic and they can just be gone.
(this generates a sphere, with a radius the size of the bounds, on the edge of the mesh that’s facing the camera.
The result is that the inside bit is eaten out. May not work right on character skins because they aren’t a sphere like primitive).

On this, if you implement Vector Scaling along with it to inflate the shell, well then the bounds change. you have to manipulate either the radius or the position of it. or both. A quick edit/change to utilize the same scalar:

Try it, see how this works.
Anything on top of it should probably be done via Post Process.

Also a side note:
I found that using custom UV for isolating the inside/outside value is mixing up the vector displacement. I recommend plugging in directly off the IF statement to it.


I’m really not sure of “why” passing it on the GFX is altering a direct 0 to 1 input. but again, the benefit is so small it doesn’t matter…

If it lets me… the blend file:
2shelltest.blend (2.2 MB)