Rendering sprites with depth information
I'm looking for advice on how to acheive a particular rendering technique with OpenGL. This is best illustrated by the first The Sims game.
In The Sims, the people themselves were rendered as polygon models whereas all the furniture used pre-rendered sprites. However, the 3d models still intersected the sprites as if they had volume in 3d space. Here the sims pop through the water of the hot tub even though it is a 2d sprite:
And here the fire (which is a textured cylinder) intersects the 2d sprite of the cooker:
Each furniture sprite in The Sims had an accompanying image containing the depth of each pixel; something like this:
I'd like to know whether it's possible to this with OpenGL, perhaps by drawing to the depth buffer somehow. I'm having trouble searching for information on this technique, mainly because I don't even know what it's called! I suppose it's a kind of voxel rendering, but this term has many different meanings in different contexts.
Thanks in advance!