How to recalculate axis-aligned bounding box after translate/rotate?

后端 未结 5 1812
天命终不由人
天命终不由人 2020-12-14 17:58

When I first load my object I calculate the initial AABB with the max and min (x,y,z) points. But this is in object space and the object moves around the world and more impo

5条回答
  •  感动是毒
    2020-12-14 18:03

    Why not use your GPU? Today I implimented a solution of this problem by rendening a couple of frames.

    1. Temporary place your camera over the object, above it, pointing down at the object.
    2. Render only your object, with out lights or anything.
    3. Use orthographic projection too.
    4. Then read the frame buffer. Rows and columns of black pixels means the model isn't there. Hit a white pixel - you hit one of the model AABB borders.

    I know this isn't a solution for all the cases, but with some prior knowledge, this is very efficient.

    For rendering off screen see here.

提交回复
热议问题