<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://pybullet.org/Bullet/phpBB3/app.php/feed/topic/10099" />

	<title>Real-Time Physics Simulation Forum</title>
	
	<link href="https://pybullet.org/Bullet/phpBB3/index.php" />
	<updated>2014-09-04T12:22:46+00:00</updated>

	<author><name><![CDATA[Real-Time Physics Simulation Forum]]></name></author>
	<id>https://pybullet.org/Bullet/phpBB3/app.php/feed/topic/10099</id>

		<entry>
		<author><name><![CDATA[tmason]]></name></author>
		<updated>2014-09-04T12:22:46+00:00</updated>

		<published>2014-09-04T12:22:46+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=33960#p33960</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=33960#p33960"/>
		<title type="html"><![CDATA[Best approach for large scenes with static mesh ...]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=33960#p33960"><![CDATA[
Hello,<br><br>I am building an engine that supports importing mesh from large FBX files. I can get the scene to load fine and have basic interaction with the scene but when I start attempting to interact with the scene even using basic objects I get serious performance degradation.<br><br>My goal is to get a walkable scene with static mesh of a range of sizes with basic interactivity.<br><br>Therefore I am hoping there may be some optimization tips folks can share. I will also post some of the code below for how I am using Bullet.<br><ul><li>I am using "btBvhTriangleMeshShape" objects for my scene and initializing them using a "btTriangleIndexVertexArray" object for initialization.</li><li>I was thinking about using "btConvexHullShape" objects instead but then I generally lose certain information such as collision detection for objects with holes in it like walls with windows, etc.</li><li>I also wanted to switch to the MultiThreaded version of Bullet but the demo doesn't compile, I get errors like the following:<div class="codebox"><p>Code: </p><pre><code>1&gt;MultiThreadedDemo.obj : error LNK2019: unresolved external symbol "public: __thiscall SpuGatheringCollisionDispatcher::SpuGatheringCollisionDispatcher(class btThreadSupportInterface *,unsigned int,class btCollisionConfiguration *)" (??0SpuGatheringCollisionDispatcher@@QAE@PAVbtThreadSupportInterface@@IPAVbtCollisionConfiguration@@@Z) referenced in function "public: virtual void __thiscall MultiThreadedDemo::initPhysics(void)" (?initPhysics@MultiThreadedDemo@@UAEXXZ)1&gt;MultiThreadedDemo.obj : error LNK2019: unresolved external symbol "public: __thiscall Win32ThreadSupport::Win32ThreadSupport(struct Win32ThreadSupport::Win32ThreadConstructionInfo const &amp;)" (??0Win32ThreadSupport@@QAE@ABUWin32ThreadConstructionInfo@0@@Z) referenced in function "class btThreadSupportInterface * __cdecl createSolverThreadSupport(int)" (?createSolverThreadSupport@@YAPAVbtThreadSupportInterface@@H@Z)1&gt;MultiThreadedDemo.obj : error LNK2019: unresolved external symbol "void __cdecl processCollisionTask(void *,void *)" (?processCollisionTask@@YAXPAX0@Z) referenced in function "public: virtual void __thiscall MultiThreadedDemo::initPhysics(void)" (?initPhysics@MultiThreadedDemo@@UAEXXZ)1&gt;MultiThreadedDemo.obj : error LNK2019: unresolved external symbol "void * __cdecl createCollisionLocalStoreMemory(void)" (?createCollisionLocalStoreMemory@@YAPAXXZ) referenced in function "public: virtual void __thiscall MultiThreadedDemo::initPhysics(void)" (?initPhysics@MultiThreadedDemo@@UAEXXZ)1&gt;MultiThreadedDemo.obj : error LNK2019: unresolved external symbol "void __cdecl deleteCollisionLocalStoreMemory(void)" (?deleteCollisionLocalStoreMemory@@YAXXZ) referenced in function "public: void __thiscall MultiThreadedDemo::exitPhysics(void)" (?exitPhysics@MultiThreadedDemo@@QAEXXZ)1&gt;MultiThreadedDemo.obj : error LNK2019: unresolved external symbol "void __cdecl SolverThreadFunc(void *,void *)" (?SolverThreadFunc@@YAXPAX0@Z) referenced in function "class btThreadSupportInterface * __cdecl createSolverThreadSupport(int)" (?createSolverThreadSupport@@YAPAVbtThreadSupportInterface@@H@Z)1&gt;MultiThreadedDemo.obj : error LNK2019: unresolved external symbol "void * __cdecl SolverlsMemoryFunc(void)" (?SolverlsMemoryFunc@@YAPAXXZ) referenced in function "class btThreadSupportInterface * __cdecl createSolverThreadSupport(int)" (?createSolverThreadSupport@@YAPAVbtThreadSupportInterface@@H@Z)1&gt;MultiThreadedDemo.obj : error LNK2019: unresolved external symbol "public: __thiscall btParallelConstraintSolver::btParallelConstraintSolver(class btThreadSupportInterface *)" (??0btParallelConstraintSolver@@QAE@PAVbtThreadSupportInterface@@@Z) referenced in function "public: virtual void __thiscall MultiThreadedDemo::initPhysics(void)" (?initPhysics@MultiThreadedDemo@@UAEXXZ)</code></pre></div></li></ul><br>And here is the code I am using for my current scene:<br><br>How I am initializing Bullet:<br><div class="codebox"><p>Code: </p><pre><code>broadphase = new btDbvtBroadphase();collisionConfiguration = new btDefaultCollisionConfiguration();dispatcher = new btCollisionDispatcher(collisionConfiguration);solver = new btSequentialImpulseConstraintSolver;dynamicsWorld = new btDiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration);dynamicsWorld-&gt;setGravity(btVector3(0, -9.8f, 0));</code></pre></div><br>How I am stepping the world.<br><div class="codebox"><p>Code: </p><pre><code>dynamicsWorld-&gt;stepSimulation(DeltaTime, SimulationSpeed);/*Where simulation speed generally set to 7 but can be changed in environment.*/</code></pre></div>And here is my code for static mesh:<br><div class="codebox"><p>Code: </p><pre><code>btTriangleIndexVertexArray* PhysicsMeshInterface =new btTriangleIndexVertexArray(NumberOfTriangles,(GLint*)IndicesPointer,3 * sizeof(GLint),NumberOfIndVertices,VerticesPointer,3 * sizeof(GLfloat));btBvhTriangleMeshShape* StaticTriangleMeshShape = new btBvhTriangleMeshShape(PhysicsMeshInterface, useQuantizedAabbCompression);        /*        PhysicsShape is a pointer to a "btCollisionShape" object.        */PhysicsShape = StaticTriangleMeshShape;btTransform TransformFromOpenGL;TransformFromOpenGL.setFromOpenGLMatrix(ModelMatrixPointer);PhysicsShapeMotionState = new btDefaultMotionState(TransformFromOpenGL);btAssert((!PhysicsShape || PhysicsShape-&gt;getShapeType() != INVALID_SHAPE_PROXYTYPE));/*        ShapeMass and ShapeInertia are "zeroed" out in the constructor for this class instance that wraps around the Bullet Object in my engine.        */        btRigidBody::btRigidBodyConstructionInfo PhysicsShapeCI(ShapeMass, PhysicsShapeMotionState, PhysicsShape, ShapeInertia);PhysicsShapeRigidBody = new btRigidBody(PhysicsShapeCI);PhysicsShapeRigidBody-&gt;setRestitution(ShapeRestitution);PhysicsShapeRigidBody-&gt;setUserPointer(this);CurrentPhysicsWorld-&gt;addRigidBody(PhysicsShapeRigidBody);</code></pre></div>Thank you for any time and assistance you can provide.<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=10990">tmason</a> — Thu Sep 04, 2014 12:22 pm</p><hr />
]]></content>
	</entry>
	</feed>
