3ds loader

Started by
3 comments, last by Ilici 19 years, 4 months ago
Hi, I'm working on a quite simple 3ds loader and have two questions for those of you who might have already had the pleasure 1) is it just me or are the triangles stored clock-wise? (I haven't done much 3d programming, but afaik faces are usually stored counter-clock-wise... Just want to know if I have a bug (I could also flip the normals I compute as a workaround) or if it's really so (I've also had a ASCII export generated and it also IMHO has the faces (the face's vertices) stored CW) 2) will the vertex list always be before the face list? (in other words, has anyone of you experienced that? I have not yet) thanks for your help PS: I haven't found this info anywhere, I've been looking for it, but all the documents I've read just say there's a xyz triplet and that there are those chunks present, but not the order is to be relied upon.
Advertisement
Quote:Original post by Caesar
1) is it just me or are the triangles stored clock-wise? (I haven't done much 3d programming, but afaik faces are usually stored counter-clock-wise... Just want to know if I have a bug (I could also flip the normals I compute as a workaround) or if it's really so (I've also had a ASCII export generated and it also IMHO has the faces (the face's vertices) stored CW)

IIRC, you are correct - the faces are stored CW. This makes sense, because 3ds Max stores its verts in CW order, too.
Dustin Franklin ( circlesoft :: KBase :: Mystic GD :: ApolloNL )
I did a quick check for you with my own loader, and the faces in the 3ds file I tested are stored CCW. However, the vertices themselves were stored CW. So:

21   0


with facelist: 1 0 2

Good luck with the loader. If you have any problems let me know. I'm going to be writing a small tutorial on this within the next few months, so I'll be doing this stuff anyway.

Edit: something is screwing up my ASCII art.
ah, I see. Thank you both guys, you were very helpful. Took some time to figure out how you mean it, but cool, now I get it:)

PS: if I find a mail in your profile rick, I'll mail you, ok?
While you could invert the normal, you could just switch the first and third index in a face. You are reading them one by one anyway (assuming you're ignoring the face flags) so you could read indices[2] indices[1] indices[0] in this order for each face. Since all of them are CW then flipping them as such will make them CCW.

This topic is closed to new replies.

Advertisement