oFusion + nxogre + new xml format file

valtovar

24-10-2006 02:21:17

Hi all.
I build a plugin to 3dmax (while i was learning MAXScript and nxOgre) to export the descriptors (shapes) in a simple xml to integrate with OSM (oFusion scene descriptor) to my engine.

the code is: (not it's so good, but work fine xD)

-- Rollout to export descriptos physx
rollout progressTest "Exportar Fisicas"
(
-- Button start to export physics
button export "Export Descriptors";

-- Porgress bar with red color
progressbar export_prog color:red;

-- Start
on export pressed do
(
-- Select All Meshes
format ( "[Physx] select all\n" );
objArray = geometry as array;

if ( objArray.count >= 1 ) then
(
-- build file
format ( "[Physx] Build file: physx.phy\n" );

-- open file
outFile = createfile ( "physx.phy" );

-- if can not build file.
if ( outFile == undefined ) then
(
format ("[Physx] can not build file" );
return false;
)

-- wirte root node
format ( "[Physx] Root Node\n" );
format ( "<physx>\n" ) to: outFile;

format ( "[Physx] saving descriptors\n" );

-- loop 1 to AllMeshes.count
for i = 1 to objArray.count do
(
-- if it is Sphere descriptor save RADIUS.
if ( classof objArray[i] == Sphere ) then
(
format ( "\t<mesh name=\"%\" radius=\"%\" />\n" ) objArray[i].name objArray[i].radius to: outFile;
)
-- if it's Cylinder descriptor save RADIUS and HEIGHT.
else if ( classof objArray[i] == Cylinder ) then
(
format ( "\t<mesh name=\"%\" radius=\"%\" height=\"%\" />\n" ) objArray[i].name objArray[i].radius objArray[i].height to: outFile;
)
-- if it's Box descriptor save WIDTH, HEIGHT and LENGTH.
else if ( classof objArray[i] == Box ) then
(
format ( "\t<mesh name=\"%\" width=\"%\" height=\"%\" length=\"%\" />\n" ) objArray[i].name objArray[i].width objArray[i].length objArray[i].height to: outFile;
)

-- Increment the progress bar.
progress = 100.*i/objArray.count;

format ( "[Physx] Progress: %\n" ) progress;
export_prog.value = progress;
)

-- Close root node.
format ( "[Physx] Closing Root Node\n" );
format ( "</physx>\n" ) to: outFile;
-- Close file.
format ( "[Physx] Closing File\n" );
close outFile;

format ( "[Physx] Scene descriptors saved" );
format ( "[Physx] Close file" );
)

-- if no data.
else
(
format ( "[Physx] There are not descriptors" );
messageBox "Error: There are not descriptors";
)
)
)

-- Show dialog of progress
createDialog progressTest 200 60


i modified the Ogre_OSMScene.h (.cpp) to load my scene and my descriptors to my meshes and i can use it ofusion with nxogre. The idea is: i have a table with 5 descriptors (boxes) in my scene, i export osm file and physx.phy. (note: all descriptors must be in a different layer and before to export hide all meshes -- or layers ).

i put my code (.cpp and .h) to load the descriptors when it's stable.

Ideas? sugg?

the xml:


<physx>
<mesh name="Box01" width="20.1079" height="10.0178" length="25.0686" />
<mesh name="Box02" width="3.85523" height="25.8127" length="23.0668" />
<mesh name="Box03" width="39.2257" height="10.9415" length="24.8906" />
<mesh name="Box04" width="8.78342" height="35.8127" length="25.5905" />
<mesh name="Box05" width="8.78342" height="35.8127" length="25.5905" />
</physx>


five descriptors to my table, after load with:
nxOgre::body *myCube = mScene->createBody(pszName,pszFileName,new nxOgre::cubeShape(10.0f),10.0f,Vector3(0,3.5,0));

process to pregress xD

sorry for my english, i speak spanish xD

valtovar

24-10-2006 03:24:05

firsts correction:
change:
objArray = geometry as array;

for:
objArray = selection as array;

and all your meshes selecteds will be include in your physx.phy

now you can select the meshes that you want like shapes in physx.

betajaen

24-10-2006 09:00:42

Good work!

If you have 0.4RC1 we have an exporter/importer already, good news is it supports multiple file formats.

Look at nxOgre_textStream.h and nxOgre_textStream.cpp for more details, and tutorials 504a and 504b.


On some related news, I wrote a Python script ages back that converts a PhysX PML scene to NxScene, perhaps I should clean it up and release it one day.

valtovar

24-10-2006 17:47:47

i have 0.5 preview 3 and i can't see these files.
where can i find then?

betajaen

24-10-2006 18:03:10

It's in 0.4 RC1, Preview 3 is like 6-7 months old.

valtovar

24-10-2006 21:13:03

hi
mmm but the last version is 0.5p3 or not?
these files are not in this version?
why?

betajaen

24-10-2006 21:17:31

No, like I said. 0.4 RC1 is the latest version, Preview 3 was released over 7 months ago.

valtovar

24-10-2006 21:30:43

www.nxogre.com
Latest: 0.5 Preview 3.0

?? where can i get 0.4RC1? in sourceforge i see 0.5p3 :S i don't understand :S

valtovar

24-10-2006 21:59:59

ok, i have 0.4rc1 but .... i use vs 7.1 and nxogre it's in vs8 :'( i must build it "a pie" xD

betajaen

24-10-2006 22:16:48

I haven't gotten around to amending the Wiki and the Sourceforge yet.

Converting the VS8 project is quite easy, it's just changing the version in the project files, but I recommend you just get VS8 - basically because Visual Studio 2005 express is free and downloadable from Microsoft's website.

valtovar

24-10-2006 22:50:50

HI
i have errors with examples in nxogre 0.4
the lib compiled fine and examples but when i run, i see my screen black (all), nothing more :S my log it's fine (load meshes and materials fine)
any idea?

betajaen

25-10-2006 10:08:42

http://www.ogre3d.org/phpBB2addons/viewtopic.php?p=14791#14791

The "fix" only works with the mouse picker enabled tutorials, 102,103,etc.

valtovar

25-10-2006 16:49:10

but the 101 don't work xD

betajaen

25-10-2006 16:50:19

I know, I just told you above. Only the mouse picker tutorials and 101 isn't one of them.

valtovar

25-10-2006 17:14:33

Ok, i'm working with nxogre 0.4rc1 and i have the following error:

10:50:50.000000 Starting up NxOgre using versions:
- PhysX SDK 2.4.4
- NxOgre NxOgre 0.4.RC1(Compatible: yes)
- Hardware None installed or none found.
10:50:50.000000 Started.
10:50:50.000000 Creating scene 'Main'.
10:50:50.000000

** Warning **
Actor::loadFromDescInternal: Can't compute mass from shapes: must have at least one non-trigger shape!

E:\p4\release\PhysX_2.4.4\novodex\SDKs\Physics\src\Actor.cpp:370 : PhysXSDK(RE)

10:50:50.000000

** Warning **
Actor Initialisation failed: returned NULL.

E:\p4\release\PhysX_2.4.4\novodex\SDKs\Physics\src\NpScene.cpp:583 : PhysXSDK(RE)

10:50:50.000000

** Warning **
Creation of actor in body 'columan cubiculo' failed!

columan cubiculo : body


I have all meshes fine and i test them in nxogre 0.5p3 and them work fine but in 0.4rc1 not work, any idea?

My meshes are exported from ofusion (3dmax)

ok, i put this mesh in tutorial102 and this work fine, so ... what is the problem? ideas?

betajaen

25-10-2006 18:11:22

Show us the source.

valtovar

25-10-2006 20:08:23

ok
i have the following code in "102"


...........
for ( int i = 0; i < 5; i++ )
{
Vector3 pos ( 10 * i, 0.5, 5*i );
LogManager::getSingleton ().logMessage ( "mySphere" + StringConverter::toString(i) );
mySphere = mScene->createBody(
"mySphere" + StringConverter::toString(i), // Name
"sphere.50cm.mesh", // sphere.50cm.mesh Mesh name to use
//"columan cubiculo.mesh",
new sphereShape(0.5f), // Sphere Shape with a 0.5 metre radius
10.0f, // Density
pos // Where to put it
);
}


when i do the loop to 4, it work fine, but when i try to 5 it break. my logs it's fine

nxogre log:

14:01:26.000000 Starting up NxOgre using versions:
- PhysX SDK 2.4.4
- NxOgre NxOgre 0.4.RC1(Compatible: yes)
- Hardware None installed or none found.
14:01:26.000000 Started.
14:01:26.000000 Creating scene 'Main'.


ogre log:

14:01:26: Win32Input8: DirectInput OK.
14:01:26: Texture: arrow.png: Loading 1 faces(PF_A8B8G8R8,32x32x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,32x32x1.
14:01:26: WARNING: Mesh instance 'NxOgre.ErrorCube' was defined as manually loaded, but no manual loader was provided. This Resource will be lost if it has to be reloaded.
14:01:26: mySphere0
14:01:26: Mesh: Loading sphere.50cm.mesh.
14:01:26: mySphere1
14:01:26: mySphere2
14:01:26: mySphere3
14:01:26: mySphere4
14:01:26: Mesh: Loading cube.1m.mesh.


any idea? i have 1.5G RAM and 256 Graphics memory (ati).
this problem is in nx0.4rc1, in 0.5p3 work fine with 5 and 6, ....

thanks xD

betajaen

25-10-2006 20:43:11

Alright the code seems fine, the only eyebrow raiser is your overwriting the same mySphere in each iteration of that loop, remove it and see what happens.

i.e
mScene->createBody(....);

[Edit]

Also looking at your Ogre log, it seems to be crashing after that loop, when the next body generated loads the cube.1m.mesh

valtovar

25-10-2006 22:15:56

my ogre log with 4 iterations:

16:11:19: Win32Input8: DirectInput OK.
16:11:19: Texture: arrow.png: Loading 1 faces(PF_A8B8G8R8,32x32x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,32x32x1.
16:11:19: WARNING: Mesh instance 'NxOgre.ErrorCube' was defined as manually loaded, but no manual loader was provided. This Resource will be lost if it has to be reloaded.
16:11:20: mySphere0
16:11:20: Mesh: Loading sphere.50cm.mesh.
16:11:20: mySphere1
16:11:20: mySphere2
16:11:20: mySphere3
16:11:20: Mesh: Loading cube.1m.mesh.
16:11:20: Mesh: Loading nx.bodyguide.mesh.
16:11:20: Texture: bodyguide1m.png: Loading 1 faces(PF_A8B8G8R8,256x256x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,256x256x1.
16:11:20: Texture: spot_shadow_fade.png: Loading 1 faces(PF_B8G8R8,128x128x1) with hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.


i put:

...........
mScene->createBody(
"mySphere" + StringConverter::toString(i), // Name
"sphere.50cm.mesh", // sphere.50cm.mesh Mesh name to use
//"columan cubiculo.mesh",
new sphereShape(0.5f), // Sphere Shape with a 0.5 metre radius
10.0f, // Density
pos // Where to put it
);
................


and i have the same result, don't work :S :'( any idea? you test 102 with a loop? 0 -> 10 for example?

i try:

body * some = mScene -> createBody ( ... );


and i have the same error :S

betajaen

25-10-2006 22:46:27

Well it's not crashing at that point then. If you look in the Ogre log, the sphere mesh is loaded, after a cube.1m.mesh is created.

Post the whole void start() code.

valtovar

25-10-2006 22:57:36

my start method:

void start() {

// 1. Start up NxOgre and pass on Ogre Root and the SceneManager as arguments.
mWorld = new world(mRoot);


// 2. Create our scene, this is where the physics is simulated into.
// We can have more than one scene, but physics objects of one scene
// cannot interact with another scene.
mScene = mWorld->createScene("Main",mSceneMgr);



// 3. Better add some gravity.
mScene->hasGravity();


// 4. Let's add a floor.
// Floors have an infinite size so we don't have to worry about anything
// falling off!
mScene->hasFloor();



// 5. Create a simple sphere using the sphere shape.

for ( int i = 0; i < 5; i++ )
{
Vector3 pos ( 10 * i, 0.5, 5*i );
LogManager::getSingleton ().logMessage ( "mySphere" + StringConverter::toString(i) );
// i try with all them
// mySphere = mScene->createBody (
// mScene -> createBody (
body * algo = mScene->createBody(
"mySphere" + StringConverter::toString(i), // Name
"sphere.50cm.mesh", // sphere.50cm.mesh Mesh name to use
//"columan cubiculo.mesh",
new sphereShape(0.5f), // Sphere Shape with a 0.5 metre radius
10.0f, // Density
pos // Where to put it
);
}



// 6. Create another cube.
myCube = mScene->createBody(
"myCube", // Name of the body
"cube.1m.mesh", // Mesh to use
new cubeShape(1), // Collision model
1.0f, // Density
pose( // Pose it:-
Vector3(-3,0.5,3), // Put it at -3, 0.5, 3
Quaternion(Radian(Degree(45)),Vector3::UNIT_Y) // Rotate it 45 degrees on the Y axis
)
);

// That's it!

////////////////////////////////////////////////////////////////////////////////////
pickerSetup(mSceneMgr, mCamera, mScene, mWindow->getWidth(), mWindow->getHeight());

}

betajaen

25-10-2006 23:06:24

Hmm, I have a feeling it may have to do with the picker.

Put targetBody = 0, just before that pickerSetup line.

valtovar

25-10-2006 23:14:09

Nothing.

ogre log:

17:10:23: Win32Input8: DirectInput OK.
17:10:23: Texture: arrow.png: Loading 1 faces(PF_A8B8G8R8,32x32x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,32x32x1.
17:10:23: WARNING: Mesh instance 'NxOgre.ErrorCube' was defined as manually loaded, but no manual loader was provided. This Resource will be lost if it has to be reloaded.
17:10:23: mySphere0
17:10:23: Mesh: Loading sphere.50cm.mesh.
17:10:23: mySphere1
17:10:23: mySphere2
17:10:23: mySphere3
17:10:23: mySphere4
17:10:23: Mesh: Loading cube.1m.mesh.


code:

.....
targetBody = 0;
pickerSetup(mSceneMgr, mCamera, mScene, mWindow->getWidth(), mWindow->getHeight());
.....


mmmm any idea? jejejeje weird xD

betajaen

25-10-2006 23:23:24

Okay, what exactly happens? Does it crash?, does it make your computer bleed, is there just a blank screen with a mouse pointer?

valtovar

26-10-2006 17:43:43

ok, my program crash in the begin, not blank screen, not mouse pointer, no nothing, just crash :S in the begin, i think that is a null pointer but i view all source and not :S

can you test my source? in your 102 example and tell me if all work fine
(the start method)

betajaen

26-10-2006 18:51:42



Works fine.

valtovar

27-10-2006 22:07:25

can you post the start method in this forum? please.

and load dll and lib of you nxOgre?
i compile nxOgre today and nothing. i'll be crazy

valtovar

27-10-2006 22:29:57

ok, i try the same with cube.1m.mesh and it work fine, but with the sphere just load 4 entities (with cube i put 100 entities and work fine). any idea? with my mesh i have the same result that with the sphere :S just 4. Any idea? the mesh load fine (4 entities) .... so i don't think the mesh is corrupte. thanks

betajaen

27-10-2006 22:36:51

The start function is exactly what you give me, it must be the sphere mesh then, try replace it with the cube and see what happens.

valtovar

27-10-2006 22:40:31

with the cube work fine (i put in my preview post) with 100 entities, but ..... ok, i have a question:
why the sphere work fine with 4 entities? it load fine. any idea? and when i use the nxogre 0.5p3 it work fine with the sphere, why? ideas?

betajaen

27-10-2006 23:09:15

I don't know why. It's probably the mesh itself, corrupt or perhaps something wrong is with Ogre.

valtovar

27-10-2006 23:31:18

ok, but .. i use the sphere.mesh that you use in the examples and you can use fine, so, why to me not?

betajaen

27-10-2006 23:35:42

Like I said it might be corrupt for you. Try re-downloading NxOgre.

valtovar

27-10-2006 23:36:53

you can download this mesh:
www.tribungo.com/columnacubiculo.mesh
and try? can put a screen shots? please (6 entities pleas)
thanks

betajaen

27-10-2006 23:52:29



Your mesh works with the code you posted on the previous page, in a sphere shape. To prove it the image above has 50 of them and it works as a meshShape as well.

There is nothing wrong with the mesh or the code.


Please post your full specs of Ogre, NxOgre and PhysX.

valtovar

28-10-2006 00:05:03

ok
Ogre 1.2.2
nxOgre 0.4 rc1
physx 2.4.4

Visual Studio 7.1

i have ati radeon 9550 (agp 8x) 256M
2.8H AMD athon xp (32bits)
1.5G RAM

ideas?

EDIT:
i use the same mesh that you .... so, not is that, idea?

valtovar

30-10-2006 19:27:35

ok, i put more debug msg in nxogre in scene->create body and bodoy constructor and i have the following nxogre error log:


14:19:55.000000 Starting up NxOgre using versions:
- PhysX SDK 2.4.4
- NxOgre NxOgre 0.4.RC1(Compatible: yes)
- Hardware None installed or none found.
14:19:55.000000 Started.
14:19:55.000000 Creating scene 'Main'.
14:19:55.000000 body Start
14:19:55.000000 addShape start
14:19:55.000000 addShape end
14:19:55.000000 CreateBody calling -- start
14:19:55.000000 body Start
14:19:55.000000 addShape start
14:19:55.000000 addShape end
14:19:55.000000 CreateBody called -- end
14:19:55.000000 CreateBody calling -- start
14:19:55.000000 body Start
14:19:55.000000 addShape start
14:19:55.000000 addShape end
14:19:55.000000 CreateBody called -- end
14:19:55.000000 CreateBody calling -- start
14:19:55.000000 body Start
14:19:55.000000 addShape start
14:19:55.000000 addShape end
14:19:55.000000 CreateBody called -- end
14:19:55.000000 CreateBody calling -- start
14:19:55.000000 body Start
14:19:55.000000 addShape start
14:19:55.000000 addShape end
14:19:55.000000 CreateBody called -- end
14:19:55.000000 CreateBody calling -- start
14:19:55.000000 body Start
14:19:55.000000 addShape start
14:19:55.000000 addShape end
14:19:55.000000

** Warning **
Supplied NxActorDesc is not valid. createActor returns NULL.

E:\p4\release\PhysX_2.4.4\novodex\SDKs\Physics\src\NpScene.cpp:561 : PhysXSDK(RE)

14:19:55.000000

** Warning **
Creation of actor in body 'mySphere4' failed!

mySphere4 : body

14:19:55.000000 CreateBody called -- end


ok, in createBody i have (scene.cpp):
error::getSingleton().Note ( "CreateBody calling -- start" );
// code
error::getSingleton().Note ( "CreateBody called -- end" );

and body constructor (body.cpp) i have:
error::getSingleton().Note ( "body Start" );
// code
error::getSingleton().Note ( "addShape start" );
_addShape ( ... );
error::getSingleton().Note ( "addShape end" );


any ideas with that? where are the error?

betajaen

30-10-2006 19:38:50

Must be RC1 then. RC2 is released, try it with that.

valtovar

30-10-2006 19:47:18

ok, i'll try

valtovar

30-10-2006 20:09:58

ok, with 0.4rc2 i have the following error:


15:06:08.000000 Starting up NxOgre using versions:
-> PhysX SDK 2.4.4
-> Hardware None installed or none found.
-> NxOgre NxOgre 0.4.RC2 (Compatible: yes)
-> Ogre 1.2.2 'Dagon'
15:06:08.000000 Started.
15:06:08.000000 Creating scene 'Main'.
15:06:08.000000

** Warning **
Supplied NxActorDesc is not valid. createActor returns NULL.

E:\p4\release\PhysX_2.4.4\novodex\SDKs\Physics\src\NpScene.cpp:561 : PhysXSDK(RE)

15:06:08.000000

** Warning **
Creation of actor in body 'mySpherearcos13' failed!

mySpherearcos13 : body


ideas?

betajaen

30-10-2006 20:25:58

I read somewhere you use Visual Studio 7.1?

valtovar

30-10-2006 20:31:28

yes, why any problem? i put the include dir and lib dir and inputs fine and the project compile fine.
any problem?

betajaen

30-10-2006 20:34:30

It might be, thats the only difference between my setup and yours.

valtovar

30-10-2006 20:52:08

ok, i'm installing vs 2005 express, is it fine?

betajaen

30-10-2006 20:54:04

ok, i'm installing vs 2005 express, is it fine?

Yep go for it. Remember to set everything up as per on the Ogre Wiki.

Romep

10-02-2008 12:33:28

ok, with 0.4rc2 i have the following error:


15:06:08.000000 Starting up NxOgre using versions:
-> PhysX SDK 2.4.4
-> Hardware None installed or none found.
-> NxOgre NxOgre 0.4.RC2 (Compatible: yes)
-> Ogre 1.2.2 'Dagon'
15:06:08.000000 Started.
15:06:08.000000 Creating scene 'Main'.
15:06:08.000000

** Warning **
Supplied NxActorDesc is not valid. createActor returns NULL.

E:\p4\release\PhysX_2.4.4\novodex\SDKs\Physics\src\NpScene.cpp:561 : PhysXSDK(RE)

15:06:08.000000

** Warning **
Creation of actor in body 'mySpherearcos13' failed!

mySpherearcos13 : body


ideas?



I'm using VC8 and have the same error. how did u solve it?

betajaen

10-02-2008 12:43:56

Can you not bump threads that are two years old and can you not use NxOgre 0.4. It's utter trash; use NxOgre 0.9