Pick by colour only gives you the object cloest to the camera since there is only 1 colour stored; if you want all objects along a ray you need some sort of ray-picking or you need to render without a depth buffers and culling enabled and record all the colours that a fragment tried to render. This requires the use of atomics and chaining the fragments into a buffer (http://www.geeks3d.com/20120309/open...-of-fragments/) which is not available on all graphics cards.

Pick by colour only gives you the object cloest to the camera since there is only 1 colour stored; if you want all objects along a ray you need some sort of ray-picking or you need to render without a depth buffers and culling enabled and record all the colours that a fragment tried to render. This requires the use of atomics and chaining the fragments into a buffer (http://www.geeks3d.com/20120309/open...-of-fragments/) which is not available on all graphics cards.

Thanks, I need to support at least OpenGL 2.0, so I wouldn't be able to use it.

I did come up with a solution, but it's not very efficient.

I would have to render the scene in multiple passes. For each pass, all selected faces would be removed from the rendering process, leaving behind the hidden faces. So, basically, just keep peeling back layers until there's nothing left.

Relevant key words to search for could be "order independent transparency" and "depth peeling" - these have nothing to do with picking, but they handle the fact that multiple faces cover a fragment (in order to get the correct blending result), so you may borrow some ideas.