Model with 8 vertices == 36 vertices in irrlicht ????

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
vgx
Posts: 11
Joined: Sun May 07, 2006 4:36 pm

Model with 8 vertices == 36 vertices in irrlicht ????

Post by vgx »

The only meshbuffer of that model returns through getVertexCount() 36 vertices - I can imagine number like 24, but 36 ??? I would really appreciate some information what is going on ...
Baal Cadar
Posts: 377
Joined: Fri Oct 28, 2005 10:28 am
Contact:

Re: Model with 8 vertices == 36 vertices in irrlicht ????

Post by Baal Cadar »

vgx wrote:I would really appreciate some information...
Same here. How about more information? What kind of model (like shape) ? What file format? What tool used to create it? What methods used to create it? All that.

Vertex duplication is necessary in some cases to retain per face settings in the modelling tool (e.g. face normal) in a real-time engine. Sometimes exporters are buggy too or faults during modelling can also cause unnecessary vertices.

This is idle speculation, as long as we don't know more.
vgx
Posts: 11
Joined: Sun May 07, 2006 4:36 pm

Post by vgx »

This is that model:

Code: Select all

# Blender v241 OBJ File: k3.blend
# www.blender3d.org
mtllib k3.mtl
o Cube_Cube
v -1.510578 1.544067 1.478683
v -1.510578 1.544067 -1.542473
v -1.510578 -1.477089 -1.542473
v -1.510578 -1.477088 1.478683
v 1.510578 1.544068 1.478682
v 1.510578 1.544067 -1.542475
v 1.510578 -1.477089 -1.542473
v 1.510578 -1.477089 1.478683
vt 0.990000 0.010000 0.0
vt 0.990000 0.989999 0.0
vt 0.010000 0.010000 0.0
vt 0.010000 0.990000 0.0
vt 0.010000 0.010000 0.0
vt 0.990000 0.010000 0.0
vt 0.990000 0.990000 0.0
vt 0.010000 0.990000 0.0
vt 0.990000 0.990000 0.0
vt 0.010000 0.010000 0.0
vt 0.010000 0.990000 0.0
vt 0.990000 0.010000 0.0
vt 0.990000 0.990000 0.0
vt 0.010000 0.010000 0.0
vt 0.990000 0.990000 0.0
vt 0.010000 0.990000 0.0
vt 0.010000 0.010001 0.0
vt 0.989999 0.010000 0.0
vt 0.990000 0.010000 0.0
vn 0.000000 0.000000 1.000000
vn 0.000000 0.000000 1.000000
vn -0.000000 -1.000000 0.000000
vn -0.000000 -1.000000 0.000000
vn -0.000000 0.000000 -1.000000
vn 0.000000 -0.000000 -1.000000
vn -0.000000 1.000000 -0.000000
vn 0.000000 1.000000 -0.000001
vn 1.000000 -0.000000 0.000000
vn 1.000000 -0.000000 0.000000
vn -1.000000 0.000000 -0.000000
vn -1.000000 0.000000 -0.000000
g Cube_Cube_None_txr5.jpg
usemtl None_txr5.jpg
s off
f 5/1/1 1/2/1 8/3/1
f 1/2/2 4/4/2 8/3/2
f 3/5/3 7/6/3 8/7/3
f 3/5/4 8/7/4 4/8/4
f 2/1/5 6/9/5 3/10/5
f 6/9/6 7/11/6 3/10/6
f 1/12/7 5/13/7 2/14/7
f 5/13/8 6/8/8 2/14/8
f 5/15/9 8/16/9 7/17/9
f 5/15/10 7/17/10 6/18/10
f 1/13/11 2/11/11 4/19/11
f 2/11/12 3/3/12 4/19/12
As can be seen, it was created in blender3D and format is wavefront obj, contains 8 vertices, 19 uv coords, 12 normals and 12 triangle faces ... and it is simple evidently bit nonuniformly texture mapped cube ...
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

looks like a buggy exporter. running through wings3d takes out the duplicated normals and tcoords and fixes the minus zeros too.
edit: oh yeah, and three twelves are 36, three being verts and twelve being triangles
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
dhenton9000
Posts: 395
Joined: Fri Apr 08, 2005 8:46 pm

Post by dhenton9000 »

its not a bug, its a feature :o

I walked through the irrlicht obj importer and its how it deals with the 8 items listed in the obj file to create SVertices that work with drawindextriangle list, the 8 requires a data construct for a "face" (4 faces with pointers into the vertex array) to avoid duplicates.

No such data structure exists in irrlicht, AFAIK.

I know this from painful experience, I had a algorithm that wanted as few vertices as possible, so the 36 from 8 really got me. BTW its 24 to 8 for .x
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

I'd say it's a bug in the exporter, because redundant vertices are created! Check the values for the 4/19/* vertices of the last two faces. Vertex normals 11 and 12 are the same so there would be no need to create a new vertex for that, but this would need rather heavy preprocessing which should be done by the exporter instead. Otherwise all combinations of the faces definitions have to be compared and only unique vertices are used.
Post Reply