Is it possible to use a layered material for both an opacity mask and translucency?

Hey everyone, I’m trying to make a cool stealthing effect but I’m currently stuck between using an opacity mask to make an object completely vanish, and using refraction to create the classic “cloaked” effect. I followed the tutorial found here on how to do the dissolve effect and I’m using a basic translucent material with some refraction for the “Cloaked” effect.

Basically all I’d like to do is as the opacity mask takes over, the translucent material becomes visible underneath. I’ve tried using a seperate mesh and using the custom depth pass but I haven’t found any concrete tutorials on how it even works or if it’s even the correct approach. Any help would be greatly appreciated!!

The first approach you’re talking about sounds like this:

  • duplicate characters’ polygons in the 3D package
  • move them a bit “inside” (along their normals) so they don’t interfere with the upper layer
  • assign them a different material
  • List item

Both meshes are rendered simultaneously, only with the upper one disappearing when the effect is active.
The tutorial you’re talking about doesn’t mention DitherTemporalAA node. You could be interested in that - UE4: How to fix translucent materials (dithered opacity) - YouTube

This method sounds valid and should work. But I think that it can cause performance problems.
So the second method you mention (Custom Depth) probably works like this but using Custom Depth as a mask - http://imgur.com/cTcfqgD
Do you know how to enable Custom Depth in character’s mesh? I can provide some more info if you need.

EDIT: cloak effect using Custom Depth :slight_smile: UE4: Stealth Invisibility Effect (With Distortion) - YouTube
Jump to 15:34 for the shader graph.

I’ve looked into the DitherTemporalAA method along with a DitheredOpacity in the material settings. The downside is that the model I’m hoping to use this material on spin pretty quickly which cause the dithering to mess with the shape of the model.

I’m curious to hear more about how to use Custom Depth as a mask. Isn’t Custom Depth a check box you enable on the characters mesh?

I recorded a video and edited the answer :wink: Link at the end of the post

Also, Tom Looman’s article is worth checking out. A more detailed explanation and more use cases: http://www.tomlooman.com/the-many-uses-of-custom-depth-in-unreal-4/