Jump to content
  • Advertisement
Sign in to follow this  
Caesar

3ds loader

This topic is 5029 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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:


2

1 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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!