@Katulobotomia (Katulobotomia) posted a new topic, subject "Location based, cylinder shaped opacity mask that always faces the camera and only masks faces that are facing away from the player character.". It read:

   I have three problems I need to solve. I am trying to make a opacity mask that is in the shape of a cylinder with the other end pointy and the other flat. Both of the ends are pointy right now. The cylinder should rotate to always face the camera and apply the opacity mask to faces that are facing away from the character. It should always reveal the player if he goes behind any object with the material attached to it, no matter how far away he is or how many objects is in between the player and the camera. A simple sphere doesn't do the job since it can't mask all the objects that are in between the player and the camera: a long cylinder would do it.
    
    The opacity mask is in the shape of this right now, always positioned around the player, but doesn't rotate to face the camera.
    
    60323-151241.jpg1066×772 223 KB
    
    Round shape of the cylinder.
    
    60324-highresscreenshot00002.jpg1161×933 205 KB
    
    This cube face shouldn't be masked, since it is facing the player.
    
    60325-131415.jpg1157×931 89.4 KB
    
    This is how I create the opacity mask shape from a world position.
    
    60326-w4525.jpg1489×679 194 KB
    
    This is how I get the player position and translate that to either be closer or further away from the player.
    
    60327-shserge.jpg1378×668 187 KB
    
    BONUS: How would I make the opacity masked materials still cast a full shadow, even if parts of the textures are inside the opacity mask?

@Galvanicus (Galvanicus) replied

    This is an old question but here's some answers:  
    Bonus: to get the shadow, use the node “ShadowPassSwitch” at the end of the whole operation, right before connecting it to the opacity mask. Set shadow to 1 and you will keep the shadow.
    
    I tried it out and it successfully makes a cylinder that is location based but my trouble is the rotation. It always faces the Z axis. I haven't figured out the rotation though.
    
    I tried a RotateAboutAxis method but it failed…


{'source': 'discourse', 'url': 'https://forums.unrealengine.com/t/location-based-cylinder-shaped-opacity-mask-that-always-faces-the-camera-and-only-masks-faces-that-are-facing-away-from-the-player-character/333473', 'title': 'Location based, cylinder shaped opacity mask that always faces the camera and only masks faces that are facing away from the player character.', 'views': 1280, 'has_accepted_answer': False, 'word_count': 384, 'like_count': 0, 'reply_count': 1, 'participant_count': 2, 'posts': 2, 'tags': 'question Blueprint Materials Scripting opacity mask', 'author': '@Katulobotomia (Katulobotomia)', 'participants': '@Katulobotomia (Katulobotomia), @Galvanicus (Galvanicus)', 'image_url': ['https://d3kjluh73b9h9o.cloudfront.net/optimized/4X/9/5/f/95f5afc23e10dda6420c8573357c4ae5c7b374c6_2_1024x741.jpeg'], 'created_at': '2015-09-26T15:55:15.000Z', 'last_posted_at': '2021-01-09T18:46:20.000Z'}