IrrPhysx 0.2 - Nvidia Physx 2.8.1 wrapper

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Post by christianclavet »

Yeah, this one does the same as HAVOK. Theses are artist tools. Look as good as the HAVOK ones.

Here is a link to a video of a demo:
http://www.youtube.com/watch?v=8JtAdTon0JA

From what I see there is very few infos and documents about this APEX framework. Seem relatively new. We can register with NVIDIA to be a BETA TESTER for APEX. Not sure they have completed all of the modules (Cloth seem to be done, since they talk about plugins for MAX and MAYA). But there is almost no detailed info about destruction. It was first presented at the 2009 GDC. It seem to have been developped on the CUDA platform.

If all thoses modules are done, they will beat off HAVOK surely! (Their vegetation module look very promising, as you can chop off trees and bend branches with collisions impact)

EDIT: Found that they applied destruction on UT3 (NVidia mod)
Video here:
http://www.youtube.com/watch?v=LPvL73GH ... re=related
If you look attentively the demo, you'll see that the level designer defined what was breakable and what is not. They used their tool to create the pieces (As JP mentionned, without it, you have to create the pieces manually in your 3D modeling application that is very time consuming)

Here is a video demonstrating the FRACTURE artist tool that created all the elements of destruction:
http://www.youtube.com/watch?v=WuV6wGnm ... re=channel

Here is their tools they used to create cloth ingame (maya plugin):
http://www.youtube.com/watch?v=w9pHHBME ... re=channel
wing64
Competition winner
Posts: 242
Joined: Wed Jul 23, 2008 2:35 am
Location: Thailand
Contact:

Post by wing64 »

Thanks. :D
ulao
Posts: 274
Joined: Fri Mar 28, 2008 2:13 am

Post by ulao »

Hey JP, new comer here. Just wanted to drop a shout out to you. Very nice, clean, and well documented wrapper you have constructed. I went trough great leaps to get my vs 2005 to 08, but after that it was a breeze.

I'm going to be giving your phys engine a work out, starting with the heightmap. I will report if I have those issues I read about here.

the only question I have, as I imagine most do, is.. Will we see version 3 this month or next?

Also I currently move objects by transformations, and saw a few people attempted a force method. Has anyone perfected this? I have not looked in to that but I image that a better way to create motion.

btw: Not a big deal and I'm sure its just a few difference in linker options but, what this all about?

Code: Select all

IrrPhysx.lib(IrrPhysx.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification
LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
Dorth
Posts: 931
Joined: Sat May 26, 2007 11:03 pm

Post by Dorth »

First 2 lines of warnings means one of the lib (anyone of those) got the flag that project should be optimized on linking and not on compile (and thus can have more optimization). However, the warning is because the project itself is not set with that flag meaning it first compiled when building the obj and must now start anew since he found this flag at linking time. Change it in your project setting (both linker(LTCG) and c++ interpreter(GL)) and you will both compile faster and remove the warning.

The second warning means one of the default library is conflicting. This happens 99.9% of the time when you mix debug with release or threaded dll with threaded (or debug threaded dll with threaded debug or any other mix having dll and not dll). Check each of your libs. But anyway, you can choose to ignore libcmt if you'd rather not fix all your projects (I'd advise to fix your projects and libs, however ^^)
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Dorth gives a better explanation there than I could! I've got these pesky warnings on a few of my projects but not on others and can never get rid of them in those projects no matter what I do... Maybe Dorth's suggestions will help with that... Regardless, it seems that they don't actually cause any harm that I can see.

Unfortunately we probably won't be seeing 0.3 for a while due to the mega hours I'm doing at work (current record of badness is 35 hours at work over two days... thank god I love my job! :lol: ).
Image Image Image
ulao
Posts: 274
Joined: Fri Mar 28, 2008 2:13 am

Post by ulao »

JP wrote:Unfortunately we probably won't be seeing 0.3 for a while due to the mega hours I'm doing at work (current record of badness is 35 hours at work over two days... thank god I love my job! :lol: ).
- Sad to here but I can certainly understand.

