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