Billboard in front of 3D object

I’m starting to develop a poc with the main features of a turn-based RPG similar to Breath of Fire 4, a mixture of 3D environment with characters and items such as billboards.

I’m using an orthographic camera with an angle of 30 degrees on the X axis, I did my sprite to act as a billboard with the pivot in the center, the problem occurs when the sprite is nearing a 3D object such as a wall.

alt text

I searched the forum and found a similar thread:
link text

I had tried the solution leaving the rotation matrix of the billboard “upright”, worked well, but of course, depending on the height and angle of the camera toward the billboard it gets kinda flattened, I also changed the pivot to the bottom of the sprite but this problem appears with objects in front of the sprite too.
I was thinking that the solution would be to create a fragment shader that relies on the depth texture of some previous pass, I tried to think in how to do it with shaders but I could not figure it out. Could you help me with some article or anything that puts me in the right direction? Thank you.

You could render your characters with a second camera with depth only clear and draw it over the scene however the character would always be on top.

Alternatively keep your characters pointing up with no angle and simply make your sprite textures squashed so that they look like they are at an angle.

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.