Bumping this, because I’m in the same boat. I’d like to avoid having to manually duplicate and render everything twice just to get a depth pass on some translucent objects. Searching on google, these forums, and documentation comes up with nothing but questions from users and absolute radio silence from Epic on the issue.
I tried the same setup as the Kazuja guy as well (which is nothing really, just apply a translucent material and tick Render CustomDepth Pass) to no avail as well.
Translucent materials won’t write in the scene/custom depth buffer no matter what you are going to try… they are simply rendered later in the pipeline.
Duplicating the meshes is the only option for now unless something dramatic has changed in latest engine version (not likely).
I know this is an old thread, but maybe something has changed in the meantime.
Is there no way at all to set an outline for a mesh that has a translucent material?
Have the same question. For me somehow “Allow Custom Depth Write” flag on translucent material enables Custom Depth only in case if opacity is above 35% and if opacity goes below that it stops working on per pixel basis. That look like a bug. More interesting note that in additive material it works fine. That is in UE4.25.
That 35% is coming from alpha cutout threshold. Transparent materials that are rendered in custom depth pass are using depth only shader variant but because transparent materials does not write depth masked variation of depth only shader is used instead. I added custom node that alternate behavior when render pass is depth only.
That did work. Just changed alpha cutout threshold, and it did the trick. Though it’s really weird behavior highly unintuitive and moreover undocumented. I’d never get to it by myself.
I’ve just modified Opacity Mask Clip Value that’s located in advanced settings of material properties. It actually does controls this cutout thing for Custom Depth/stencil buffer in translucent shading model.
I would love to know what you put into the custom node to detect what pass you are on as well…
This could greatly improve a lot of the performance issues that Water shaders usually have…
I didn’t do a custom node. It was a **Kalle_H.**I guess, he’s overriding mask with it. But to make the mask fully opaque it’s enough just to change this parameter.
Setting the “Opacity Mask Clip Value” in the details panel of the material saved me! As long as the material shows in the world (opacity > 0), it will be rendered in the custom depth buffer. No need for a shadow mesh to render into the custom depth buffer anymore!
Since this thread coming up in Google… As of 5.03 looks like messing with Opacity Clip Mask Value is no longer needed. The field is read-only unless using a Masked material.
If you (1) have “Translucency >> Enable Custom Depth Writes = true” and (2) a value greater than .333 going into your Opacity the object will work with depth buffer highlighting.