Welcome to the Poser Forum

Forum Moderators:  Boni, Kendra    Forum Coordinators:  darknewt, Jules53757, SpookieLilOne, gmm2

Poser F.A.Q (Updated: 2016 Nov 29 4:50 pm)


 Subject: Oh python GODS! Is it possible.....

shadownet opened this issue on Nov 21, 2004 · 134 posts

Top of Forum Print

  shadownet    ( ) ( posted at 2:33PM Sun, 21 November 2004 · edited on 3:24PM Mon, 09 May 2005

Had a crazy thought. Wondering if it is possible to use a python script to set the focus setting in the P5 render option by keying it to the location of a ball prop in your scene. By this I mean, where I place the ball prop being sort of the crosshairs to determine focus depth, etc. So, is that a pipe dream or is it doable? [bows deepy and reverently as he backs away from the altar]


  ockham    ( ) ( posted at 2:51PM Sun, 21 November 2004  · @2014906


Do you mean these settings? If these show up in a PZ3, it should be possible. Python would pick up the ball's location, write the corresponding focus data into a "dummy" PZ2, and quietly import the PZ2. You'll have to specify what relationship you want in numerical form, because I know nothing from focus!

My python page
My ShareCG freebies

  shadownet    ( ) ( posted at 3:02PM Sun, 21 November 2004  · @2014917

Yes, that's the settings I'm referring to. That info appears to save in the pz3 as the settings stay as set whenever I reload the pz3 file. We might need help from someone who understands the focus data better, my photography skills are a bit rusty. So far I have been doing trial and render - and that ain't working out too hot! [bows worshipfully again]


  shadownet    ( ) ( posted at 3:04PM Sun, 21 November 2004  · @2014918

Er, is there a Doctor in the house???


  ockham    ( ) ( posted at 3:11PM Sun, 21 November 2004 · edited on 3:13PM Sun, 21 November 2004 · @2014928


Here's a trial version, with a totally
arbitrary relationship. The Ball Z
is taken as the focal length, and
Ball Y * 2 is taken as the f-stop.
See if this gives you a more empirical
sense of how the relationship should really
work..... Edit: in case it's not obvious, you move the ball, make sure the ball is still selected, then hit the script.

Message edited on: 11/21/2004 15:13

My python page
My ShareCG freebies

  shadownet    ( ) ( posted at 3:33PM Sun, 21 November 2004  · @2014944

Wow! you are fast! I will give this a try now and let you know how it does. Thanks a bunch [grovels in obeisance]


  ockham    ( ) ( posted at 3:36PM Sun, 21 November 2004  · @2014947

I think the length should really be based on crow-flies distance from current camera, but this will at least give your hand-eye coordination some exercise until we hear from somebody who knows cameras.

My python page
My ShareCG freebies

  softriver    ( ) ( posted at 3:37PM Sun, 21 November 2004  · @2014949

gapes You, Ockham, are a brilliant, brilliant human being. I'm not big on religion, but when you meet someone who can work miracles at will, it certainly makes you think about moving to California and starting a cult! ~To you, Ockham, LORD OF SCRIPTS, we give these blessings ~Calloo Callay, Calloo Callay, in your name we rejoice! So, um, anyway, is there somewhere we can go to bribe, er, um, donate to you? :)


  softriver    ( ) ( posted at 3:40PM Sun, 21 November 2004  · @2014954

I'll experiment with the script tonight and see if I can get a good handle on the relationship between real life photography and Poser-ese, btw. ;) (I'd do it now, but I'm leaving in twenty minutes, so I won't have the chance... I can't work as quickly as you. :P )


  shadownet    ( ) ( posted at 3:43PM Sun, 21 November 2004  · @2014957

Even approximate at this point is probably going to yield better results than what I have gotten thus far just playing with fstop and focal depth settings. Now, so as to not be too big an igit when I do this, let me make sure I am clear on what I am doing. I am loading two ball props - or just one? into my scene. I position these (er with one I would put it on the figure I want in focus - not sure about the other) Then I apply the python, render and do the happy snoopy Is that about it?


  ockham    ( ) ( posted at 3:47PM Sun, 21 November 2004  · @2014964

Just one ball. The Z-distance from center becomes the focal distance, so the idea is that you put the ball on the location where you want the focus. (As I mentioned, this won't be numerically right; it really should be dist from current camera.) The height (Y tran) becomes the F-stop, which may not feel right. Maybe more intuitive if the scale controls the F-stop?

My python page
My ShareCG freebies

  stewer    ( ) ( posted at 3:47PM Sun, 21 November 2004  · @2014965

" I think the length should really be based on crow-flies distance from current camera," Correct. Here's how to calculate the focal length to get the currently selected object in focus (in PNU):

import poser, math

scene = poser.Scene()
actor = scene.CurrentActor()
cam = scene.CurrentCamera()

p1 = actor.WorldDisplacement()
p2 = cam.LocalDisplacement()
p3 = actor.Origin()
d = (-p3[0] + p2[0]-p1[0], -p3[1] + p2[1]-p1[1], -p3[2] + p2[2]-p1[2])
mag = math.sqrt (d[0]*d[0] + d[1]*d[1] + d[2]*d[2])

  softriver    ( ) ( posted at 3:48PM Sun, 21 November 2004 · edited on 3:50PM Sun, 21 November 2004 · @2014966

Btw, here is a good reference to give you an idea what the relationship is, shadownet and Ockham:

http://www.mir.com.my/rb/photography/fototech/htmls/depth.html (The link includes both technical and layman's explanations)

Message edited on: 11/21/2004 15:50


  compiler    ( ) ( posted at 3:52PM Sun, 21 November 2004  · @2014976

Bookmarking this thread : I'm really in need of something understandable to set the focus in my pics.


  ockham    ( ) ( posted at 3:53PM Sun, 21 November 2004  · @2014978

Is the var you've labeled as 'mag' the same thing as focal length? Or does it need another formula?

My python page
My ShareCG freebies

  quinlor    ( ) ( posted at 3:54PM Sun, 21 November 2004  · @2014980

The focal distance should be the distance between the prop and the camera. At this distance will be the maximum sharpness (point of focus). Stewer has a script to calcualte it from the position of a prop. The f-stop, together with the camera focal length, controls how deep the sharp area will be. If poser accuratly models a real lens, this area will be deeper behind the point of focus than in front of it. A bigger F-stop number gives a bigger sharp area.


  quinlor    ( ) ( posted at 3:54PM Sun, 21 November 2004  · @2014981

Oops; crossposted with stewer!


  compiler    ( ) ( posted at 3:57PM Sun, 21 November 2004  · @2014983

So could it be possible to have one ball to be positioned on the point of focus, then its scale expanded or reduced to get the boundaries of the "sharp zone" ? (sorry if it doesn't make sense : I know nothing about real life cameras).


  softriver    ( ) ( posted at 3:59PM Sun, 21 November 2004  · @2014985

So could it be possible to have one ball to be positioned on the point of focus, then its scale expanded or reduced to get the boundaries of the "sharp zone" ? In pmath terms, you would want the target object's scale to be directly or indirectly proportional to f-stop?


  stewer    ( ) ( posted at 3:59PM Sun, 21 November 2004  · @2014987

'mag' is the final value in PNU - I just named the value like that because it's the magnitude of the vector between the object and the camera.


  softriver    ( ) ( posted at 4:03PM Sun, 21 November 2004  · @2014992

sorry. 'indirectly' should be 'inversely' in my above statement. (running late, excited about topic... arggh)


  shadownet    ( ) ( posted at 4:03PM Sun, 21 November 2004  · @2014993

thanks for the link softriver, definitely will be useful. And a lot easier than rummaging through the storage boxes trying to find my old photography books. Stewer - okay you qualify as a GOD too. Scratches head and leaves it up to Ockham to understand godspeak. :O)


  ockham    ( ) ( posted at 4:05PM Sun, 21 November 2004  · @2014995


Thanks, Stewer. So here's another version, using your mag * 8 as the focal length in feet, and using the ball's scale to control f-stop. Is there a linear relationship between the f-stop number and the area or diameter of the "sharp region"?

My python page
My ShareCG freebies

  ockham    ( ) ( posted at 4:06PM Sun, 21 November 2004  · @2014996

Edit: Is there a numerical relationship (linear or otherwise) between the f-stop number and the area or diameter of the "sharp region"?

My python page
My ShareCG freebies

  shadownet    ( ) ( posted at 4:07PM Sun, 21 November 2004  · @2014997

okay, too many grey cells at work here, I'm going to sit back and look on worshipfully


  softriver    ( ) ( posted at 4:13PM Sun, 21 November 2004  · @2015006

Is there a numerical relationship (linear or otherwise) between the f-stop number and the area or diameter of the "sharp region"? Not one I can specify. I believe it's an inverse square. Here's the general data (re-posted from link): The smaller the aperture, the deeper the depth of field (the other two factors remaining the same). For example, if the lens focal length and the shooting distance stay the same, the depth of field is much deeper at f/16 than at f/1.4.


  Tashar59    ( ) ( posted at 4:26PM Sun, 21 November 2004  · @2015014

I don't want to miss this.


  softriver    ( ) ( posted at 4:30PM Sun, 21 November 2004 · edited on 4:32PM Sun, 21 November 2004 · @2015018

I don't want to miss this.

Yes. Rare opportunity to see dorks in their native habitat, eh? 8D

grins dorkily while calling to tell her parents she'll be late for dinner EDIT: Please don't think I'm calling anyone else a dork, but I relish my dork-dom. It is a badge of pride! =P Message edited on: 11/21/2004 16:32


  shadownet    ( ) ( posted at 4:36PM Sun, 21 November 2004  · @2015024

I B A Dork too! (he says with swelled chest) :O)


  milamber42    ( ) ( posted at 4:40PM Sun, 21 November 2004  · @2015029

bookmark.


  Tashar59    ( ) ( posted at 4:41PM Sun, 21 November 2004  · @2015031

Dork? I thought it was Nerd! That's what I used to call them. Well, till I became one too! LOL.


 To create a post you must first sign in or register an account.

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.