Hello Everyone!
I am trying to export vertex normals of an object into a simple custom ASCII format.
Some relevant parts of the code:
> mesh = snapshotAsMesh objects[obj_idx]
> faceCount = getNumFaces mesh
>
> for idx = 1 to faceCount do
> (
> coord_face = getFace mesh idx
> for vidx = 1 to 3 do
> (
> vector = getNormal mesh coord_face[vidx]
> format " n % % %" vector[1] vector[2] vector[3] to:file
> )
> )
When I use my script to export the vertex normals of a cube I get strange results:
> // triangle 1
> v -5.0 -5.0 -5.0 n 0.0 0.0 -2.0
> v -5.0 5.0 -5.0 n 0.0 0.0 -1.0
> v 5.0 5.0 -5.0 n 0.0 0.0 -2.0
> // triangle 2
> v 5.0 5.0 -5.0 n 0.0 0.0 -2.0
> v 5.0 -5.0 -5.0 n 0.0 0.0 -1.0
> v -5.0 -5.0 -5.0 n 0.0 0.0 -2.0
> // triangle 3
> v -5.0 -5.0 5.0 n 0.0 0.0 2.0
> v 5.0 -5.0 5.0 n 0.0 0.0 1.0
> v 5.0 5.0 5.0 n 0.0 0.0 2.0
> <and so on..>
I also tried to export face normals and they were perfectly OK.
Am I doing something wrong or is the internal vertex normal cache broken somehow?
Anybody ever had similar problems with normals?
Thx in advance for any comments!
Martin