views:

300

answers:

1

I need to achieve the following:

Two 2D quads appear as though they are stacked one on top of the other (like two halves of the same texture) but are in fact seperated on the z axis by n coordinates. So that if a 3D object passes between them one half appears in front of the object and the other behind.

Could i achieve this by applying orthogonal projection to the two quads and then normal perspective to the rest of the 3d data? Will this lose depth data?

I hope my example isn't too misleading!

+1  A: 

The simple answer is yes,if you have z write turned on while rendering your quads. Your z data is never discarded unless you do it explicitly.

Getting orthagonal depths to play nicely with projection depths may be tricky, however. (I've never tried, but I imagine it's not going to line up nicely.) In that case it would be best to do one of the following:

  • Render all geometry in a perspective view
  • Render all geometry in an othogonal view
  • Render orthogonal geometry in non-z-tested sorted layers (back to front), rendering you perspective geometry in between.

I'm assuming you will already know the downsides to the first two methods, so it's up to you if that's acceptable. I think the third method is the most traditional.

Toji