Tekitoumen opened this issue on Aug 09, 2022 · 7 posts
Tekitoumen posted Tue, 09 August 2022 at 3:22 AM
hello. Please let me know if you know.
I am trying various things now.
"Recognize the direction the model is facing and move the vertices in that direction"
I want to do this in python.
Is there a way to get the direction (normal vector) of the model from Python?
Thank you.
FVerbaas posted Wed, 10 August 2022 at 11:18 AM Forum Coordinator
Not sure what you mean by the 'direction the model is facing'.
If you want to make a grow morph you may want to check out the code of my 'Figure to Prop' script (https://www.renderosity.com/freestuff/items/86003/fig-to-prop) One of the options is to add a grow morph.
If you want to know the direction the figure is looking, you can use the Z-direction of the eyes.
Tekitoumen posted Wed, 17 August 2022 at 1:34 AM
Sorry for my bad explanation.
Yes, I would like to know "what direction the model's body (body axis) is facing".
for example,
"The model's body (body axis) is facing right"
"The model's body (body axis) is facing diagonally forward."
I'm trying to automate the following in Python.
・Import the first model file (obj)
・Check the direction the model's body (body axis) is facing
・Move (edit) part of the model in that direction
・Export
・Import the second model file (obj)
···repetition
Therefore, I want to know the orientation of the model's body (body axis) on python.
As you taught me, line of sight is also an indicator.
If you know how to check the body (body axis) of the model from python, including this method, could you tell me?
Thank you.
FVerbaas posted Sat, 20 August 2022 at 8:40 AM Forum Coordinator
OK. So you start from a body geometry in a .obj. Lets assume the body is humanoid. If the geometry represents a snake or an octopus bets are off.
I take it the geometry does not have a known topology, otherwise the question would have been futile: al you would need to do in select some known vertices and get their xyz.
If the geometry represents a figure in A or T pose but you do not know whether the body is orientated as in Poser, with largest Y coordinates in the head and nose pointing in the direction of the positive Z axis, or for example has its head in maximum positive Z and and nose pointing positive X. In that case I would glook at the geometry's bounding box and at the 'mass' properties. Loop over the vertices and calculate first and second order moment around x, y, and z axis, and min and max values. Then calculate 'cog' in x, y and z avarages. What you want in Poser to become the y-axis is the direction with miniimal total 2nd order moment around the 'cog'. It should normally be parallel with one of the long sides of teh bounding box. Z-axis typically would be in the direction othe shortest side of the bounding box.
But, I am jumping into solutions before I know your problem exactly. In any way: statistical parameters of the point cloud I think would bring you forward.
Tekitoumen posted Wed, 14 September 2022 at 8:41 PM
Sorry for my late response.
Thank you for your help on a difficult topic.
As you said, I think you need to think in point clouds and think about moments mathematically.
We will investigate this area further.
Thank you very much.
adp001 posted Thu, 15 September 2022 at 4:24 PM
You can get the exact rotation of all body parts using [actor].WorldQuaternion(). No need to fiddle with single vertices/polygons to get the direction of an object.
If you are not familiar with Quaternions: Poser user "AllStereo" wrote something useful years ago and put it into freestuff:
https://www.renderosity.com/freestuff/items/72870/poser-quaternion-methods
Y-Phil posted Fri, 16 September 2022 at 3:48 PM
Thank youYou can get the exact rotation of all body parts using [actor].WorldQuaternion(). No need to fiddle with single vertices/polygons to get the direction of an object.
If you are not familiar with Quaternions: Poser user "AllStereo" wrote something useful years ago and put it into freestuff:
https://www.renderosity.com/freestuff/items/72870/poser-quaternion-methods
𝒫𝒽𝓎𝓁
(っ◔◡◔)っ
👿 Win11 on i9-13900K@5GHz, 64GB, RoG Strix B760F Gamng, Asus Tuf Gaming RTX 4070 OC Edition, 1 TB SSD, 6+4+8TB HD
👿 Mac Mini M2, Sequoia 15.2, 16GB, 500GB SSD
👿 Nas 10TB
👿 Poser 13 and soon 14 ❤️