Since I've now also wanted to get totally correct normals, I've dug a little deeper into the 3DS-format and tried to implement smoothing groups. Info on if a face belongs to such a smoothinggroup and in which smoothing group it is is stored in the chunk with the ID $4150. But documentation on 3DS is either incomplete or wrong, so implementing smoothing groups isn't very easy at all. The two docs I have on the 3DS-fileformat include wrong informations on what is stored in that chunk and I had to take a look at another loader to see how to get it right. Right now it's kind of working on some meshes as you can see here :
(left = no smoothinggroups, right = with smoothinggroups, note that normals look wrong, that's cause I'm applying kind of a gammafunction to make them easier to see)
As you can see, especially the pillar on the left shot has no really smooth normals, whereas the right one has due to the use of smoothinggroups. But as you can also see, some other parts of the mesh have totally wrong normals when using smoothinggroups. But as said above, documentation on that matter is really bad (or better said non-present at all, all docs I have only say how the chunk looks, not how it's used), so I'm right now trying to figure out by myself how it works. I'll let you know if I'll (when ever) get it working...
|