PDA

View Full Version : 3DS format

KRONOS
03-09-2001, 05:45 AM
How can one find the textures coordinates of the vertex? What's the chunk and how is it composed?

Thank....

V
03-09-2001, 06:02 AM
Look for Lib3ds by J.E. Hoffman at SourceForge. It covers many aspects of 3ds reading, including texture coordinates-

KRONOS
03-09-2001, 02:23 PM
What about normals? Are there any? I couldn't find them, so I did this: For each triangle, with the 3 points of the triangle, calculated the normal vector, normalized it and used it with thoose 3 vertex of the triangle (the same normal for the 3). Is this correct? The results where good... But is there any room to improvement? Like some sort of smooth normals......

Thanks

holocaust
03-10-2001, 03:03 AM
Well to have smooth normals i would do what you did first then :

for (each vertex) {
get all related faces normals
sum these normals
normalize the sum
}

[This message has been edited by holocaust (edited 03-10-2001).]

V
03-10-2001, 09:03 AM
Actually, if you're loading any large 3ds models, you'll be better off finding the vertex normals by

(a) init all vert normals to 0
(b) for each mesh-face, add face normal to each vert's normal (creating a big sum)-
(c) normalize all vert normals

If you iterate all faces for each vertex, on large models (15k+ triangles), you'll be waiting forever~ (numVert * numFace ) = O(n^2)

The per-face way is (numVert + numFace + numVert) = O(3n)