Download

Font Material - Line of Sight based opacity

I have a material which I am using for my players that is based on line of sight. The setup for it is here: TUTORIAL: Line of Sight Visualizer for Unreal Engine | by Christian Sparks | Medium

The above tutorial will “black out” areas outside the player’s line of sight. I have tweaked a copy of it that I can use to directly drive the opacity of my players. The end result is anything in the map outside a radius or outside the player’s line of sight is displayed much darker. Players outside the radius or line of sight are masked out.

There are several players in this room but the only one I can see is the one inside my vision radius

See? There was another one just outside

SO, this brings me to my problem. I’m trying to put nameplates above the players. I obviously don’t want these nameplates to be visible when outside the radius or outside line of sight (ex: behind a wall). I’m trying to effectively use the same functionality that is working on my character’s material to drive the functionality of a UI material for my font.

So far it does not work at all. I have never used font materials before and I’m a bit lost as to how I might approach this.

This is the material function driving the Opacity Mask for my character - https://i.imgur.com/QY8vAss.png

It’s using a material parameter collection to keep track of a few things

  • player’s location (SightLineActorLocation)

  • vision range (SightLineTexScale)

  • SightLineMaskHeight which I don’t fully understand what it does…

As well as a render target texture from a scene capture 2d which drives what is currently within the player’s vision.

Anyway, I’m hoping that not all this needs to be understood. My question is - this material function is being used to drive the opacity mask of my character’s material. Can I also use it to drive an opacity mask for a font? What needs to change for that to happen?

Hate to do it but I’m gonna give this a bump … It’s a real blocker for me. I know it’s a complex issue but if someone could at least tell me how I can use this 0 to 1 value from my material function to drive the opacity or mask a font material I think that would resolve the issue.