Forum: Poser Python Scripting


Subject: Moving morphs between different figures

Cage opened this issue on Dec 20, 2006 · 1232 posts


kawecki posted Sun, 24 December 2006 at 12:07 AM

Refining more what svdl started:
To calculate the normal of a vertice you must do:

  1. Calcul;ate the normal of each face. You do it by averaging the x,y,z coordinates of each vertex of this face by a formula that I have not in this moment in this computer.
  2. Add to each vertex the normal of the face that is sharing.
  3. Normalize the resulting vector.
    Too much complicated?, there's another more easy way to do it.
    Import the original's figure obj file into Poser and export it again as obj file.
    In the obj file you have the normals!!!!!
    The normals are stored in the obj file as a table
    vn x,y,z
    vn x,y,z
    ...........
    To find to which vertice a normal belongs you must look at the face data in the obj file.
    The face data is stored as
    f v/vn/vt v/vn/vt v/vn/vt .....
    f v/vn/vt v/vn/vt v/vn/vt ......
    ...........
    where v = index to vertex table, vn = index  to normal table and vt = index to uv table
    (All indexes start with 1 and not 0 !!!!)
    Parsing the face data you can create a table of normals indexed by the vertex number..

If you want to transfer the morph to only one body part, you must only export the respective body part and not the whole figure.

You must built the normal table for the figure that will receive the morph target, it doesn't matter if have less or more vertices than the morph source figure.
Once you have the normal table you must find for each vertex the point where the normal intersects some face of the morphed figure (whole figure or only the body part).
The coordinates of the intesection point will be the morph value for this vertex.
How to find the point where the normal intersect some face is another problem and another headache, but at list finding the normals is very easy......

Stupidity also evolves!