Thu, Jan 30, 8:42 AM CST

Renderosity Forums / Poser Python Scripting



Welcome to the Poser Python Scripting Forum

Forum Moderators: Staff

Poser Python Scripting F.A.Q (Last Updated: 2024 Dec 02 3:16 pm)

We now have a ProPack Section in the Poser FreeStuff.
Check out the new Poser Python Wish List thread. If you have an idea for a script, jot it down and maybe someone can write it. If you're looking to write a script, check out this thread for useful suggestions.

Also, check out the official Python site for interpreters, sample code, applications, cool links and debuggers. This is THE central site for Python.

You can now attach text files to your posts to pass around scripts. Just attach the script as a txt file like you would a jpg or gif. Since the forum will use a random name for the file in the link, you should give instructions on what the file name should be and where to install it. Its a good idea to usually put that info right in the script file as well.

Checkout the Renderosity MarketPlace - Your source for digital art content!



Subject: Recognizing the direction the model is facing


Tekitoumen ( ) posted Tue, 09 August 2022 at 3:22 AM · edited Thu, 30 January 2025 at 8:34 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 · edited Sat, 20 August 2022 at 8:41 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
adp001 posted at 4:24 PM Thu, 15 September 2022 - #4444537

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

Thank you 

𝒫𝒽𝓎𝓁


(っ◔◡◔)っ

👿 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 ❤️


Privacy Notice

This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.