#### Archived

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

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

## Recommended Posts

Hi guys, I''m learning to load .3DS files, but I''m having some trouble. I can read all the chunks up to the Face data, which is apparently structured as follows : Chunk ID, Size of the chunk, Number of Faces, Face Data. The text I have on reading files says I should then check to see if there''s a smoothing chunk, and some other chunk as well. In my model, there is a smoothing chunk, which I read as well. However, the end of the smoothing chunk is outside the end of the faces chunk, which means that I''m too far in the file, and everything else I read in is incorrect. Can someone please explain why the faces chunk is larger than it says it is? Also, how can I fix this problem? Thanks We scratch our eternal itch A twentieth century bitch We are grateful for Our Iron Lung

##### Share on other sites
After writing two different 3ds loaders I can say that you are probably reading the file wrong. You are probably going to have to count bytes and find out what part of your code is reading too many bytes. This format was discontinued 5 or 6 years ago and the documentation is crap. I often find undocumented chuncks but smoothing groups have never been a problem for me.

The fanatic is incorruptible: if he kills for an idea, he can just as well get himself killed for one; in either case, tyrant or martyr, he is a monster.
--EM Cioran

Opere Citato

##### Share on other sites
CKW, I dont suppose that you would be willing to give me a basic libarary for loading 3DS files??

I have made a program to load a 3DS file, however, I can only get it to load one mesh from the file. I am quite perplexed.

##### Share on other sites
I can give you the one I wrote for a java program a year of so ago but it is broken in it''s current state. I can''t give the current one away until the group I am programming with decides on a license. If you have problems check with 3ds lib on sourceforge. I have seen many people say it is good. It however has a problem with the models we are using. DOn''t know what the deal was. Other than the occasional undocumented chuck it is a fairly simple format. If you are having problems it is because you are miscounting bytes. I will almost guarentee it. When I had a problem I would go through the binary counting bytes several times and it always came back to my code miscounting bytes. I would often accendentally add in the 6 byte offset more than once.

The fanatic is incorruptible: if he kills for an idea, he can just as well get himself killed for one; in either case, tyrant or martyr, he is a monster.
--EM Cioran

Opere Citato

##### Share on other sites
Yeah, I guess you''re probably right, because when I get back up to the previous chunk, I''m usually six bytes over, so I''ll double check that...

Thanks

$£¥ We scratch our eternal itch A twentieth century bitch We are grateful for Our Iron Lung #### Share this post ##### Link to post ##### Share on other sites Thanks for the help, I''ve got the problem sorted out now... However, there''s a new problem. The model I was loading was just a simple box for debug purposes, but now I''m trying to load a model that has a box, and a sphere, as two separate objects. The first object loads properly, but I''m getting garbage after I read (0x4000) for the second object, and I don''t know what the data means. Any help would be appreciated Thanks$£¥

We scratch our eternal itch
A twentieth century bitch
We are grateful for
Our Iron Lung

##### Share on other sites
What is the id number of the next chunk?

The fanatic is incorruptible: if he kills for an idea, he can just as well get himself killed for one; in either case, tyrant or martyr, he is a monster.
--EM Cioran

Opere Citato

##### Share on other sites
At the moment I'm making a pass through the file first, to see the total number of faces and vertices that I'll need for the model. When I get to the first object's texture map chunk (0x4140 I think), I read in the current file position, and the size of the chunk, the same as I would do for any other chunk, but this is where the error seems to be.

The size data seems about correct, a couple of hundred bytes, but the address seems to be (0xFFFFFFFD) or something very high.

This means that when I skip this chunk, I'm jumping to the filepos (0xFFFFFFFD + about 256), which is way out of the file. The rest of the file (everything up to this point) seems fine, because I can find the other chunks, and the texture chunk, the chunk itself just says it's way outside the file.

We scratch our eternal itch
A twentieth century bitch
We are grateful for
Our Iron Lung

Edited by - slyterence on August 15, 2001 3:35:12 PM

##### Share on other sites
You can send me the .3ds file and I will take a look at it.

The fanatic is incorruptible: if he kills for an idea, he can just as well get himself killed for one; in either case, tyrant or martyr, he is a monster.
--EM Cioran

Opere Citato

1. 1
2. 2
Rutin
19
3. 3
4. 4
5. 5

• 14
• 30
• 13
• 11
• 11
• ### Forum Statistics

• Total Topics
631782
• Total Posts
3002324
×