I searched and couldn’t find anything on this topic.
I would like to use color picking to select mesh faces, however I would also like to select all faces, including faces that might be hidden behind those faces.
I understand that color picking only renders out solid colors, so it would be impossible to know if a face is hidden or not.
Is there anything that can be done to get color picking to select hidden faces?
I don’t want to use ray-picking right now.
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 (OpenGL 4.2 Atomic Counter Demo: Rendering Order of Fragments | Geeks3D) 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.
I haven’t tried it, but it’s probably very slow.
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.