Is Blitz3d reindexing vertices on loading?

Blitz3D Forums/Blitz3D Programming/Is Blitz3d reindexing vertices on loading?

GrumpyOldMan(Posted 2004) [#1]
Hi

I've been playing around with mesh animation and it looks like Blitz3d is reindexing some vertices of b3d and 3ds models on loading. Am I going crazy or has this always been the case? I had a look at the Bugs Reports and I couldn't see anything there. I've been struggling with mesh animation with there always being some vertices not being attached to the right bones. I checked and rechecked what I was doing, so I decided to run a .b3d model through the excellent b3d to xml to b3d program, and also write a simple program that loaded the same b3d file and write to file the vertexx,vertexy and vertexz of the loaded b3d. The indexed vertex values in the xml file and the indexed values from the loaded file don't match!!

Any help on this would be appreciated.

Cheers

GrumpyOldMan


RGR(Posted 2004) [#2]
;-


morduun(Posted 2004) [#3]
You don't happen to be using the Milkshape exporter, do you? If you are, it's the exporter that's the problem: it exports static objects correctly, but reverses the Z axis when exporting animated meshes, so things are never facing the right way -- and god forbid you try to 'fix' it; you'll only make the problem worse, and you'll get some really evil looking results if you try.

Only solution I've found is to ditch the MS3D .b3d exporter entirely and bring the .ms3d into something like Ultimate Unwrap to export to .b3d instead.


GrumpyOldMan(Posted 2004) [#4]
Hi RaGR and morduun

Thanks for the replies. It's not the exporter because I'm happy with the loaded mesh, I get the data from the already converted mesh. It's just that the information shown on the .xml for the vertex coordinates is different from the vertex coordinates taken from the loaded .b3d.

RaGR - I really hope I'm doing something wrong because my life would be a bit easier if I could use loaded b3d's. What you're doing sounds pretty much like what I'm trying to do. I run the b3d file through a utility that gives me a small file that shows vertex assignments to bones, and then try to match that up with loaded vertices except for me it's not working. I'll go back and go through it again!!

Cheers

GrumpyOldMan


RGR(Posted 2004) [#5]
;-


Ricky Smith(Posted 2004) [#6]
The surface indices of vertices in a single surfaced .b3d mesh will only be the same as the order index in the .b3d file in a single surface model but if there are multiple surfaces i.e. more than 1 TRIS chunk then Blitz sets the index of the first vertex of each surface to 0 incrementing the index no as it builds the mesh. Really the vertex in a .b3d file are not 'indexed' at all just read in the order they are written. Its the TRIS chunk that defines a surface - if there's only one surface then its index values will correspond to the order of the vertex in the file - if there's multiple surfaces then the vertex surface index is set to 0 for each surface created.The total count of the vertex should match unless there are any isolated i.e. not used by any of the tris.
An additional problem with working with vertex in an animated mesh is that there is no way to find the real world coordinates of a vertex when the mesh is animating - VertexX# ( surface,index )will always return the original starting position of the reference frame and not the current 'animated' position. To get around this you can create a pivot at the vertex start position and parent that pivot to the bone. You can then check the pivot to get the position of the vertex. This however will not work correctly if you have weighted vertex - you would then have to move the pivot according to the vertex weighting values which gets a bit more complicated.


GrumpyOldMan(Posted 2004) [#7]
Hi

Morduun - Apologies, I loaded the Milkshape exported .b3d file into JTEdit and resaved and now it works perfectly. For some reason a Milkshape exported .b3d when loaded has reindexed vertex positions to what is contained in the file. Something for anybody looking at mesh animation to be wary of!!!!

Cheers

GrumpyOldMan