I can't see hkpBvCompressedMeshShape in visual debugger

I can't see hkpBvCompressedMeshShape in visual debugger

I modify the demo BvCompressedMeshDemo, add visual debugger, but I can't see hkpBvCompressedMeshShape in visual debugger, other shapes no this problem.
havok version is hk2011_2_0_r1
PS : I'm sorry my English is not good

4 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.

Hi,Yes, unfortunately there is an issue with displaying the hkpBvCompressedMeshShape and hkpStaticCompoundShape in the VDB. We're working on a fix for this. In the mean time there is a workaround: In the VDB go to Edit->Settings... and deselect the option "Divide geometries into parts." This should make BvCompressedMesh and StaticCompound shapes display in the VDB in most cases.Cheers,Tyler

Thank you. I deselect the option "Divide geometries into parts", and could see hkpBvCompressedMeshShape, but the frames of VDB is very slow, my shapes have many triangles.

And I compare the raycast speed of hkpStaticCompoundShape(use hkpBvCompressedMeshShape as instance) and MOPP, the hkpStaticCompoundShape is slower than MOPP double. My test demo is a large landscap, I add all triangles in hkpStaticCompoundShape, in the center of the fixed, random test one thousand rays. And exchange for the MOPP to hkpStaticCompoundShape, test.
pseudo code :

#defineSTATIC_COMPOUND0

#ifSTATIC_COMPOUND!=0
hkpStaticCompoundShape*staticCompoundShape=newhkpStaticCompoundShape();
#endif

for(submeshinlandscap)
{
Vector3*vertexData=submesh->getVertexData();
unsignedintvertexNum=submesh->getVertexNum();
void*indexData=submesh->getIndexData();
unsignedintindexNum=submesh->getIndexNum();
IndexTypeindexType=submesh->getIndexType();
Vector3scenePhyPos=submesh->getPosition();

hkpShape*scenePhyShape=NULL;

#ifSTATIC_COMPOUND!=0

hkGeometrygeometry;
geometry.m_vertices.setSize(vertexNum);
hkVector4*vertex=geometry.m_vertices.begin();
for(unsignedinti=0;iset(vertexData[i].x,vertexData[i].y,vertexData[i].z);
vertex++;
}
unsignedshort*indexData16=(unsignedshort*)indexData;
unsignedint*indexData32=(unsignedint*)indexData;
geometry.m_triangles.setSize(indexNum/3);
hkGeometry::Triangle*triangle=geometry.m_triangles.begin();
for(unsignedinti=0;iset(indexData16[0],indexData16[1],indexData16[2]);
indexData16+=3;
}
else
{
triangle->set(indexData32[0],indexData32[1],indexData32[2]);
indexData32+=3;
}
triangle++;
}

hkpBvCompressedMeshShape::ConstructionInfocInfo(geometry);

cInfo.m_weldingType=hkpWeldingUtility::WELDING_TYPE_ANTICLOCKWISE;

//Wewilluse8bitspertriangleforcollisionfilterinfosaswehaveonly4collisionlayers(1to4)
cInfo.m_perTriangleCollisionFilterInfo=hkpBvCompressedMeshShape::ConstructionInfo::PER_TRIANGLE_DATA_8_BIT;

//Wewilluse8bitspertrianglefortheuserdatabecauseallouruserdatavaluesareintherange[0,255]
cInfo.m_perTriangleUserData=hkpBvCompressedMeshShape::ConstructionInfo::PER_TRIANGLE_DATA_8_BIT;

scenePhyShape=newhkpBvCompressedMeshShape(cInfo);

staticCompoundShape->addInstance(scenePhyShape,hkQsTransform(scenePhyPos,hkQuaternion::getIdentity()));
scenePhyShape->removeReference();

#else

hkpSimpleMeshShape*simMeshShape=newhkpSimpleMeshShape;
simMeshShape->m_vertices.setSize(vertexNum);
hkVector4*vertex=simMeshShape->m_vertices.begin();
for(unsignedinti=0;iset(vertexData[i].x,vertexData[i].y,vertexData[i].z);
vertex++;
}
unsignedshort*indexData16=(unsignedshort*)indexData;
unsignedint*indexData32=(unsignedint*)indexData;
simMeshShape->m_triangles.setSize(indexNum/3);
hkpSimpleMeshShape::Triangle*triangle=simMeshShape->m_triangles.begin();
for(unsignedinti=0;im_a=indexData16[0];
triangle->m_b=indexData16[1];
triangle->m_c=indexData16[2];
indexData16+=3;
}
else
{
triangle->m_a=indexData32[0];
triangle->m_b=indexData32[1];
triangle->m_c=indexData32[2];
indexData32+=3;
}
triangle++;
}

hkpMoppCompilerInputmci;
mci.m_enableChunkSubdivision=true;
hkpMoppCode*code=hkpMoppUtility::buildCode(simMeshShape,mci);

scenePhyShape=newhkpMoppBvTreeShape(simMeshShape,code);

simMeshShape->removeReference();
code->removeReference();

hkpRigidBodyCinforci;
rci.m_motionType=hkpMotion::MOTION_FIXED;
rci.m_position=scenePhyPos;
rci.m_shape=scenePhyShape;
hkpRigidBody*scenePhyRb=newhkpRigidBody(rci);
mPhysicalWorld->addEntity(scenePhyRb);

scenePhyRb->removeReference();
scenePhyShape->removeReference();
#endif
}

#ifSTATIC_COMPOUND!=0
{
staticCompoundShape->bake();

hkpRigidBodyCinfoinfo;
info.m_shape=staticCompoundShape;
info.m_motionType=hkpMotion::MOTION_FIXED;
hkpRigidBody*body=newhkpRigidBody(info);
mPhysicalWorld->addEntity(body);
body->removeReference();
staticCompoundShape->removeReference();
}
#endif

Are the timings significantly worse? In general you can expect hkpBvCompressedMeshShape + hkpStaticCompoundShape to perform better in both memory and speed. The main difference here would be you're raycasting vs a large number of shapes (mopps) or one big shape. In the former the broadphase is doing some of the work. Though I would not expect this to have a significant performance impact, it is certainly not unheard of; especially in cases where you have a very large number of triangles (eg. using render geometry for physics geometry).If you're looking for performance gains it sounds like the best route would be to try and generate simplified physics geometry for your landscape shapes. Also StaticCompoundShape is going to give you more wins if you are able to instance duplicate geometry.Cheers,Tyler

Kommentar hinterlassen

Bitte anmelden, um einen Kommentar hinzuzufügen. Sie sind noch nicht Mitglied? Jetzt teilnehmen