i have a peice of code that renders a 3D image, say a cube. I require 3 cubes in in different locations, this is done using instancing and i am able to render the cube in 3 different locations. However, i now need to pick any of the 3 cubes. I am pretty new to DirectX(11) and searches online did not yeild any answers. So how i pick an object when i only have a single set of vertices(triangle) used for the render?
Picking is not generally performed by the GPU so the use of instancing shouldn't matter.
Your CPU-side code presumably knew where the cubes where in order to put their transforms into the instance buffer. Hence it can do a ray-AABB test by transforming the picking ray into the space of the cube in the cube's local space.
Happily, the local space for the cube's AABB is just the unit AABB. You need only transform the picking ray by the inverse of the transform matrix you used for each cube's instance in the instance buffer.