Thx for the tips Dorth.
ulao
Posts: 274
Joined: Fri Mar 28, 2008 2:13 am

Post by ulao »

My terrain is not at the right position and scale? I turned on the debug view and I see my terrain phys object is not correct unless scal and rotation are (0,0,0)

Testing::

using a rotation other the 0,0,0 will rotate the phys object mesh around point 1,1,1. In other words if I rotate my terrain by y 90, my phys mesh is now off to the side.

using scale seem to drastically off set the mesh in the Y only, If I scale by 1,2,1 seems the mesh was moved down by 50% or so. However the scale was correct. The pos was just compromised. I fI do this

Code: Select all

	terrObj->setPosition( core::vector3df( terr->getPosition().X, terr->getPosition().Y * -1.55,terr->getPosition().Z ) );
It rights it.
I;m guessing this is the Y multiplier that is messing things up.



offsetting the position seem to work fine.

BTW: I'm using the first method of terrain phys.

ne.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

I thought all the terrain stuff was fairly good but possibly not... especially the method of passing in the raw data, rather than an irrlicht heightmap, that one's a bit tricky to get right I think.

Unfortunately I can't help you much with it as I'd have to take a close look into it all and don't have the time to do so.. so you'll have to try and debug it yourself I guess... :? Really sorry about that!
Image Image Image
ulao
Posts: 274
Joined: Fri Mar 28, 2008 2:13 am

Post by ulao »

It is ok, JP.. I know your busy. Consider it feed back for now. If I get a change I will look in to it, but for the mean time I moved on.
Mux
Posts: 56
Joined: Mon Feb 26, 2007 12:25 pm
Location: Stockholm

Post by Mux »

I've too have had problems with scaling my Irrlicht terrain node. Since I'm not content with having a map with a y-scale of 1 I dug in to the wrapper code and tried to alter it so that it would work with my map scale (I want a y-scale of 4). This is what I did:
I change the line

Code: Select all

currentSample->height = (NxI16)((heightmap->getPixel(row,column).getLuminance() - centre.Y) * Y_MULTIPLIER);
to

Code: Select all

currentSample->height = (NxI16)((heightmap->getPixel(row,column).getLuminance()) - centre.Y/scale.Y );
Then I altered the line

Code: Select all

heightFieldShapeDesc.heightScale	= scale.Y / Y_MULTIPLIER;
to

Code: Select all

heightFieldShapeDesc.heightScale	= scale.Y;
And finaly I changed

Code: Select all

actorDesc.globalPose.t = NxVec3(position.X, position.Y, position.Z);
to

Code: Select all

actorDesc.globalPose.t = NxVec3(position.X, position.Y*scale.Y, position.Z);
That works pretty well for my current map, but I tried another one which failed big time.
It'll only take a minute or two to debug this code...
kaos
Posts: 155
Joined: Tue Aug 12, 2008 8:25 pm
Location: Spain

Post by kaos »

How can I do, for to change the restitue and frintion the one mesh.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Currently no support for that I'm afraid. I'm sitting on some material support at the moment but won't be able to get it released any time soon as a fair bit of tidying up has to be done and I'm seriously bogged down with my job at the moment so don't have the time for it!
Image Image Image
kaos
Posts: 155
Joined: Tue Aug 12, 2008 8:25 pm
Location: Spain

Post by kaos »

You have done a great work

I wait for the next version
specter
Posts: 3
Joined: Sat Jun 20, 2009 3:03 pm

Post by specter »

First of i want to say thanks for this great wrapper. as my knowledge when it comes to c++ and good programming in general is very limited, as i'm a visual effects artist, i really love the concept of irrlicht and your wrapper, to keep things simple and the hard stuff away from me. so thanks for this.

now, i have a problem with one aspect of your wrapper. i'm doing a little game with the artoolkit (Augmented Reality, pattern tracking etc) and already use the irrar wrapper from "FreakNigh" to render my stuff with irrlicht. so far everything works great.

