Mon, Nov 25, 2:09 PM CST

Renderosity Forums / Poser - OFFICIAL



Welcome to the Poser - OFFICIAL Forum

Forum Coordinators: RedPhantom

Poser - OFFICIAL F.A.Q (Last Updated: 2024 Nov 25 12:38 pm)



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


shadownet ( ) posted Sun, 21 November 2004 at 2:33 PM · edited Mon, 25 November 2024 at 8:49 AM

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 Sun, 21 November 2004 at 2:51 PM

file_144634.gif

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 Sun, 21 November 2004 at 3:02 PM

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 Sun, 21 November 2004 at 3:04 PM

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


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

file_144637.gif

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 Sun, 21 November 2004 at 3:33 PM

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 Sun, 21 November 2004 at 3:36 PM

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 Sun, 21 November 2004 at 3:37 PM

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 Sun, 21 November 2004 at 3:40 PM

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 Sun, 21 November 2004 at 3:43 PM

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 Sun, 21 November 2004 at 3:47 PM

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 Sun, 21 November 2004 at 3:47 PM

" 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 Sun, 21 November 2004 at 3:48 PM · edited Sun, 21 November 2004 at 3:50 PM

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 Sun, 21 November 2004 at 3:52 PM

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


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

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 Sun, 21 November 2004 at 3:54 PM

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 Sun, 21 November 2004 at 3:54 PM

Oops; crossposted with stewer!


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

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 Sun, 21 November 2004 at 3:59 PM

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 Sun, 21 November 2004 at 3:59 PM

'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 Sun, 21 November 2004 at 4:03 PM

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


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

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 Sun, 21 November 2004 at 4:05 PM

file_144638.gif

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 Sun, 21 November 2004 at 4:06 PM

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 Sun, 21 November 2004 at 4:07 PM

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


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

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 Sun, 21 November 2004 at 4:26 PM

I don't want to miss this.


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

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 Sun, 21 November 2004 at 4:36 PM

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


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

bookmark.


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

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


msg24_7 ( ) posted Sun, 21 November 2004 at 4:46 PM

Another quick question to Ockham... Does it matter, what I've selected in general preferences? Poser Units, centimetres, feet... ? Or will the script work with any of the possible settings properly?

Yesterday's the past, tomorrow's the future, but today is a gift. That's why it's called the present.


xantor ( ) posted Sun, 21 November 2004 at 4:47 PM

Nerd is the right word, dork is a certain body part. ;)


shadownet ( ) posted Sun, 21 November 2004 at 4:57 PM

Hmm, tried the script on the pic I am currently working on but the spot where I put the ball is not seeming to be the focal point. This may be cause I have my camera rotated in my universe. I will set up a new scene with some props and see if I can get a better handle on how the ball placement works.


softriver ( ) posted Sun, 21 November 2004 at 5:00 PM

Can I just say before I leave that this script is a brilliant idea. Translating a skill that in real life often equates to "fiddling with your camera" (for people who aren't professional photographers) into Poser is long overdue. THANK YOU OCKHAM!


diolma ( ) posted Sun, 21 November 2004 at 5:06 PM · edited Sun, 21 November 2004 at 5:09 PM

Attached Link: http://www.cs.mtu.edu/~shene/DigiCam/User-Guide/950/depth-of-field.html

@Ockham An f-stop is a measure of how wide the aperture of a camera lens is. It is intimately tied up with 2 things; the amount of light that is let into the camera (not really relevant here) and the depth of field (which is). DOF is about how far before and beyond a plane (the focal plane) other objects remain in focus. The above link helps explain depth of field. Just what the exact mathematical relationship is I'm not sure, but I don't think it involves the inverse square rule (at least, not in simple cases:-) but it certainly involves some trig:-))

Hope it helps (result of simple google for "depth of field")

Cheers,
Diolma

Message edited on: 11/21/2004 17:09



Rance01 ( ) posted Sun, 21 November 2004 at 5:07 PM

Attached Link: http://www.keindesign.de/stefan/poser/index.html

Not really talented enough to be considered for the dork hall of fame. A follower really. Didn't Stefen of http://www.keindesign.de/stefan/poser/index.html make a script to set Depth of Field and Focal distances some time ago? I read such in another thread and downloaded his script some time ago. I had saved the URL in my Faves. Hope this is on topic ...


ockham ( ) posted Sun, 21 November 2004 at 5:08 PM

