Camera position based opacity mask

I am trying to create a material function which would create a cylindrical opacity mask that would affect the objects between the player and camera.
For the opacity mask, I have used the distance field function for a cylinder “vec2 d = abs(vec2(length(p.xz),p.y)) - h;
return min(max(d.x,d.y),0.0) + length(max(d,0.0));” and centered it on the player location. However, my attempts at rotating it so the bottom of the cylinder stays attached to the player, while the top faces the camera, have been rather unsuccessful.

In my setup, I am trying to rotate the vector using RotateVector material function, prior to passing it to the distance field function.

Couple notes- camera boom has fixed length and is not always attached to the player(sometimes it points few meters ahead, based on the camera pitch), it also inherits player yaw. Camera pitch has 30 degree constraint.

Any ideas? Perhaps alternatives?

Hey Nietoperz,

I am assuming if you are attempting to affect something between the player and the camera, this is a blendable/post-process material?

Would you mind elaborating on what you are attempting to achieve with this set up? In other words, how will this be applied as a function in your game/project?

Some screenshots of the issue you are having troubles with as well as the work you have thus far would really help isolate where to focus the next steps.

Thank you,

The purpose of this setup is to create transparency circle if there is some visual obstruction between player and the camera (similar effect to the one in older isometric games). Again, camera has fixed boom length, hence the need to render transparency once the player is behind walls etc.

My current issue is that the cylindrical opacity mask I am attempting to create has a very wonky behavior. I’m not entirely sure how to solve the issue of the cylinder rotating towards the camera at all times. Rotating vector prior to passing it to distance field function gives only partial results.

I’m not sure whether screenshots will provide any better description, but I’ll try and post some later.

Hey Nietoperz,

Our community manager for the Engine Development Forums, Chance Ivey, made a simple material along with using Blueprints to drive the effect you’re looking to do.

He’s posted a short video, the blueprint layout, and the blueprint assets for you download as well. It may need some tweaking to get just the way you like, but it should be a good start.

The second link was made by our Senior Technical Artist, Alan Willard, who made it into a two part video series.

Wall Hiding

Location Based Opacity

Hopefully this is what you are looking for, and let me know if you have further questions or need additional help!

Cheers,