Hi Guys!
I am using directxTK's frustum and Bundingbox APIs.
I am Initializing Frustum with
m_FrustumDefault = BoundingFrustum(Projection);
where
Projection = XMMatrixPerspectiveFovLH(XM_PIDIV4, m_aspectRatio, 0.1f, 10000.0f)
I am using Assimp to load FBX model with meshes in hierarchy, I am also transforming viertices manually instead of aiProcess_PreTransformVertices. Like …
//transforming boudingboxes
aiVector3D vmin = matrix * mesh->mAABB.mMin;
aiVector3D vmax = matrix * mesh->mAABB.mMax;
//transforming vertices
for (UINT i = 0; i < mesh->mNumVertices; i++)
{
VERTEX vertex;
mesh->mVertices[i] = matrix * mesh->mVertices[i];
vertex.Position.x = mesh->mVertices[i].x;
vertex.Position.y = mesh->mVertices[i].y;
vertex.Position.z = mesh->mVertices[i].z;
vertex.Position.w = 1.0f;
...
and
void DX12Model::processNode(aiNode* node, const aiScene* scene)
{
for (UINT i = 0; i < node->mNumMeshes; i++)
{
aiMesh* mesh = scene->mMeshes[node->mMeshes[i]];
m_Meshes.push_back(this->processMesh(mesh, scene, node->mTransformation));
}
for (UINT i = 0; i < node->mNumChildren; i++)
{
node->mChildren[i]->mTransformation = node->mChildren[i]->mParent->mTransformation * node->mChildren[i]->mTransformation;
this->processNode(node->mChildren[i], scene);
}
}
I am also updating frustum with ViewMatrix …
m_FrustumDefault.Transform(m_Frustum, GetViewMatrix());
where m_FrustumDefault is default frustum with projection matrix only.
and i return
m_Frustum
…
How should i frustum Cull these Bounding Boxes …
i Am not able to get good result from Contain and Intersect mathod of directxTK, should i transform Bounding box with WorldViewProjection matrix.
thanks…