now i tried your wrapper for physx and everything worked as expected but one thing does not or i'm just too stupid to get it work.

i need to put my phys objects into different collisionGroups. so i tried the "setCollisionGroup " function: virtual void IrrPhysx::IPhysxObject::setCollisionGroup ( u16 group ) [inline, virtual]

but this does not work for me. my objects still collide with everything in the scene. it's a bit difficult to explain why i need this, because of the pattern tracking stuff and this does complicate things allot, but i will try so.

so i have a function which creates my physObjs:

Code: Select all

void loadLevel(std::string levelPfad,std::string levelEndung,int levelParts,scene::ISceneNode* parent,irr::u16 assetOWN, core::vector3df position)	{
		std::string levelModel("");
		std::string levelCount;
		std::string levelTexture;

		for (int i = 1; i<levelParts; i++)	{
			tempAsset = new assetManager(device,physxManager);
			tempAsset->assetOWN = assetOWN;
			std::ostringstream temp;
			temp << i;
			levelCount = temp.str();
			levelModel.append(levelPfad);
			levelModel.append(levelCount);
			levelTexture = levelModel;
			levelModel.append(levelEndung);
			levelTexture.append(".png");
			MyAssets.push_front(tempAsset->loadAsset(levelModel,levelTexture,parent,assetOWN,position));
			temp.clear(true);
			levelModel.clear();
		}
	}
there i use assetOWN as my group identifier. this function calls a class function in my assetManager:

Code: Select all

assetManager* assetManager::loadAsset(std::string assetPfad, std::string texturePfad, scene::ISceneNode* parent, irr::u16 assetOWN, core::vector3df position)
{
	IPhysxMesh * levelPhysx = 0;
	SPhysxAndNodePair * levelPair = 0;
	scene::IMesh* levelMesh;
	this->assetOWN = assetOWN;

		levelMesh = smgr->getMesh(assetPfad.c_str());
		levelPair = new SPhysxAndNodePair;
		levelPhysx = this->physxManager->createConvexMesh(levelMesh->getMeshBuffer(0), core::vector3df(1,1,1));
		levelPair->PhysxObject = physxManager->createConvexMeshObject(levelPhysx, position, core::vector3df(0,0,0), rand());
		levelPair->SceneNode = smgr->addMeshSceneNode(levelMesh, parent, assetOWN,position, core::vector3df(0,0,0), core::vector3df(1,1,1));
		levelPair->SceneNode->setMaterialTexture(0, driver->getTexture(texturePfad.c_str()));
		levelPair->SceneNode->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, true);
		levelPair->SceneNode->setMaterialFlag(video::EMF_LIGHTING, false);
		levelPair->SceneNode->setMaterialType(video::EMT_SOLID);
		levelPair->PhysxObject->setCollisionGroup(assetOWN);
		levelPair->SceneNode->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF);
		//objects->push_back(levelPair);
		levelMesh->drop();
		this->assetID++;
		this->asset = levelPair;
		
	//delete levelPhysx;
	//delete levelPair;
	return this;

}
there i set the collision group. so everytime i call the loadLevel function with different assetOWN values, i want only the physObjs collide within the same group. but it does not work. so i hope you guys can help me with that. maybe i missed something how to set up collison groups, because i thouhgt you just have to pass different u16 values and that's it.

please don't blame me about bad code and stuff, i know this and the possibility that i simply did something totaly stupid is relativly high ;)

so, thanx in advance!
Dorth
Posts: 931
Joined: Sat May 26, 2007 11:03 pm

Post by Dorth »

Unless I'm mistaken, any collision group ever is a bitmask, aka, not a different int, but a bit interpretation.
Explanation:
1: 0001
2: 0010
4: 0100
8: 1000

So
15:1111

collides with all 4 other groups
5: 0101 collides with group 1 and group 4
etc.
Post Reply