Can't connect to PVD

Hey,

I’m new to PhysX and I’ve already ran into some trouble when trying to create a connection to the PVD.
Before I start, I’ve noticed several errors in the PVD log that show up right after starting it:

  • Error: Failed to start Pvd Console
  • The system cannot find the file specified. (Exception from HRESULT: 0x80070002): Failed to start Pvd Console
  • The system cannot find the file specified. (Exception from HRESULT: 0x80070002): Failed to start Pvd Console

Almost all of the options in the task bar are greyed out as well, however I’m not sure if that’s not simply because there’s no connection at this point.

That brings me to my next issue. I’ve been following the instructions in the PhysX guide to create the connection to the PVD. According to the callbacks it’s connecting successfully, however it tells me that even if the PVD isn’t even running.
Either way, if the PVD is running there is no chance whatsoever after the connection has been established and none of the test-actors I’ve created show up either.

I’m somewhat clueless as to what’s going on, as I said these are my first steps with PhysX.
I’m using PhysX-3.3.0_Beta-2 on Windows 8.1 with Visual Studio Ultimate 2013. I’m using the CHECKED libraries.

Any help would be much appreciated.

Here’s some of the code that might be relevant (Not showing things like simulation stepping):

Initializing PhysX:

Con::cout<<"Initializing PhysX..."<<Con::endl;
	static WVPxErrorCallback gDefaultErrorCallback;
	static physx::PxDefaultAllocator gDefaultAllocatorCallback;

	m_pxFoundation = PxCreateFoundation(PX_PHYSICS_VERSION,gDefaultAllocatorCallback,gDefaultErrorCallback);
	if(m_pxFoundation == NULL)
	{
		Con::cerr<<"ERROR: Unable to create PhysX foundation!"<<Con::endl;
		CriticalFailure()
	}
	m_physics = PxCreatePhysics(PX_PHYSICS_VERSION,*m_pxFoundation,physx::PxTolerancesScale());
	if(m_physics == NULL)
	{
		Con::cerr<<"ERROR: Unable to create top-level PhysX Object!"<<Con::endl;
		CriticalFailure();
	}

Creating the scene:

physx::PxPhysics *physics = state->GetPhysics();
	physx::PxSceneDesc sceneDesc(physics->getTolerancesScale());
	sceneDesc.gravity = physx::PxVec3(0.0f,-9.81f,0.0f);
	if(sceneDesc.cpuDispatcher == NULL)
	{
		physx::PxDefaultCpuDispatcher *dispatcher = physx::PxDefaultCpuDispatcherCreate(1);
		if(dispatcher == NULL)
		{
			Con::cerr<<"Unable to create PhysX CPU Dispatcher"<<Con::endl;
			CriticalFailure();
		}
		sceneDesc.cpuDispatcher = dispatcher;
	}
	if(sceneDesc.filterShader == NULL)
		sceneDesc.filterShader = physx::PxDefaultSimulationFilterShader;
	if(!sceneDesc.isValid())
	{
		Con::cerr<<"PhysX Simulation Filter Shader is invalid"<<Con::endl;
		CriticalFailure();
	}
	m_pxScene = physics->createScene(sceneDesc);
	if(m_pxScene == NULL)
	{
		Con::cerr<<"Unable to create PhysX scene"<<Con::endl;
		CriticalFailure();
	}

Creating the test actors:

float radius = 20.0f;
	float density = 10.0f;

	physx::PxMaterial *aMaterial = physics->createMaterial(0.5f,0.5f,0.1f); //static friction, dynamic friction, restitution

	physx::PxRigidDynamic *aSphereActor = physics->createRigidDynamic(physx::PxTransform(physx::PxVec3(0,0,0)));
	physx::PxShape *aSphereShape = aSphereActor->createShape(physx::PxSphereGeometry(radius),*aMaterial);
	physx::PxRigidBodyExt::updateMassAndInertia(*aSphereActor,density);
	aSphereActor->setLinearVelocity(physx::PxVec3(50,0,0));

	m_pxScene->addActor(*aSphereActor);

	physx::PxRigidStatic *plane = physx::PxCreatePlane(*physics,physx::PxPlane(physx::PxVec3(0,1,0),0),*aMaterial);
	m_pxScene->addActor(*plane);

// Dummy connection handler:

struct MyConnectionHandler : public physx::debugger::comm::PvdConnectionHandler
{
    virtual void onPvdSendClassDescriptions( physx::debugger::comm::PvdConnection& inFactory )
    {
    }
    virtual void onPvdConnected( physx::debugger::comm::PvdConnection &con )
    {
		Con::cwar<<"Successfully connected to PVD!"<<Con::endl;
    }
    virtual void onPvdDisconnected( physx::debugger::comm::PvdConnection&)
    {
		Con::cwar<<"Disconnected from PVD!"<<Con::endl;
    }
};

// Opening the connection:

if(m_physics->getPvdConnectionManager() == NULL || m_pxPvdConnection != NULL)
		return;
	physx::PxVisualDebuggerConnectionFlags flags = physx::PxVisualDebuggerConnectionFlag::eDEBUG;
	m_pxPvdConnection = physx::PxVisualDebuggerExt::createConnection(m_physics->getPvdConnectionManager(),"C:\Path\To\Aplication\pvdout.txt",flags);

	MyConnectionHandler myConnectionHandler;
	if(m_physics->getPvdConnectionManager())
		m_physics->getPvdConnectionManager()->addHandler(myConnectionHandler);

	m_physics->getVisualDebugger()->setVisualizeConstraints(true);
	m_physics->getVisualDebugger()->setVisualDebuggerFlag(physx::PxVisualDebuggerFlag::eTRANSMIT_CONTACTS,true);

I’d also like to mention that even though the connection is successful, trying to release the connection (m_pxPvdConnection->release();) raises an exception.

Does PVD work when you run the sample provided with the PhysX SDK?

I have the same problem here, and even tested PVD on another computer, but it shows the same error.
Did you found any solution to this?

Just found the solution. You can see it pointed out by UnholySheep here: https://gamedev.stackexchange.com/questions/86186/how-to-load-and-render-physx-3-3-heightfield.

Basically these messages are normal when PVD can’t connect to any application, and you have to link the CHECKED PhysX libraries instead of the “normal” ones to make it work. Doing this solved the problem for me.

PVD support is not included in the RELEASE libraries in order to improve runtime performance and reduce memory overhead. The PROFILE and CHECKED configurations support PVD.

From the User Guide section on PVD:

Basic Setup (SDK Side)
PVD integration is enabled in the debug, checked and profiling configurations of the SDK. In order to reduce memory footprint and code size, it is not enabled in the release configuration.

The SDK outputs the PVD debugging data in form of a stream. PVD supports reading the stream either from a TCP/IP network socket or from a file.

This configuration is very confuse, would be better simplify and demonstrate with fresh screenshots. And put more information about this with documentation, and not just a video in the main page. My internet is very bad and not always I can see the video.

Hi,

I’ve asked one of our engineers who works on PVD to sign onto this thread, please stay tuned.
Thanks!