Skip to main content
gamedev.net
🔒 Locked

Optimizing Clip planes

Started by Parduz 1 reply 600+ views
Original Post
Parduz
Parduz
Hi, i think this is more a math question than a DX question, anyway i'm not able to do that computation... Having the BoundingBox of a mesh, the camera XYZ position, the camera target XYZ position and the camera FOV degrees too, how can i compute the best (closer to the mesh) far and near values for the camera projection?
sirob
sirob
I'd recommend you use D3DXVec3Projeect() (or Vector3.Project() for MDX) to project the 8 corners of your bounding box. Then, get the max and min z values from the results.

[edit] I think you'll need to specify an Identity matrix as the projection matrix, to get the actual distance for each point.

Hope this helps.
Sirob Yes.» - status: Work-O-Rama.
Parduz
Parduz
It works! thanks :)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.