REDsdk offers a picking API to identify geometries that are found 'under' the mouse. There are several picking methods available in REDsdk:

It's important to mention that REDsdk picking methods are entirely based on CPU processing. The GPU is not involved in the resolution of picking. Also important, REDsdk picking is not based on ray intersection with triangles; By default, picking occurs for a pixel frustum pyramid being intersected with the scene, so that lines and points can be intersected and that would be missed otherwise if we were to only propagate a ray in the scene.

Picking results

On calling one of the REDsdk picking methods, a RED::Vector of RED::ShapePath objects is returned. There's one RED::ShapePath object created for each object being intersected by the picked rectangle fired from the camera eye position between the camera near and far clip distance:

Example of picking with a small selection window

Here, our pick window hits the three objects A, B and C. Then, we'll find 3 RED::ShapePath objects in our returned vector from the RED::IWindow::FramePicking method. Then, each shape path object can contain informations on several hit points and primitives for each object. In the example above, for instance, if object A is double sided, the first shape path returned will store two RED::ShapePath::LeafData items in it, indicating the two intersections found during the process:

Example of double sided geometry picking

Each RED::ShapePath::LeafData item will store informations on the hit primitive of the object (triangle, line segment, strip segment or point) as well as an estimation of the 'best hit point' to be used as the picking result. Because the picking is not based on ray propagation, and is rather based on pyramid propagation in the scene, there's no unique solution to the intersection of a pyramid with a primitive. REDsdk looks for a best match point to be used as the picking result.

Picking results are sorted from the closest picked primitive to the farthest picked primitive.