How to use CustomDepth to make sprite partially transparent?

Hey!

I’m on UE5.5, I have a sprite with various texture types (Diffuse, Normal, and Mask) representing a character climbing a pole.


Diffuse:

Normal:

I’m almost sure that I will have to use a mask to indicate which parts of the character can/cannot be rendered behind the pole.

The character is therefore “flat” while the pole is a simple 3D model.

To make the action more realistic, his left leg (Mask: White) should be behind the pole, while the right one (Mask: Black) should be in front.

I would first like to know if using Custom Depth is the most suitable for what I would like to do. And if so, how should I proceed?

I’m really new to shaders and Post Process, I have some knowledge, but this seems beyond my current understanding.

Thanks!

Hey everyone,

I managed to solve my sprite masking issue by using the PixelDepthOffset parameter directly in my sprite’s material. This approach turned out to be much simpler and faster to set up than using Custom Depth or Render Layers.

By adjusting the PixelDepthOffset value, I was able to control the rendering order of my sprite and the 3D pole, creating the desired depth effect. A positive value for the part of the sprite that should appear behind the pole, and a null or negative value for the part in front did the trick.

This method is great for its simplicity, speed, and performance, although it might be less flexible for more complex scenarios.