Welcome to the Poser Forum
Poser F.A.Q (Updated: 2016 Nov 29 4:50 pm)
Subject: Oh python GODS! Is it possible.....
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]
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
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]
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:13My python page
My ShareCG freebies
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? :)
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?
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
" 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 + p2-p1, -p3 + p2-p1, -p3 + p2-p1) mag = math.sqrt (d*d + d*d + d*d)
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.
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.
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