Multi-layer character rendering

Hello everyone,

I have quite a problem and I have ran out of ideas how to solve it. For artistic reasons I have characters in my game composed of several meshes and I need to draw them over each other regardless of their position in the space, or more like I have one partially inside other and I need to draw it not obscured by the other.

For the first try I have used multiple cameras and layers but this approach works only for one character right in front of camera (components also draw on top of anything on top of the character).

I am thinking about about picking each object in the scene and feeding it it’s position in the render queue according to it’s distance from camera (and in case of an character the order of objects) but this seems to me a bit of a overkill and I wonder if there is another more elegant solution.

Thanks for any answer

Edit:

For greater clarity, like this:

1464-SphereImage.png

I need to render the sphere whole on top of the cylinder, but not on top of anything else.

Yeah I’ve got it now. Looks like you either need a shader for the overlaid items with a large negative Z Offset or you should actually always pull the model towards the camera enough to overlay it. I could probably help you with the latter