Field Notes: Call of the Void
Outlines, translucent materials, and buried settings.

So I was struggling with materials this week. Specifically, I needed objects that were invisible but could still be clicked. I needed them to show my outline effect. This should be straightforward, right?
Wrong.
The Fuse Slot Problem
I was building a fusebox with placeholder slots where players could place fuses. The idea was simple: draw an outline around an invisible object when you hover over it, if you're holding a fuse.
My first attempt was a translucent material with opacity set to 0. Unfortunately, my outline effect writes the object's silhouette to the depth buffer to do edge detection. That is what ultimately draws the outline on the screen. And translucent materials don't write to Custom Depth.
Getting Creative
I tried masked materials next. I set the Opacity Mask to 0, hoping that a different kind of shader might work differently. Nope. Just the same problem with different nouns. I spent a while, trying every combination I could think of, but by 3 AM I was down to wild guesses and hope. What if instead of making the material transparent, I make it... black? Like super black. Black 4.0 black.
Set up a masked material with:
- Emissive Color: pure black (0,0,0)
- Opacity: 1 (fully opaque)
- Unlit shading
The result? Completely non-reflective, light absorbing objects in the scene, that look like holes punched in the universe itself. But in dim lighting conditions, you can't tell if you're seeing what you're seeing! And they can be outlined.

The Actually Correct Way
Once I got some sleep, I found a better answer. The cosmic void was functional but honestly disturbing to look at during development (and didn't hold up in the brighter lights elsewhere in the cabin). I dug up an old forum post that mentioned you actually CAN get a translucent material to write to the depth buffer, if you know what you're doing. You have to set the appropriately named "Allow Custom Depth Writes" flag, and set the opacity above a threshold value that Unreal uses to determine if it's actually transparent, called the Opacity Mask Clip Value. Fortunately, you can set that as low as you like.

I set the mask to 0.01 and the opacity to 0.2—enough that the renderer bothers to process it, but that it doesn't register visually. Bam, outlines around (nearly) invisible objects.
The Result
This new approach will work a lot better in brighter lighting, and can even be adapted for partially visible "ghost" objects, either translucent versions of the thing you're placing, or translucent white versions of the model. I probably won't use that functionality in this game but it's good to have in the toolkit.