One way to do this is to render the object in a separate rtt as an opaque object but force the writing of an alpha value.
Forcing the writing of an alpha value is easy, just set material.alpha = X. Doing this will make the mesh transparent and we don’t want that (because transparent meshes are sorted and don’t write to the depth buffer). Overriding needAlphaBlending and needAlphaBlendingForMesh to return false will trick the system into making the meshes as opaque objects instead.
Then we need to blend this rtt with the scene, which is done with a custom post process.
Here is the PG:
I created an rtt the size of the screen. It would be more efficient to create a smaller RTT that only encompasses the mesh, but it’s a bit more complicated (you have to calculate bounding boxes / define the viewport with the right dimensions).