Tue, Feb 4, 5:47 PM 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: 3D location of voxels


pauldol ( ) posted Wed, 12 October 2011 at 8:10 AM · edited Tue, 04 February 2025 at 6:06 AM

Hi all,

My scene has a hand which is rendered from a camera. Is there a way to know how far from the camera plane is every voxel of the hand???

The hand is divided in regions, like thumb3, thumb2, thumb1, index3 ..etc
I know how to set parameters for these regions but is there a way to manipulate individual voxels from these regions??

Hope my question is clear enough.

Best,

Paul 


bagginsbill ( ) posted Wed, 12 October 2011 at 8:31 AM · edited Wed, 12 October 2011 at 8:32 AM

No it's not clear. You can't possibly mean voxel.

You also can't possibly mean the distance of something from the camera plane, as that is imaginary and doesn't have a position.

Why not tell us what you need to do, instead of asking for technical details of what you think is the way to do it.

For example, if you're trying to do depth-of-field blur, say so. If you're trying to do fog, say so. These are a couple examples of things that are influenced by distance from the camera itself, and in either case there is no need for you to know the distance.


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


PhilC ( ) posted Wed, 12 October 2011 at 9:06 AM

Python will give you acces to the object's geometry:-

scene = poser.Scene()
actor = scene.CurrentActor()
geom = actor.Geometry()
verts = geom.Vertices()
worldverts = geom.WorldVertices()

print "Local Vertices:-"
print "----------------------------"
i = 0
while i < 10:
   print verts[i].X(),
   print verts[i].Y(),
   print verts[i].Z()
   i = i + 1

print

print "World Vertices:-"
print "----------------------------"
i = 0
while i < 10:
   print worldverts[i].X(),
   print worldverts[i].Y(),
   print worldverts[i].Z()
   i = i + 1

Does that help any?


pauldol ( ) posted Wed, 12 October 2011 at 9:31 AM

Quote - Python will give you acces to the object's geometry:-

scene = poser.Scene()
actor = scene.CurrentActor()
geom = actor.Geometry()
verts = geom.Vertices()
worldverts = geom.WorldVertices()

print "Local Vertices:-"
print "----------------------------"
i = 0
while i < 10:
   print verts[i].X(),
   print verts[i].Y(),
   print verts[i].Z()
   i = i + 1

print

print "World Vertices:-"
print "----------------------------"
i = 0
while i < 10:
   print worldverts[i].X(),
   print worldverts[i].Y(),
   print worldverts[i].Z()
   i = i + 1

Does that help any?

 

 

Thank you!

Your answer is quite helpfull.

  1. what is the origin for local vertices? the center of the actor?

2)So, if I can get the 3D location of the camera pinhole,
I can calculate the distance of the vertices from the pinhole.

Ideally, what I would like is this:

For a 2D rendered image, I would like to know for every 2D pixel how far the respective vertex is from the camera. in this way I can create a "depth image".

If you are familiar with the Kinect (Microsoft's new camera) you can get "depth images" as I described above.

  1. Do you think I can create "depth images" from POSER?

 

 

Thanks in advanve for your help!

Paul


bagginsbill ( ) posted Wed, 12 October 2011 at 9:49 AM

file_473903.jpg

Poser can render depth maps directly. Which version do you have? In the latest versions, this is just a render setting choice.


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


pauldol ( ) posted Wed, 12 October 2011 at 9:54 AM

Quote - Poser can render depth maps directly. Which version do you have? In the latest versions, this is just a render setting choice.

 

I have POSER 8. I guess depth maps are available in later versions?

But yes, a depth map is exactly what I am looking for.

Which version do you have?


pauldol ( ) posted Wed, 12 October 2011 at 11:47 AM

Quote - Poser can render depth maps directly. Which version do you have? In the latest versions, this is just a render setting choice.

I see you use Poser Pro 2012 on Win 7 x64

Currently I use Poser 8 on Win7 X64.

 

Do you know if POSER 9 or POSER PRO 2010 renders to depth maps or should I try POSER PRO 2012 ?

 

Thank you


PhilC ( ) posted Wed, 12 October 2011 at 12:02 PM

In Poser 8 you can obtain reasonable depth maps by using the depth cue.

Set up the scene.
Illuminate using a single point light directly in front.
Turn on depth cue.
Render > Antialias Document.
Export in TIF format.

Open in Photoshop
Inverse the image.

This method was used to create the depth map in this tutorial:-
http://www.philc.net/tutorial8.php

In Poser Pro 2012 simply select depth map in the render options.


bagginsbill ( ) posted Wed, 12 October 2011 at 12:05 PM

I am pretty sure P8 does not have the easy way to do it. PP2010 and PP2012 do. I don't know if P9 has it.

Regardless of which version you have, there are a couple ways to do it. This article tells how and provides a script to make it easy.

http://www.keindesign.de/stefan/poser/dof_tutorial.html


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


bagginsbill ( ) posted Wed, 12 October 2011 at 12:06 PM · edited Wed, 12 October 2011 at 12:07 PM

Cross posted with PhilC.

As I said, several ways to do it.

Note:

Many say it involves replacing all materials.

That depends. If no materials are glowing, you can achieve the same condition by simply turning off or deleting all lights. Then use the Atmosphere depth-cue feature to make the depth map.

 


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


pauldol ( ) posted Sat, 15 October 2011 at 5:48 AM

Quote - Cross posted with PhilC.

As I said, several ways to do it.

Note:

Many say it involves replacing all materials.

That depends. If no materials are glowing, you can achieve the same condition by simply turning off or deleting all lights. Then use the Atmosphere depth-cue feature to make the depth map.

 

 

Thanks a lot!

I'll give it a try and see how it goes.

 

Paul


pauldol ( ) posted Sat, 15 October 2011 at 5:49 AM

Quote - In Poser 8 you can obtain reasonable depth maps by using the depth cue.

Set up the scene.
Illuminate using a single point light directly in front.
Turn on depth cue.
Render > Antialias Document.
Export in TIF format.

Open in Photoshop
Inverse the image.

This method was used to create the depth map in this tutorial:-
http://www.philc.net/tutorial8.php

In Poser Pro 2012 simply select depth map in the render options.

 

Thanks for the help.

Paul


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.