Archived

This topic is now archived and is closed to further replies.

3ds files using 3dsftk

This topic is 6279 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 found few days ago a link on 3dsftk in a previous thread, and decided to use it instead of the code found on flipcode. It works fine, even if the samples are a bit too simples, I mean the don''t show the use of most important functions. And the doc files are totally messed My problem is that I didn''t find how and where to load normals from the 3ds file. My Web Page

Share this post


Link to post
Share on other sites
The format does not store the normal data explicitly. It stores the order of the points of a triangle and you can the calculate the crossproduct yourself. Saves space. I don't remember exactly where it is but it is stored in a short. If you can't see it in the 3dsfkt the docs on wotsit have what to do.

I wanrned you! Didn't I warn you?! That colored chalk was forged by Lucifer himself!

Fixed the url, my bad.

Edited by - GKW on October 3, 2000 12:03:17 PM

Share this post


Link to post
Share on other sites
Ok, so I have to calculate them myself. That''s what I do for the moment, but the problem by this way is that I can''t be sure that the normals are all well oriented. So I''ve calculated the gravity center of the object and oriented the normals in the opposite direction, but if that should work with almost all triangles, when the object is not convex, that won''t work properly ...


My Web Page

Share this post


Link to post
Share on other sites
The vertex should be stored in the correct order in the short at the end of the face list chunk( 0x4120 ). I read of one guy who supposedly was doing everything right and had some of the normals flipped but I have not run into that, though my experience is limited. I looked into doing the barycentric(sp) thing but man that was way too complex for what I was interested in. If you can split up your model up into a bunch of convex hulls then you shouuld be good to go. If they are not stored correctly the you will have to put in some real time with finding a way to orient them the right way. It is not trivial to orient the normals of an arbitrary mesh. Good luck.

I wanrned you! Didn't I warn you?! That colored chalk was forged by Lucifer himself!

Share this post


Link to post
Share on other sites
You''re right, there''s no way to do it in a simple way. But as it was quite important to me to have correct normals, I''ve done some more complex calculation. What I''ve done is the following :

+ I initialize each vertex normal to (0,0,0)
+ I add the normal of each face to the normal of each point
of that face
+ I count the number of face to which each vertex belong to
+ Then I divide the normal of each vertex by that number

In fact, I just calculate the mean normal for each vertex, I think that that''s called gouraud shading

If you want you can check it out on




My Web Page

Share this post


Link to post
Share on other sites