Triangle strip indices order?
by Chris Calef · in Torque 3D Professional · 11/24/2010 (3:00 pm) · 41 replies
Hi, just a random question after bashing my head against the problem for most of the day yesterday... I'm writing an FBX exporter for dts models, and have (mostly) succeeded at exporting the skeleton and animation frames, but when I came to the meshes, in particular triangle strip meshes (I haven't tried all triangles yet) I found that I really have no idea how the indices work.
I thought I did, and my solution starts to look like it should be working, but it isn't:

What I'm doing is starting with the first three indices, making a triangle out of them, and then for each new one, making a triangle out of it plus the last two. I'm going in the same order every time. My problem looks like possibly the winding order is not supposed to be the same every time... but I'm not sure that's it, because on closer examination it also looks like it's trying to make triangles between verts that shouldn't be part of the same triangle at all (i.e. edges going across the middle inside the barrel).
This makes me wonder if there is another list somewhere or more information stored somewhere, that should be telling me how these indices actually are supposed to go together to form triangles?
Of course, now that I've publicly admitted confusion on the matter, I'll probably solve the problem in the next ten minutes, but in case that doesn't happen I'd be wildly grateful if anyone here could help me figure this out.
Cheers!
Chris
I thought I did, and my solution starts to look like it should be working, but it isn't:

What I'm doing is starting with the first three indices, making a triangle out of them, and then for each new one, making a triangle out of it plus the last two. I'm going in the same order every time. My problem looks like possibly the winding order is not supposed to be the same every time... but I'm not sure that's it, because on closer examination it also looks like it's trying to make triangles between verts that shouldn't be part of the same triangle at all (i.e. edges going across the middle inside the barrel).
This makes me wonder if there is another list somewhere or more information stored somewhere, that should be telling me how these indices actually are supposed to go together to form triangles?
Of course, now that I've publicly admitted confusion on the matter, I'll probably solve the problem in the next ten minutes, but in case that doesn't happen I'd be wildly grateful if anyone here could help me figure this out.
Cheers!
Chris
About the author
#22
I think I'll move on to deal with the bone weights before I come back and deal with the secondary UVs, but now I know where to start. Please forgive my (more or less complete) ignorance on the subject, but: would this be the sole use of the secondary UVs in Torque? And, would this usage apply equally on export from Torque into other engines?
I think I can just add a second layer of UVs in my fbx model and store the tvert2 data there, but I'm curious as to whether other engines and modeling apps will automatically look for them there and know what to do with them?
Speaking of which, if anyone reading this thread is a regular Max or Maya user and wouldn't mind testing some of my output, please shoot me an email or mention it here, that would be a huge help.
11/27/2010 (3:32 pm)
Thanks Ivan! I think I'll move on to deal with the bone weights before I come back and deal with the secondary UVs, but now I know where to start. Please forgive my (more or less complete) ignorance on the subject, but: would this be the sole use of the secondary UVs in Torque? And, would this usage apply equally on export from Torque into other engines?
I think I can just add a second layer of UVs in my fbx model and store the tvert2 data there, but I'm curious as to whether other engines and modeling apps will automatically look for them there and know what to do with them?
Speaking of which, if anyone reading this thread is a regular Max or Maya user and wouldn't mind testing some of my output, please shoot me an email or mention it here, that would be a huge help.
#23
11/27/2010 (4:36 pm)
Adrian's realization of the second UV channel is not very different campared to the T3D code. I mean the common stuff (tverts,tverts2,hasTexcoord2,..) in tsMesh and tsShape is almost the same.
#24

