Depth in 2D isometric game

So I was intrigued at how Project Eternity ahieved the depth of a 2d background to see when a character is in front of in the back of an object. I tried myself to replicate it, first I tried with a simple Depth Mask shader that would hide geometry that passes behind.

As you can see is a mess to dealth with the camera and all. http://games.neuro-lab.net/resources/egcamera.jpg

So experiment failed and I went over with another approach, use a second camera to render only the depth masked objects at a different angle, so I would place them as normal but still is a pain in the ass to work this way. You can try the result here:

http://games.neuro-lab.net/resources/Build/Build.html

And you can see the main problem, actual geometry isn’t friendly with pixels, so you will get edges problems. So I asked on the Project Eternity forums one of the ddevs how they did it, and got a reply:

“We use a 2D depth map render that is separate from the final/beauty render. The depth map has the same resolution as the final render and allows the in-game renderer to determine the depth each corresponding pixel has from the camera. Because it’s an isometric render (no parallaxing), it simply does a per-pixel comparison to sort the scene.”

So I’m not an expert but for what i get they use another texture of the same size of the one that is gonan renderer and get info depth info from the pixels, probably from the colors. I’m a noob on shaders so I don’t know if this is achieved with shaders or not, but I would like to ask you guys what you think how can be really achieved based on the Project Eternity dev description.

I really hate to bump threads, but for this one I’ll do. Bump.

It’s a basic technique used in compositing. http://www.dofpro.com/tutorial1.htm

A greyscale image is used to determine the distance from the camera of each pixel. White is foreground, black is background, mid-grey is the middle. The depth map (also called z-depth) lets you do distance-based effects like DOF or fog as a post-process.

So you would compare the character’s pixels depth against the background depth. If character pixel depth is “whiter” than the background, the character is in front of the background.

The Infinity Engine, which they are emulating in style, used seven layers to create depth.