3ds loader .. calc normals with multiple vertices used?!

Started by
3 comments, last by cignox1 17 years, 10 months ago
hi i got an loader for 3ds files in openGL an it works nearly perfect, ok ,there are no NORMAL's saved in 3ds file format i GOOGELD a lot of things with "+opengl +calculating +normals etc and i found some examples of calculatin face normal, ok,but there is &#111;ne mistake in it when calculatin round objects like tree there are points that should have a normal direction mixed because that point is used by some faces (sorry for my english,i normally speak &#111;nly german) for example this are 8 faces and 8 points (watching from top) <img src="http://img111.imageshack.us/img111/4395/normal3df.jpg" alt="problem" /> when calculating point '0' with '2' and '3' they miss '6' and '7' normally the normal of 0 must look North and not northeast like here what formula is there to combine all vertices that are mutiple used by faces (please no google answers anymore)
Advertisement
First off: 3ds files do support normals.
Second: Learn to use google. :D

If you want to calculate the "average" normal for those points..
1) calculate the normals of ALL faces that is connected to one vertex. (simple cross-product..)
2) Average those (should be depending on the area of the face) and you have your normal.

For a cube, you normally want "hard" edges, that is, no shared normals, but to use the face-normals instead, which means you have to split each vertex into 3 vertcies...

Good luck!

chunk
0x4110 == vertices
chunk
0x4120 == face polys
chunk
0x4140: == texture coordinates

etc..etc

google tell not about the mistery what chunk
uses/stores normals but it looks that
YOU "gugli" know more about it :)

please feel free to tell us more about it here


or did anybody else know a complete serious describtion of .3ds files
with "normal" definitions inside..so i can stop thinking about normals
when using 3d editors (only watching face orientation when creating objects)

a lot of "google" result tells that 3ds did NOT store normals










set the normal for the vertex to be the average face normal for all the triangles that use the vertex. this will look "right" and will provide smoother shading than having the vertex have a different normal for each triangle that uses it.

for ( each vertex ){    find all the triangles that use it;    for (each triangle)    {        add the tri normal to the average;    }    normalize the average;}


-me
Quote:Original post by Palidine
set the normal for the vertex to be the average face normal for all the triangles that use the vertex. this will look "right" and will provide smoother shading than having the vertex have a different normal for each triangle that uses it.

for ( each vertex ){    find all the triangles that use it;    for (each triangle)    {        add the tri normal to the average;    }    normalize the average;}


-me


Agree. In addition, I've just written a basic 3ds loader (tell me if you want the source to look at, and I could mail it to you, if you're interested) and AFAIK there are no normals stored in the 3ds format file. Most of the others formats I looked at don't keep normals simply because they can be calculated from vertices. Only a couple of formats do that (but I don't remember wich).

This topic is closed to new replies.

Advertisement