Next steps: first, hook this mesh up with bone weighting so we can animate it... then, deal with multiple-mesh models in such a way that each mesh object remains its own object in the FBX file and uses its proper texture... then, come back and throw in the additional UV layer.
11/28/2010 (10:35 pm)
Well, just to keep anyone who cares up to date on my progress... had some family time going on this weekend so I haven't been on it full time, but I have progressed as far as handling a TSSkinMesh in addition to the simple TSMesh objects:
Next steps: first, hook this mesh up with bone weighting so we can animate it... then, deal with multiple-mesh models in such a way that each mesh object remains its own object in the FBX file and uses its proper texture... then, come back and throw in the additional UV layer.
#26
11/29/2010 (9:48 pm)
:) You could sell that as a T-1000 damage animation.
#27
11/29/2010 (9:50 pm)
Hmm, you might be on to something...
#28
lol @ T-1000 damage animation :D
Is it bad that I recognize that map...
11/29/2010 (10:14 pm)
Nice work!lol @ T-1000 damage animation :D
Is it bad that I recognize that map...
#29
11/29/2010 (10:51 pm)
it's okay, it's only research...
#30

Believe it or not, this represents significant progress. :-) (At least the vertex weights are coming from the correct bones now... even if not in exactly the proper amounts...)
11/30/2010 (7:41 pm)

Believe it or not, this represents significant progress. :-) (At least the vertex weights are coming from the correct bones now... even if not in exactly the proper amounts...)
#31
11/30/2010 (10:24 pm)
I've seen weighting in two separate 'schemas', Chris[well, seems that way]....in that, some modeling packages use the 'parent' influencer in the index first[even if the lowest value of the weights]....and some use the 'highest' influencer in the index first....food for thought! Not sure the 'right' way it should be recorded.
#32
11/30/2010 (11:24 pm)
aye its progress Chris ! wouldnt want a fight with that guy tbh, thats a pretty nasty claw :o
#33
11/30/2010 (11:26 pm)
Looks like a human hybrid from Camino. :)
#36

However, it finally occurred to me that I hadn't removed degenerate triangles at any point along the way - and then I found a handy RemoveBadPolygons() function in FBX:

So now the problem is the fact that he's still very stretched out:

And still looking downright dangerous at times:
But it seems very clear from that last image that what is happening is some sort of local/global issue, where the vertices appear to be getting weighted by the accumulation of the entire chain of transforms, rather than just their nodes' local transforms.
*gets back to work*
12/02/2010 (5:03 pm)
Well, we're not exactly there yet, but I just solved another major issue at least. I've been seeing a lot of bad edges in all the fbx models I'm producing, not so obvious in the textured views but very clear in wireframe: 
However, it finally occurred to me that I hadn't removed degenerate triangles at any point along the way - and then I found a handy RemoveBadPolygons() function in FBX:

So now the problem is the fact that he's still very stretched out:

And still looking downright dangerous at times:
But it seems very clear from that last image that what is happening is some sort of local/global issue, where the vertices appear to be getting weighted by the accumulation of the entire chain of transforms, rather than just their nodes' local transforms.
*gets back to work*
#38
02/25/2011 (11:06 am)
is there a chance you would share it?
#39
Looking great!! Is this for EM ? :-D
( quick off-topic if I may ); Also will EM's license allow for exporting to FBX for use in 'any' software package/engine ( or is it solely for GG products) ?
02/28/2011 (5:24 am)
"" Oh, btw, my FBX export is working now ""Looking great!! Is this for EM ? :-D
( quick off-topic if I may ); Also will EM's license allow for exporting to FBX for use in 'any' software package/engine ( or is it solely for GG products) ?
#40
@Deepscratch: This is part of Ecstasy Motion functionality, although there is a possibility we could package just the FBX exporter for sale independently if there's sufficient interest. (I'd love to be able to give it away for free, of course, but we're out here "living the dream...")
02/28/2011 (12:51 pm)
@0:-): (that was fun to write) Yes, this is for EM, and as long as you own your artwork we're not going to care about what you export it to.@Deepscratch: This is part of Ecstasy Motion functionality, although there is a possibility we could package just the FBX exporter for sale independently if there's sufficient interest. (I'd love to be able to give it away for free, of course, but we're out here "living the dream...")
Torque Owner Ivan Mandzhukov
Liman3D
there is a resource about how to implement a secondary UV channel in TGE(and TGEA)and how to use this channel within ShaderGen.
Here are the files:
http://www.futurenation.net/dtsMerger/tiki-list_file_gallery.php?galleryId=4
You can ask Adrian W about his corrections on the dts file (actually he did his own ats format).