Billboard in front of 3D object

Hello everyone,
I am currently facing a rendering problem.
In our game, the character is a sprite rendered on a plane, living in a 3D world.
The plane is a billboard always facing the camera, camera which is over his head. So, the plane is almost horizontal to show a character standing vertically.
It provokes visual problems when the billboard goes through a wall.

To prevent this, I made a shader changing the offset, giving our character a little more space.(Shader is Cutout diffuse with “Offset 0,-150” added)

for the walls, the solution works, but when the character is next to anything, it hurts my brain.

Since the player is behind the cube, the shadow is rendered on him, but because of the shader, the head of the player is rendered above the cube.

I don’t really know how to ask the question (probably part of the reason I can’t find the answer)
Does anybody knows how I could have my character feel like he’s vertical ?

This was asked a while ago but I couldn’t find the post either >.>
There are a few approaches to this problem, each with their own catches.

The easiest way will be to set layers so that the sprite will alway be drawn on top of the background. The catch is it will only work for simple cases.

Another approach is be to skew the sprite so that its always upright. Catch is that your sprite may look odd and shadows might look weird

The most realistic way to do it would be to have a separate texture to represent depth and a shader that calculates whether each pixel should be drawn. This is the approach that The Sims used for the furniture/etc. The catch is it will be a pain to implement.

The best solution I could come up with was to use cylindrical billboarding for depth calculations and spherical for the quad’s actual position. This allows you to use spherical billboarding while ensuring the quad’s depth remains constant.

If needed I have more details here.

Did you ever come up with a fix for this?

I’ve been playing with shaders for the past week and just cannot figure it out.