Fitting a model appropirately

Hello All,

i have what might be a trivial question. But, i would like to know if my approach is correct. So, here is the
I have a 3D model(arbitrary) and i need to fit it appropriately in the viewport.

My approach:
I calculate the bounding box of the model, fit it into some place within the view frustum such that it would be visible. But calculation of this would be slightly heavy. Is this the right way or is there a better way to achieve the same?


Yes i think it’s the good way (BBox and fitting the view frustum).

But i can’t see how this can be a ‘slightly heavy’ calculations ^^ (for 1 object -> 1 (AA)BBox and a frustum camera).

But for optimizing: you can use a simply Bounding-Sphere and simplify calculations of Near Plane, Far Plane, field of view angle (defined by the Projection Matrix).


Thanks YoYo! yeah, using a bounding sphere would simplify the calculations.