I’ve been doing a lot of work on my engine recently but have hit an annoying snag.
While I can display vertex and face normals fine, I can only manage to export FACE normals from 3DSMAX (3.1). I can’t tell you how wierd my engine looks running with all the bells and whistles but only with flat shading.
Could somebody please explain to me how to access MAX vertex normals? The SDK online help has given me a headache…
Some would say that I could just calculate them myself, but it seems a shame to have $3000 worth of software here and not be able to take advantage of it.
Thanks in advance.
PS: I’m currently getting face normals like this “Point3 FaceNorm = mesh->getFaceNormal(i);”
It looks so simple… Which makes not understanding vertex normals almost embarrassing.
Look at the MAX SDK samples. There is the source code of the ASE exporter plugin, and that plug-in exports vertex normals. See there how to make that!. Exporting vertex normals is not as easy as exporting face normals. It’s very complicated, and I don’t understand it at all yet. Don’t expect to find a getVertexNormal(i).
I had the same problem: I only could export face normals, but finally I find out the method to export vertex normals.
[This message has been edited by Sansus (edited 01-10-2001).]
Working on it now.
It’s been awhile since I did anything with my own exporter, but I think there’s a function you need to call to generate normals before you can actually use the getNormal function.
Its true, first you must generate the normals by using Mesh::buildNormals()
You can generate the normals yourself.
For each smoothing group:
.For each vertex in the smoothing group:
…For each face using that vertex in the smoothing group:
…Calculate the face normal (un-normalized)
…Average these face normals (which will weight based on area of each face)
…Normalize the average – this is the vertex normal for this smoothing group.
Point3 normal = mesh.getNormal(i);