3DS writer problem

I got a problem with writing 3ds max. There is no place to specify normal vectors for the vertices of my triangles. So I only write out the triangles but the results are not good looking. You see strangly gouroud shaded triangles:


I think the problem is not in my data structures, as I can export different other formats (e.g. STL, VRML and POV) and it works perfect.

Do I maybe have an old format description of 3ds where no normal vectors could be defined?

Any other suggestions?

The 3ds file format does not support normal vectors at all. You will have to generate the normal vectors yourself. Each face has a smoothing group bit. Face normals in the same smoothing group can be averaged to generate vertex normals.

OK, so I assume, that as I’m writing 3ds, I don’t have to care about it. The reader will do the smoothing.
I already found out, that the viewer I use shows all 3ds parts (even samples from the web) with this strange shading.

I have another question. I can read my written model with 3d-exploration and autocad, but not with 3ds-max. I’m writing R2 compatible files. Whats the problem?

Thanks for your help!

Hmm, I’m not sure why it would work for other programs but not for MAX. The source code to the 3ds importer and exporter are provided in the 3ds Max sdk, you might be able to debug the problem using the source.

Thanks, but already solved… The mesh version was wrong and some global settings were missing. 3dstudio only loads it, if all these things are in. But autocad and 3d exploration loads it also, if these things are missing.