DepthFade - but not really. Help!

Hey all! I’m trying to do a sort of intersection effect between meshes, and so far DepthFade has been my go-to node for it. But it doesn’t do the effect I actually want - I found this describing pic on the net as someone else was having the same problem, but the answers given didn’t really help me as I’m a bit of a newb.

Anyway, this is the problem. Can anyone give me a hint (in layman’s terms) about how I’d go about fixing it, if possible?

If you have proper Distance fields generated from scene you can use DistanceToNearestSurface node. Engine Features Preview 5/29/2015 - Announcements - Epic Developer Community Forums

DepthFade only work with stuff that you can see under the pixel. So it can’t be done effect like you want.

That looks perfect! Do you happen to know how I’d go about hooking an effect like that up?

You first need to have to set all meshes to generate distance fields. When you have that setuped. Then it’s just straightforward. You hook up DistanceToNearestSurface node with worldPosition and you get worldspace distance. Then you can do simple math like clamp(1.0 - distance / 100.0, 0.0, 1.0) to get alpha.

If those meshes don’t move, I know it sucks, but the cheapest possible way to do this is with one large texture, painted by hand to mask out exactly which portions you want. I remembered reading about some game developers actually doing it this way for game oceans where they want to mask the shore from the rest of the ocean. Otherwise, the distance field thing is the only other option I know of.

You could take multiple depth samples around the current one and calculcate nearest surface. In similar fashion like SSAO does.

@mariomguy: Yeah, that’s always an option, true. I’d just really like to do it dynamically. :smiley:
@Jenny Gore: I actually got it to work, using the distance fields. :smiley: Thanks for the pointers. If anyone as newbish as me has an interest, this was how I constructed my mask:

^ Doesn’t work with landscape :frowning:

@Maximum-Dev: Awwww. Darn. Ah well. Thanks for the heads-up. :confused: