Corrupted mesh

GigasoftProductions
Petty Officer Third Class
Posts: 15
Joined: 25 Jul 2010, 19:19

Corrupted mesh

Post by GigasoftProductions »

I'm having problems with a mesh. I have an editable shape node, a mirror modeler node, an SDS filter node and a Skinning node connected in series. The skinning node also has a Vertex Morph node connected to it.

Sometimes, after editing the mesh, Truespace crashes when I try to make any further changes to the mesh. IRfMeshRetargetSet::RetargetDisplacement is called, and it calls a complicated function that makes an IRdGeometryIdentificationTableStream stream, and in the process of doing so it allocates an array and fills it, and it overshoots it by 1 element, so that the heap is corrupted.

Any idea of why this happens, and how I can fix my mesh so that I can continue working on it? Looking at an earlier, working copy of the mesh, and the broken mesh, I can't spot any obvious differences. Each has 2636 normals, 726 UV1 points, 738 UV2 points, 1450 vertices, 2896 triangles, and the morphs have 135 and 76 vertices in the morph stream, and 76 and 41 vertices in the control stream. That's the final mesh after all stages.
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Corrupted mesh

Post by trueBlue »

Wouldn't it be best if you Flattened your object before Skining it? Perhaps you could try Flattening a copy of your object and then Tranfer the Skining Weights over from the original. This is of course if you are using Workspace though. Might be worth a try anyway.
froo
Captain
Posts: 2554
Joined: 22 May 2009, 12:13

Re: Corrupted mesh

Post by froo »

Not sure if this helps but, check this note in the IRdGeometryIdentificationTableStream
interface reference:

:: Please note, that number of items in this stream is defined in dwords.

That may provide a clue. If you are creating a plugin you may need to double check your variables
and 'counts'.
GigasoftProductions
Petty Officer Third Class
Posts: 15
Joined: 25 Jul 2010, 19:19

Re: Corrupted mesh

Post by GigasoftProductions »

No plugins are involved, Truespace was crashing all on its own.

Well, it turned out that all I had was a messed up polygon lacking some edges. Repairing it seems to have fixed the crashes.
froo
Captain
Posts: 2554
Joined: 22 May 2009, 12:13

Re: Corrupted mesh

Post by froo »

Glad you got it solved. Nice!

So I'm curious; how did you determine those functions are being called?
Did you check the crash report? The reason I am asking is because I am
making a plugin; and it'd be very helpful to be able to track these operations,
that trueSpace performs. I need to implement similar operations.

Thanks!

Froo
GigasoftProductions
Petty Officer Third Class
Posts: 15
Joined: 25 Jul 2010, 19:19

Re: Corrupted mesh

Post by GigasoftProductions »

I inspected the call stack window in Visual Studio, subtracted the DLL address from the instruction address, loaded up Space3D.dll in a disassembler, found the call to delete[] that crashed, found the function that was calling this function, and saw that it was listed in a virtual function table. From the first entry, QueryInterface, I found the interface map. This had one entry, and I looked up the IID in _Space3d.h, and it was IID_IRfMeshRetargetSet. Knowing this, the function could be identified as IRfMeshRetargetSet::RetargetDisplacement by its position in the table.

To determine what truespace is doing, your best bet is probably to disassemble it. Search for the IID for an interface which the class you're interested in implements, and find the interface map that references it. The function that references the interface map is the QueryInterface function for the class, and this will be referenced by the function table, which is referenced by the constructor. You can then match the offsets in the interface map with the offsets that the various function table pointers are placed at, and then you know the layout of the function tables, and you can name the functions. Now, you can find the function you're interested in and analyze it.
froo
Captain
Posts: 2554
Joined: 22 May 2009, 12:13

Re: Corrupted mesh

Post by froo »

Cool. Thanks!

Froo

Return to “Bugs and Workarounds”