Does it matter, what I've selected in general preferences? Poser Units, centimetres, feet... ? No, it doesn't matter. The internal values (which Python sees) are always in PU.

My python page
My ShareCG freebies


ockham ( ) posted Sun, 21 November 2004 at 5:16 PM

So it sounds like there isn't really a numerically definable relationship between aperture and "sharp region"? I've been Googling some of that stuff, and I'm frankly lost. Seems to be considerable argument among the various tutorials, with some debunking the others!

My python page
My ShareCG freebies


shadownet ( ) posted Sun, 21 November 2004 at 5:17 PM

Nothing like reinventing the wheel or building a better mousetrap. :O) Cool link Rance01 looke like a lot of useful info for folks new and ignorant to P5 - of which I B #1


ockham ( ) posted Sun, 21 November 2004 at 5:19 PM

The way I heerd it, a nerd is one who has no social skills and knows it. A dork is one who has no social skills and doesn't know it. (I've run into a lot of salesmen in computer stores who are purebred dorks, for some reason.)

My python page
My ShareCG freebies


diolma ( ) posted Sun, 21 November 2004 at 5:21 PM

LOL @ Ockham!!! BTW - it's not limited to computer stores.... Cheers, Diolma



stewer ( ) posted Sun, 21 November 2004 at 5:31 PM

file_144639.gif

I couldn't resist.


shadownet ( ) posted Sun, 21 November 2004 at 5:32 PM

Ockham, the script Rance1 mentions looks like what stewer posted and is used to calculate the distance between the camer and objects in focus or Focal Distance option. Maybe you can take a look at the method outlined by Stephen (on his website tutorial on this, which also has the py script) and see if that helps. I like the idea of being able to either pick a figure or place a ball prop where I want my focal point to be and the script do the calculation to give me the depth of field effect I want. So don't give up on this just yet. :O)


Rance01 ( ) posted Sun, 21 November 2004 at 5:32 PM

Dorks, nerds, or gods, I think you are ALL wonderful. I love these threads ... Rance


quinlor ( ) posted Sun, 21 November 2004 at 5:36 PM

There has to be a formula, I have seen tables on deep of field for real camaras. For a given focal length, focal distance, f-stop and film format, the deep of field is the same for every lens. It has to be a optical formula. Unfortunaly I can not find the actual formular in any of my photography books. :-( Anybody with an optics textbook around? I assume Poser simulates a 36 mm film format.


Rance01 ( ) posted Sun, 21 November 2004 at 5:37 PM

Shadownet, I wasn't all together sure if that's the tool you were thinking about or not. I've a number of Ockham's scripts and know that he's one of the Poser GREATS. I bow low and slowly walk to the next thread. Rance


shadownet ( ) posted Sun, 21 November 2004 at 5:41 PM

Rance, I was not familar with that script so thanks. It is useful. I am hoping the great Ockman whose name must be held in awe can do it one better. :O)


Rance01 ( ) posted Sun, 21 November 2004 at 5:52 PM

Saved the thread to faves. Along with Shading Rates I think Focal Points and Depth of Field are some of the most interesting features of FireFly. Thanks for kicking this thread off. Rance


Nightwind ( ) posted Sun, 21 November 2004 at 6:33 PM

http://www.schneideroptics.com/info/depth_of_field_tables/ This is for cameras, not sure if it works the same for poser. I haven't tried, but I think to use these you'd have to change the measurement in poser to feet and the focal to the appropriate mm. If python doesn't see anything but PU, then I guess a conversion would be in order. Is that possible with any accuracy? There is an equation, but that's in the realm of physics and I swore off that after college.:) This definitely a thread to watch.


geep ( ) posted Sun, 21 November 2004 at 6:36 PM

file_144642.gif

This was just a quickie experiment. It is just my $ .02 for anyone that might be interested in a starting point of reference. I shall try to do a more definative tut on FireFly sometime in the future ... the Good LORD willing and the crick (if you're not from PA, that's creek) don't rise ... too high. ;=] Right now, I've got to worry about some idiot who has installed electronic surveillance equipment right across the street from my new secret (Oops! - I guess it's not secret anymore) laboratory where I do all my Poser experiments. cheers, dr geep ;=]

Remember ... "With Poser, all things are possible, and poseable!"


cheers,

dr geep ... :o]

edited 10/5/2019



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.