OgrePhysX - added destruction + Demo

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Shtuka
Greenskin
Posts: 146
Joined: Mon Jan 10, 2011 7:39 pm
x 9

Re: OgrePhysX - added destruction + Demo

Post by Shtuka »

OK, I did it. Is anyone interested? Where can I upload it?
Transporter
Minaton
Posts: 933
Joined: Mon Mar 05, 2012 11:37 am
Location: Germany
x 110

Re: OgrePhysX - added destruction + Demo

Post by Transporter »

Add it as an attachment to your posting. To decrease the file size, you can create a patch file.
Darkblaze
Gnoblar
Posts: 1
Joined: Sat Sep 24, 2011 8:09 pm

Re: OgrePhysX - added destruction + Demo

Post by Darkblaze »

Shtuka wrote:OK, I did it. Is anyone interested? Where can I upload it?
I'd be interested to see it. I was planning on attempting that but have been busy working :?
Shtuka
Greenskin
Posts: 146
Joined: Mon Jan 10, 2011 7:39 pm
x 9

Re: OgrePhysX - added destruction + Demo

Post by Shtuka »

I've attached the /include and the /source directory .7z compressed. Please give me feedback.
Attachments
OgrePhysX_04.7z
(16.17 KiB) Downloaded 674 times
billias13
Gnoblar
Posts: 10
Joined: Wed Mar 14, 2012 5:56 pm

Re: OgrePhysX - added destruction + Demo

Post by billias13 »

Hello,
i am also interested in using PhysX with my ogre applications. Up to now i was using Bullet but i think i should port to PhysX. I am a total noob in this library though..
So i have a question : should i start on Physx 3.2 or use the earlier versions? Up to know, any examples and tutorials that exist refer to 3.1 or even previous versions, and the documentation of 3.2 is
not that easy for a beginner to understand (it requires previous knowledge that i don't have).

you guys seem to be familiar in ogre+physx, so are you going to use the new physx? (Can i count on you? :P )
Transporter
Minaton
Posts: 933
Joined: Mon Mar 05, 2012 11:37 am
Location: Germany
x 110

Re: OgrePhysX - added destruction + Demo

Post by Transporter »

For an old SDK you can use NxOgre:
betajaen wrote:From what I hear the 3.x SDK is radically different from the 2.8.x SDK NxOgre is based upon, so a partial rewrite would be required.
OgrePhysX is working with the new SDK.
Shtuka
Greenskin
Posts: 146
Joined: Mon Jan 10, 2011 7:39 pm
x 9

Re: OgrePhysX - added destruction + Demo

Post by Shtuka »

Hi,

assume I've created a Destructible---how can I access to the corresponding Entity for setting its material?
Shtuka
Greenskin
Posts: 146
Joined: Mon Jan 10, 2011 7:39 pm
x 9

Re: OgrePhysX - added destruction + Demo

Post by Shtuka »

Is OgrePhysX still being developped? I have added PhysX 3.2.1 and height field support, if anyone is interested.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: OgrePhysX - added destruction + Demo

Post by jacmoe »

@Shtuka: Great news!

I don't think OgrePhysX has a repository of it's own, and it really should have.

Do you mind creating a project on Bitbucket ? :)
Or, if you do mind, I will.

