How to get a 2d rectangle around any 3d object?

Its easy to transform 3d points into 2d. Like wise its not that hard to translate an object’s bounding sphere volume into 2d by having a point and size. But how would come up with a rectangle in 2d around an object a 3d.

I am trying to code some thing like this:

If you look closer there is little corners around the selection rectangle. Essentially [ship] is in brackets. The brackets grow and shrink depending on orientation and zoom level to the ship.

with a camera facing billboard plane attached to the selected object?

I would do it by selecting a handful of points that represent the object’s surface in 3-d, projecting each of those points to 2-d, and then computing the minmax bounding rectangle of those 2-d points.

The more initial 3-d points you select on the object’s surface, the more accurate the projection will be; but obviously there is a trade-off between accuracy and cost.

David

wezu, i need to know that X and the Y size of the plane in 2d.

drwr, I did not think about that. I bet thats how that do it in that game. I would not need that many points just max and min on every axis and the diagonals. 6+6 ~ 12 points should not be that slow.