Opacity for outline effect


I made an outline effect for monsters in my game using this tutorial. It works fine, but this effect shines through player’s mesh like this. Can anyone help me: how can I make player opaque for this effect?

if you want it to not do an outline for everything that’s between the camera and the object with the outline you’ll have to create a mask from the regular scene depth so you can remove all the pixels where an object is closer to the camera than the object with the custom depth from the outline.

if you want it to do that just for specific meshes i’m afraid you are out of luck unless they added additional custom depth passes so you could flag objects differently.

divi has the right idea. check against regular scene depth using an IF statement, and if the scene depth is less than the custom depth, mask the effect.

There are custom depth values called “Custom depth with Stencil”. You can write a byte (0-255) value for a static mesh and read back the value as well. You need to go into rendering under project settings and set the custom depth stencil setting to “enabled with stencil” to get it working. I can post a picture a bit later if there is no documentation yet.