3D Shape Picking.
These 2 sketches demonstrate a solution to the problem of selecting a shape moving in 3D. In Jetsons you can select a box by clicking on any part of the box but in Poker Die you can select a single face by clicking on it.
A color picking algorithm is used where each shape/face is drawn onto an offscreen buffer using a unique color. Given an [x,y] screen position the buffer pixel color is found and then the matching shape/face can be found.
The source code for both of these sketches can be found in my OpenProcessing portfolio.