Download

Need help simulating light bleed around edges of character mesh within material editor.

Hey all, halfway through a somewhat bothersome problem and need some help. So, I am currently making a cel shade look material, and I am trying to replicate a specific effect that I saw subtly worked into the new zelda breath of the wild game. The effect is, when the camera faces the direction of the sun, and is thus looking at the part of your character which is in shadow, the ‘light bleed’ around the edges of the character get bigger, aka they intrude more into the body of the character, pushing the shadows back a bit.

So far, I’ve got the on/off behavior from view direction sorted out, but I don’t know how to make the texture come in from the outer edges of the character only. I tried fresnel, but that affects anything with a sharp angle, including stuff on the inside of the character.

Its a little hard to explain with words, so I’ve got a picture below to show it better. The left image is the standard amount of light that bleeds around the edges of the character.

What I want is on the right, where the ‘light’ bleeds further into the silhouette of the character. And I specifically need to get that effect within the material editor, not as a post process or I won’t be able to use it correctly.

So if anyone knows how to achieve this effect, I would love a pointer in the right direction.
cf7432c7afc3d8ad9ead4a94b0c724532b1b7205.jpeg

Look into http://www.tomlooman.com/multi-color-outline-post-process-in-unreal-engine-4/. I’m pretty sure that’s along the lines of what you need.

I’ve actually already seen all of his tutorials, and sadly they don’t work in this situation, because scenetexture nodes only work in post process materials, and I need this data in my opaque material.

Why does it have to be on your opaque material? The problem is that you need the overall “outline” of the object. Therefore, you’re pretty much stuck with using post processing because you’ll need a custom buffer that cuts the overall silhouette out. The other alternative would be to play with Fresnel shading, but that would show outlines on any parts of the model that are not directly “looking” at the camera (dot product). I’m not 100% sure, but you can probably make some extremely complex material, that can compare neighboring pixels, and check vs scene depth; for contrast differences. At that rate, you’re getting into edge detection algorithms. So you’re probably going to be stuck with doing it in post process or you’ll need to write some c++ code for it.

Another option is to take a copy of your character mesh, push the polygons out along their normals, then invert the normals. This will give you a fake ‘outline’ mesh that you can shade with unlit, and do whatever you like with. Its not exactly elegant, mainly because the silhouette of your character will change, unless you push the ‘inside’ mesh inwards to compensate.

But on the plus side it doesn’t need any post-processing shaders.