Script: DoF toy for max

Hi all

I want to give you and Vlado a tiny little toy to show you how *easy* DoF could work. ..maybe Vlado can add such a feature to the final 1.5 ..whenever the chaos will drop it *g*

the code is that simple that it can’t be a problem to add it to vray soon

u = 0.025 --unschärfekreis für kleinbild 0.025 (mm)
f = 50 -- focal lenght (mm)
d = focus distance
k = 1.8 -- Aperature size ..increasing means a smaller opening and not a wider opening .. i want to mention it , because i think vray is handling this value wrong!

Hf = (f*f) / (k*u*1000) --hyperfocus
near = (Hf *d) / (Hf + d) --near focus
far = (Hf *d) / (Hf - d) --far focus

greetings from vienna!

Re: Script: DoF toy for max

Just missing that aspect ratio spinner I’ve been begging for, so you can simulate anamorphic lenses!

Nice, I like it!

Btw, the aperture size in VRay is the physical size of the aperture, not the F-stop. In some ways this is more meaningful than an F-stop since not all 3D scenes are in a real world scale, and just putting in the size of the aperture is a quick way to get the look you want.
I guess an F-stop control could be implemented as well, one that also automatically updated the aperture size value. You would need some way to give VRay a point of reference for knowing what scene size one of the first F-stop is. If for instance f/1.0 is 50 units the control would set the aperture size to 35.7 units if you changed the f/stop to 1.4, and 25 units if you changed the f/stop to 2.0, and so on (halving the area of the aperture each time you move one stop).

well ..that’s true, but what does an aperature of 0.001m means?
I don’t know it!
..but i know the difference between f/1.4 and f/22 and i know what happens when i use a 15mm instead of a 105 macro …you know that’s my point and reason why i want to spread this tool.

*IF* vray can’t use a correct cameramodel, then it would make sense to use something like range of sharpness in meter(units) and the centerbais, which should be +1/3. ..BUT(!!!) the correct cameramodel would be much easier and you could give the users a really handy tool like in this script without any cheats or freakvalues.

well ..that’s true, but what does an aperature of 0.001m means?
I don’t know it!

A 10 mm aperture is f/1 on a 10mm lens, or f/2 on a 20mm, or f/4 on a 40mm lens etc. The f/stop is the ratio between the focal length of a lens and the diameter of the aperture. On a 50mm lens, f/2 means that the diameter of the aperture is 25mm. The ratio is this 50/25 = 2, hence f/2.

So an aperture of 0.001m means, for instance, f/22 on a 22mm lens.

BTW, I’m not saying I don’t like your tool. I think it’s great!

A thing I would like to see in the future is a VRay camera that has per-camera controls for all these things (focal length/aperture size/shutter speed). Right now it is hard to have a tele lens and a wide angle lens in the same scene for instance, since I have to keep changing the camera settings in the render rollouts to get the proper look for each. Or keep more than one scene, which is a nightmare once a client wants some changes. My ideal camera would also include viewport feedback of course :slight_smile:

Torgeir,

do you know if the aperture size is the diameter? I asked this a while back but unfortunately this post was never answered.

Furthermore, is it true that the f-stop can be calculated in max as with a real camera (f-stop value is focal length/aperture diameter)

EDIT: how come my post is later than those two above, now it looks I don’t read before I ask :lol:

I know we don’t talk about my script and i’m happy to talk about the system behind vray DoF.

A 10 mm aperture is f/1 on a 10mm lens, or f/2 on a 20mm, or f/4 on a 40mm lens etc.

f/1.4 will be a fully open aperature and with every increasing f-step the aperature will be smaller and smaller until you have the smallest aperature your optic will provide.

open aperature = full glory of DoF
smalles aperature = no DoF

Furthermore, is it true that the f-stop can be calculated in max as with a real camera (f-stop value is focal length/aperture diameter)

I think the Camera model in max is wrong.. the aperaturesize of max is shown on the right of the output rendersize dropdown and when selecting a 36mm slide it shows you an aperature size of 34,2mm instead of 36mm ..so this indicates that the camera model is wrong.
Max also don’t have a scriptable focal lenght parameter ..you have to calculate it from the HFov! ..which could be the workaround for the problem with the aperature size

btw, i think the formular to calculate the Hyperfocal lenght is max unitsize independent

oops ..Torgeir, you are right ..i missed the 2nd part. sorry!

A 10 mm aperture is f/1 on a 10mm lens, or f/2 on a 20mm, or f/4 on a 40mm lens etc.
It’s the opposite!
f/1.4 will be a fully open aperature and with every increasing f-step the aperature will be smaller and smaller until you have the smallest aperature your optic will provide.

open aperature = full glory of DoF
smalles aperature = no DoF
Yes, I wrote on a 10 mm lens, 20 mm lens etc. (as in focal length, not aperture size.) My point was that the same aperture size is a different f/stop on different lenses, and if you know the focal length and aperture size you can easily calculate the f/stop.

Another thing is that in VRay the f/stops doesn’t really change the exposure, but only the DOF, and I’m kind of happy about that , I like the freedom we have over a phsical camera.

Torgeir,
do you know if the aperture size is the diameter? I asked this a while back but unfortunately this post was never answered.

It’s the radius.

oops ..Torgeir, you are right ..i missed the 2nd part. sorry!
hehe, ok :slight_smile:

Thanks Torgeir, I think this is important missing information in the manual.

Christian, sorry for hijacking your thread :sweat_smile:

sure! :lol:

i also think that exposure controll is a diffent kind of cheat, but nevertheless DoF controll in Vray isn’t what i would call user friendly.

Here is a little update:

Nice!

A few minor things:
aperature should be aperture
infinitive should be infinity

…but nevertheless DoF controll in Vray isn’t what i would call user friendly.Perhaps, but the controls are enough to define the camera exactly and without ambiguities. From them, you can compute any other values you need, and vice-versa.

Best regards,
Vlado

new:
- some typo updates - thx Torgeir :wink:
- the aperture diameter in different units. ..should be the right value for every renderer
- a slider instead of a dropdownbox

vlado, there will be a physical correct camera in vray 3.98.18 ..right :wink:

Nice Tool Dschaga! Good to speak about this topic again!
I think it should be integrated… Nah, put that into a VrayCam Interface Mockup and put it in the Wishlist section. :wink:
Also consider the polygonal shape of the aperture. I think this could be handy.
Unfortunately i don’t have time to think about it myself.

vlado, there will be a physical correct camera in vray 3.98.18 ..right;)

Dude i’m sure we’ll see some improvements before Vray is !Realtime… :wink:

oh ..forgot to ask vlado:
Is the vray aperture unit in meter, centimeter or millimeter.
I get only good results when i interpret my values ..in above case “0.0355m” as 0.3555 ..decimeters(?).