Is there a way to hide mesh partially in front of camera?

Hi, I have 3D topdown game and want to add clipping in front of camera the way “Divinity: Original Sin” does it. I also need to do it material independant.
Is it even possible with Unreal?
I guess I need to do some vertex shader manipulations, but don’t where to start.
Any advice? Thanks in advance.

Years ago I solved it by performing traces from the camera towards the character. Anything it collided with in between the camera and player of a certain type “tree” I assigned a dynamic material… or changed a parameter on… something like that. basically you temporarily assign an opacity value or even an entire material. I don’t think I still have that old project. There might be better ways.

https://www.youtube.com/watch?v=yo9VrxFgUJY

https://www.youtube.com/watch?v=IVKVXjaT6QM

Making Material Parameters | Unreal Engine Documentation

If you use post processing you could overlay your characters on top of everything else using a custom depth value.

https://www.youtube.com/watch?v=ZeYlal1nYrQ

The same custom depth mechanism can be used to create a lens of which you see things through with a custom depth only if you look through it.

That’s 3 ways I can think of, might still be better ways

2 Likes