Mesh usage in convexShape [Solved]

dinvog

20-03-2007 17:12:49

Hey
I am using Ogre Eihort 1.4 (SDK) with PhysX_6.12.02_SystemSoftware, PhysX_2.6.2_SDK_Core and NxOgre.0.4.RC3 . I have gone through all the tutorials (well most of them), everything worked beautifully with a little bit of help from the other threads :D.

But now I am struggling with the convexShape procedure. I have read through the following thread http://www.ogre3d.org/phpBB2addons/view ... onvexshape

I somewhat understood a little bit about how the vertex data is retrieved from the mesh files and then used.

What I do not understand is what is the format of mesh files? I have created mesh files in 3dsmax and exported them using LEXI exporter. They work in eihort but do not work in convexShape to make the collision model. It compiles but when I run in release mode after the loading screen it crashes.


...
22:26:33: *** Initializing OIS ***
22:26:33: Texture: bgui.exit.png: Loading 1 faces(PF_A8R8G8B8,22x22x1) with 4 generated mipmaps from Image. Internal format is PF_A8R8G8B8,22x22x1.
22:26:33: Texture: pause.png: Loading 1 faces(PF_A8R8G8B8,22x22x1) with 4 generated mipmaps from Image. Internal format is PF_A8R8G8B8,22x22x1.
22:26:33: Texture: debug.png: Loading 1 faces(PF_A8R8G8B8,22x22x1) with 4 generated mipmaps from Image. Internal format is PF_A8R8G8B8,22x22x1.
22:26:33: Texture: bgui.pointer.png: Loading 1 faces(PF_A8R8G8B8,24x24x1) with 4 generated mipmaps from Image. Internal format is PF_A8R8G8B8,24x24x1.
22:26:33: Texture: gui_pause.png: Loading 1 faces(PF_A8R8G8B8,128x128x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,128x128x1.
22:26:33: Font nxogrefontusing texture size 512x256
22:26:33: Info: Freetype returned null for character 160 in font nxogrefont
22:26:33: Texture: nxogrefontTexture: Loading 1 faces(PF_BYTE_LA,512x256x1) with 0 generated mipmaps from Image. Internal format is PF_BYTE_LA,512x256x1.
22:26:33: Mesh: Loading nx.bodyguide.mesh.
22:26:33: WARNING: nx.bodyguide.mesh is an older format ([MeshSerializer_v1.30]); you should upgrade it as soon as possible using the OgreMeshUpgrade tool.
22:26:33: Texture: bodyguide1m.png: Loading 1 faces(PF_A8R8G8B8,256x256x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,256x256x1.
22:26:33: Registering ResourceManager for type NxSCM
22:26:33: Mesh: Loading Capsule01.mesh.
22:26:33: WARNING: Capsule01.mesh is an older format ([MeshSerializer_v1.30]); you should upgrade it as soon as possible using the OgreMeshUpgrade tool.


If I use the mesh in tutorial it executes fine. also I tried the mesh upgrade but that did not change anything, still gives me the warning.

The mesh itself is just a capsule that tapers a bit on one side.
I am also trying to create a tunnel like a hollow cylinder, but that i guess that is not a convex figure. But first I need to figure out what type of mesh files can the convexShape procedure use

Thanks

betajaen

20-03-2007 17:20:29

The convex shape converts an Ogre mesh into the internal format for the NxConvexShape for you.

Ideally it should be convex like, vertex count below 255 and duplicate vertices.

If you like, post the mesh on here, and I'll have a look at it for you.

dinvog

20-03-2007 17:36:18

Damn that was fast. Yeah here is the xml converted mesh file


<mesh>
<sharedgeometry vertexcount="172">
<vertexbuffer positions="true">
<vertex>
<position x="2.81005e-010" y="9.0182" z="3.75922e-012" />
</vertex>
<vertex>

betajaen

20-03-2007 17:45:56

I snipped it a little. I did read it though. There is quite a bit of vertices there. Any chance of a picture of what it looks like?

But I would try something simpler first (less than 60 vertices), to see if there is anything wrong with the creation and conversion process than the mesh itself.

dinvog

20-03-2007 18:07:35

I don't have 3dsmax at home so I can show the image. I only have the mesh files right now. I did try another capsule though with lesser vertices

I also upgraded the mesh using the command line tools


<mesh>
<sharedgeometry vertexcount="52">
<vertexbuffer positions="true" normals="true" texture_coord_dimensions_0="2" texture_coords="1">
<vertex>
<position x="0" y="1.79357" z="-0" />
<normal x="-1.9033e-009" y="1" z="2.29831e-010" />
<texcoord u="0.5" v="0.5" />
</vertex>
<vertex>
<position x="0.183795" y="1.74432" z="-0" />
<normal x="0.558541" y="0.829477" z="-3.96443e-008" />
<texcoord u="0.75" v="0.5" />
</vertex>
<vertex>
<position x="0.0918974" y="1.74432" z="-0.159171" />
<normal x="0.279271" y="0.829477" z="-0.483711" />
<texcoord u="0.625" v="0.283494" />
</vertex>
<vertex>
<position x="-0.0918975" y="1.74432" z="-0.159171" />
<normal x="-0.279271" y="0.829477" z="-0.483711" />
<texcoord u="0.375" v="0.283494" />
</vertex>
<vertex>
<position x="-0.183795" y="1.74432" z="1.60679e-008" />
<normal x="-0.558541" y="0.829477" z="3.63118e-008" />
<texcoord u="0.25" v="0.5" />
</vertex>
...


Oh yeah just in case ; the code in the source file


body *Car;
Car = mScene->createBody("MyCar","Capsule01.mesh",new convexShape("Capsule01.mesh"),10);

betajaen

20-03-2007 18:09:48

Good! Did the convex capsule work?

dinvog

20-03-2007 18:13:06

No it did not work. Same error it crashes soon after loading screen and the log file is same as before.

betajaen

20-03-2007 18:21:12

Weird.

Fancy posting the full mesh file on some download website (not on the forums)?

So I can try it out.

dinvog

20-03-2007 18:36:48

I do not really have any webspace but will try to put up something tomorrow in college. Also I had a query about the tunnel , or a hollow cylinder which is going to be static, any better /easier implementation. This also is already made in max but yeah has too many vertices.

betajaen

20-03-2007 18:47:27

For a tunnel you can use several convex shapes to make up each section. However if you don't intend to move it - just use a meshShape.

dinvog

21-03-2007 09:09:39

hi i uploaded the files onto geocities, however since it seemed to have some kind of problem with the .mesh extension and .material extension, i compressed the files into one zip file.

http://www.geocities.com/rohit_nandalal007/LEXIExports.zip

dinvog

21-03-2007 10:58:09

It worked :D !
I changed the exporter from LEXIexporter to Octopus exporter. It worked on all the mesh files without any trouble. Also I noticed some difference between the format of the exported mesh

LEXIexp:

<mesh>
<sharedgeometry vertexcount="32">
<vertexbuffer positions="true">
<vertex>
<position x="-0.0660138" y="2.6494e-18" z="0.284146" />
</vertex>
<vertex>
<position x="-0.0660138" y="-0.132028" z="0.18082" />
</vertex>
...
...
<submeshes>
<submesh material="Line013_material" usesharedvertices="true" use32bitindexes="false" operationtype="triangle_list">
<faces count="32">
<face v1="0" v2="1" v3="2" />
<face v1="29" v2="8" v3="10" />
<face v1="31" v2="14" v3="30" />
<face v1="31" v2="12" v3="14" />
</faces>
</submesh>
</submeshes>
</mesh>


Octupus exporter




mesh>
<submeshes>
<submesh material = "car" usesharedvertices="false" use32bitindexes="false">
<faces count="1672">
<face v1="1" v2="2" v3="3" />
<face v1="4" v2="3" v3="5" />
<face v1="6" v2="5" v3="7" />
....
...
</vertex>
<vertex>
<position x="0.000891599" y="-3.16322" z="-11.2482" />
<normal x="-0.0823618" y="-0.813894" z="0.575146" />
<texcoord u="1.0" v="0.0625" />
</vertex>
</vertexbuffer>
</geometry>
</submesh>
</submeshes>
</mesh>


I noticed that the octupus exporter has the face entries before the vertex entires and so I guess so it worked

Have not tried it at home and will confirm my inference after trying it out there

betajaen

21-03-2007 11:28:38

Fantastic! I didn't get around to trying your mesh yet though, but from those two files you put there it seems to be more than just the order of faces and vertices. The faces are in a different order, and the vertices are different too?

Unless they aren't the same car mesh.

dinvog

21-03-2007 20:38:45

Tried it at home as well works like a charm. Yes the xml above is of 2 different meshes but I did try same mesh (the ones I have posted on link) through different exporters and Octopus gave me correct results.

Tried meshShape did not give me any trouble either (atleast not so far :wink: )

is01sjjj

12-04-2007 09:16:34

note LEXIexp and Octupus have different XML structure
LEXI use shared vertex but Octupus not
maybe this can help you find something