The license for OgrePhysX is:
/*
This source file is part of OgrePhysX.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Shtuka
Greenskin
Posts: 146
Joined: Mon Jan 10, 2011 7:39 pm
x 9

Re: OgrePhysX - added destruction + Demo

Post by Shtuka »

@jacmoe: I will do tomorrow.
Shtuka
Greenskin
Posts: 146
Joined: Mon Jan 10, 2011 7:39 pm
x 9

Re: OgrePhysX - added destruction + Demo

Post by Shtuka »

I have uploaded it to https://bitbucket.org/shtuka/ogrephysx Edit: Made the repository public.

I will add a demo program at the weekend.
Caphalor
Greenskin
Posts: 116
Joined: Tue Feb 06, 2007 8:54 pm
Location: Berlin, Germany
x 25

Re: OgrePhysX - added destruction + Demo

Post by Caphalor »

Hi,
I just wanted to post that it is really great that you continue to develop OgrePhysX. I am sorry that I didn't provide any support but I needed a break from my coding projects and after that I wanted to do something new. I don't use OgrePhysX at the moment but there is a chance that I will return to it later (most likely more / better destructible stuff). In this case I will checkout your repo of course.
assume I've created a Destructible---how can I access to the corresponding Entity for setting its material?
There is one entity for each split part. At the moment there is no method to access the parts from the outside, so you need a new method for that. Simply iterate mParts, for every part you can access the ogre node this way:

Code: Select all

((NodeRenderable*)part->mRenderedActor->getPointRenderable())->getOgreNode();
The entity is the only object attached to the node so it's easy to access it via the node. It's not pretty but it is safe to do that in this case.
Image
Generated with vBaum - voxel based procedural geometry generator with python interface.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: OgrePhysX - added destruction + Demo

Post by jacmoe »

Thanks a lot Shtuka and Caphalor! :)
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Shtuka
Greenskin
Posts: 146
Joined: Mon Jan 10, 2011 7:39 pm
x 9

Re: OgrePhysX - added destruction + Demo

Post by Shtuka »

Jay974
Gnoblar
Posts: 5
Joined: Mon Oct 29, 2012 4:07 pm

Re: OgrePhysX - added destruction + Demo

Post by Jay974 »

Hello everybady,

AnyOne can help me please?

I have the following problem (when i build my project Ogre 1.8.1 and Ogrephysx 0.4)

Erreur 1 error LNK2001: symbole externe non résolu "public: class OgrePhysX::Actor<class physx::PxRigidDynamic> __thiscall OgrePhysX::Scene::createRigidDynamic(class Ogre::Entity *,float,class Ogre::Vector3 const &,class physx::PxTransform const &)" (?createRigidDynamic@Scene@OgrePhysX@@QAE?AV?$Actor@VPxRigidDynamic@physx@@@2@PAVEntity@Ogre@@MABVVector3@5@ABVPxTransform@physx@@@Z) d:\doc\visual studio 2012\Projects\Ogre_3D_ADD_ON\Ogre_3D_ADD_ON\Application.obj Ogre_3D_ADD_ON (Visual Studio 2010)

I know i most include a ".lib" but i don't know which?

Thank for your futur help.
Jay974
Gnoblar
Posts: 5
Joined: Mon Oct 29, 2012 4:07 pm

Re: OgrePhysX - added destruction + Demo

Post by Jay974 »

Up :D
Ezee
Gnoblar
Posts: 2
Joined: Wed Nov 16, 2011 7:22 pm

Re: OgrePhysX - added destruction + Demo

Post by Ezee »

Hi !
My previous post wasn't published ( for political reason - 2 videos in one post , Ughhh ... :lol: )
Sorry Jay , my help to you goes to the trap . :roll:

Anyway , what i wanted to say about OgrePhysx and the Destructible class , is that i like it .
Thanks to the authors ! (and " bravo " in french :wink: ).

But now , i want to talk about the optimization of the destructible class , and for the same instance , a way to finalize
Ragdoll system in OgrePhysx .

I'm very new to Physx , so i spend a lot of time translating the official doc ( i'm french , buddies ), but i found that :
Using aggregates to speed-up insertion of objects in the scene
Adding objects to a scene can be costly if the number of objects is large and it all happens in one frame. This can be the case for a ragdoll, which is a good candidate for PxAggregate, as we discussed above. Another case might be localized debris, for which self-collisions are often disabled. It can be a good strategy to spawn all the debris at once in a PxAggregate, then remove and re-insert each actor from the aggregate to the scene, over N frames. This would amortize the cost of object insertion into the broad-phase structure, over N frames
I agree with the fact that the actual way is impressive ( to watch the debris collide after explode ) , but the cost is high
for the rendering time , with only three "meteors" , on my 3.2ghz monocore cpu .
I plan to use OgrePhysx in my game dev , and i'm ready to spend some time to improove it .

I'm actually coding some new methods for the OgrePhysx::Scene CLass :
The goal is for me to insert Aggregate in the creation routines for DESTRUCTIBLES and RAGDOLL .
But i don't know wich approach is better :

_ Give to DESTRUCTIBLE class a new Aggregate member ( to fill it before inserting in scene )
PxActor& actor; // Some actor, previously created --> and member of DESTRUCTIBLE in our case
aggregate->addActor(actor);
Note that the actor should not have been added to the scene already. If it already belongs to a scene, the call is ignored. You should first add all the actors to an aggregate, then add the aggregate to the scene. Alternatively you can first add the aggregate to the scene, then the actors to the aggregate. In any case, do not add the actors both to the scene and to an aggregate.
_ Make a brand new class ( OgrePhysX::Aggregate) i , witch will be the pre-requisite for the creation of DEBRIS and RAGDOLL :
An aggregate is a collection of actors managed as a single entity in the broad-phase data structures. This is purely an optimization, it does not provide extra features compared to regular actors.

The typical use case is a ragdoll, made of N different body parts, with each part a PhysX actor. This usually gives birth to N broad-phase entries for a single ragdoll. This might lead to performance issues since those N objects are almost always overlapping each-other each frame, and as a result a lot of useless overlap tests are performed in the broad-phase. It is often more efficient to have a single broad-phase object for the whole ragdoll, and do the body-body collision checks (if necessary) in a second pass.
Please , let me know what you think ( :idea: ) about that .
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4304
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 135
Contact:

Re: OgrePhysX - added destruction + Demo

Post by spacegaier »

Ezee wrote:Hi !
My previous post wasn't published ( for political reason - 2 videos in one post , Ughhh ... :lol: )

With a little bit of patience it would have been :) . It just landed in our manual approval queue since you are a new user. Just FYI. Now back to topic...
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
Ezee
Gnoblar
Posts: 2
Joined: Wed Nov 16, 2011 7:22 pm

Re: OgrePhysX - added destruction + Demo

Post by Ezee »

Salut , SpaceGaier ! ( and respect too ... )
With a little bit of patience it would have been
You are right sir ! I'm a little bit " exited " with that OgrePhysx 0.4 release .
So , yeah , i need to be more patient , and you drive me the good way .
:wink:

So ... back to the Topic you said :

I really hope that there will be soon a 0.5 release , as Caphalor is Ok for we ( the community ) play with his code
and help it grow .

But i've got to say that the actual Framework need ( from my point of view :mrgreen: ) some little improvement ,
to help the end users to use it . Okay , ther's no doc , but that's not the biggest problem , as we can't write an help
without knowing HOW IT WORKS .

EDIT : mmm... wasn't so clear . So in other words , before we can provide an help ,
we need to understand HOW IT WORKs, " we " that have decided to help the Caphalor's effort .
( who just had no time for writing help ... ).
So I think that every effort to help understanding on how to use the framework will be welcome .
And the demo provided don't show all the tricks .


As an example , for my participation :

You will find two similar named methods for creating things :

Code: Select all

Destructible* createDestructible(const Ogre::String &meshSplitConfigFile, float breakForce = 1000.0f, float breakTorque = 1000.0f, float density = 100.0f, const Ogre::Vector3 &scale = Ogre::Vector3(1,1,1));

Destructible* createDestructible(const Ogre::String &meshSplitConfigFile, PxMaterial &material, float breakForce = 1000.0f, float breakTorque = 1000.0f, float density = 100.0f, const Ogre::Vector3 &scale = Ogre::Vector3(1,1,1));
What is the meaning of that design ?
Well , in fact the first method is a DEFAULT method , without material provided .
Look what is done in the first version of the func :

Code: Select all

Destructible* Scene::createDestructible(const Ogre::String &meshSplitConfigFile, float breakForce, float breakTorque, float density, const Ogre::Vector3 &scale)
	{
		return createDestructible(meshSplitConfigFile, World::getSingleton().getDefaultMaterial(), breakForce, breakTorque, density, scale);
	}
MY SUGGESTION FOR THE 0.5 RELEASE :

Rename the methods that in fact are DEFAULT fonctions , to help to choose the right one , and help to a better understanding and usage of the framework .
I think at something like :

Code: Select all

Destructible* createDEFAULTDestructible(const Ogre::String &meshSplitConfigFile, float breakForce = 1000.0f, float breakTorque = 1000.0f, float density = 100.0f, const Ogre::Vector3 &scale = Ogre::Vector3(1,1,1));

Destructible* createDestructible(const Ogre::String &meshSplitConfigFile, PxMaterial &material, float breakForce = 1000.0f, float breakTorque = 1000.0f, float density = 100.0f, const Ogre::Vector3 &scale = Ogre::Vector3(1,1,1));
There are so many others functions that could be renamed , but i won't list dem all here .
Perhaps Caphalor will have something to say about that , or Shtuka , or Jacmoe ? ( i know they have an account on github
for the project , i would be pleased to know what is their direction today :) )

Thank you for your patience ( yep , a long post ), and long life to OgrePhysx with I and I help .
Rôôooooôôoo ... ( salutation in my ogre langage )
:wink:
User avatar
Mind Calamity
Ogre Magi
Posts: 1255
Joined: Sat Dec 25, 2010 2:55 pm
Location: Macedonia
x 81

Re: OgrePhysX - added destruction + Demo

Post by Mind Calamity »

Shtuka wrote:Is OgrePhysX still being developped? I have added PhysX 3.2.1 and height field support, if anyone is interested.
I'm interested in that heightfield support, but your repository doesn't have it. Maybe you forgot to add the files ?
BitBucket username changed to iboshkov (from MindCalamity)
Do you need help? What have you tried?
- xavier
---------------------
HkOgre - a Havok Integration for OGRE | Simple SSAO | My Blog | My YouTube | My DeviantArt
Shtuka
Greenskin
Posts: 146
Joined: Mon Jan 10, 2011 7:39 pm
x 9

Re: OgrePhysX - added destruction + Demo

Post by Shtuka »

In OgrePhysXScene.h:

Code: Select all

Actor<PxRigidStatic> createHeightField(const Ogre::Vector3& position, size_t numCols, size_t numRows, PxReal heightScale, PxReal rowScale, PxReal colScale, const PxHeightFieldDesc& hfDesc);
                Actor<PxRigidStatic> createHeightField(const Ogre::Vector3& position, size_t numCols, size_t numRows, PxReal heightScale, PxReal rowScale, PxReal colScale, const PxHeightFieldDesc& hfDesc, PxMaterial &material);
In OgrePhysXScene.cpp:

Code: Select all

Actor<PxRigidStatic> Scene::createHeightField(const Ogre::Vector3& position, size_t numCols, size_t numRows, PxReal heightScale, PxReal rowScale, PxReal colScale, const PxHeightFieldDesc& hfDesc)
        {
                return createHeightField(position, numCols, numRows, heightScale, rowScale, colScale, hfDesc, World::getSingleton().getDefaultMaterial());
        }

        Actor<PxRigidStatic> Scene::createHeightField(const Ogre::Vector3& position, size_t numCols, size_t numRows, PxReal heightScale, PxReal rowScale, PxReal colScale, const PxHeightFieldDesc& hfDesc, PxMaterial &material)
        {
                PxHeightField* aHeightField = getPxPhysics()->createHeightField(hfDesc);
                if (!aHeightField)
                        OGRE_EXCEPT(0, "createHeightField failed!", __FUNCTION__);

                //PxTransform pose = PxTransform(PxVec3(position.x,position.y,position.z)
                //, PxQuat(PxHalfPi, PxVec3(0.0f, 1.0f, 0.0f))
                //      );
                PxTransform pose(PxVec3(-((PxReal)numRows*rowScale) / 2.0f, 
                        0.0f, 
                        -((PxReal)numCols*colScale) / 2.0f), 
                        PxQuat::createIdentity()
                        //PxQuat(PxHalfPi, PxVec3(0.0f, 1.0f, 0.0f))
                        );

                PxRigidStatic* aHeightFieldActor = getPxPhysics()->createRigidStatic(pose);
                if (!aHeightFieldActor)
                        OGRE_EXCEPT(0, "createRigidStatic failed!", __FUNCTION__);

                PxHeightFieldGeometry hfGeom(aHeightField, PxMeshGeometryFlags(), heightScale, rowScale, colScale);
                PxShape* aHeightFieldShape = aHeightFieldActor->createShape(hfGeom, material);
                if (!aHeightFieldShape)
                        OGRE_EXCEPT(0, "aHeightFieldActor->createShape failed!", __FUNCTION__);

                mPxScene->addActor(*aHeightFieldActor);

                Actor<PxRigidStatic> actor(aHeightFieldActor);
                return actor;
        }
User avatar
Mind Calamity
Ogre Magi
Posts: 1255
Joined: Sat Dec 25, 2010 2:55 pm
Location: Macedonia
x 81

Re: OgrePhysX - added destruction + Demo

Post by Mind Calamity »

Thanks for the quick reply. What do you fill the heightfield description with, though ?
BitBucket username changed to iboshkov (from MindCalamity)
Do you need help? What have you tried?
- xavier
---------------------
HkOgre - a Havok Integration for OGRE | Simple SSAO | My Blog | My YouTube | My DeviantArt
Shtuka
Greenskin
Posts: 146
Joined: Mon Jan 10, 2011 7:39 pm
x 9

Re: OgrePhysX - added destruction + Demo

Post by Shtuka »

Sorry, you'll have to wait until I am at my other computer.
User avatar
Mind Calamity
Ogre Magi
Posts: 1255
Joined: Sat Dec 25, 2010 2:55 pm
Location: Macedonia
x 81

Re: OgrePhysX - added destruction + Demo

Post by Mind Calamity »

Shtuka wrote:Sorry, you'll have to wait until I am at my other computer.
OK, well send me a PM when you post it. :)
BitBucket username changed to iboshkov (from MindCalamity)
Do you need help? What have you tried?
- xavier
---------------------
HkOgre - a Havok Integration for OGRE | Simple SSAO | My Blog | My YouTube | My DeviantArt
Shtuka
Greenskin
Posts: 146
Joined: Mon Jan 10, 2011 7:39 pm
x 9

Re: OgrePhysX - added destruction + Demo

Post by Shtuka »

I will update OgrePhysX when the GSoC is finished and Ogre 2.0 has been merged into the main OGRE branch.
Post Reply