Announcement

Collapse
No announcement yet.

Script: DoF toy for max

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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*



    http://www.cgtechniques.com/goodies/doftoy/


    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!
    www.cgtechniques.com | http://www.hdrlabs.com - home of hdri knowledge

  • #2
    Re: Script: DoF toy for max

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

    Comment


    • #3
      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).
      Torgeir Holm | www.netronfilm.com

      Comment


      • #4
        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.
        www.cgtechniques.com | http://www.hdrlabs.com - home of hdri knowledge

        Comment


        • #5
          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.
          Torgeir Holm | www.netronfilm.com

          Comment


          • #6
            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
            Torgeir Holm | www.netronfilm.com

            Comment


            • #7
              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
              You can contact StudioGijs for 3D visualization and 3D modeling related services and on-site training.

              Comment


              • #8
                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
                www.cgtechniques.com | http://www.hdrlabs.com - home of hdri knowledge

                Comment


                • #9
                  oops ..Torgeir, you are right ..i missed the 2nd part. sorry!
                  www.cgtechniques.com | http://www.hdrlabs.com - home of hdri knowledge

                  Comment


                  • #10
                    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 Holm | www.netronfilm.com

                    Comment


                    • #11
                      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.
                      Torgeir Holm | www.netronfilm.com

                      Comment


                      • #12
                        oops ..Torgeir, you are right ..i missed the 2nd part. sorry!
                        hehe, ok
                        Torgeir Holm | www.netronfilm.com

                        Comment


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

                          Christian, sorry for hijacking your thread
                          You can contact StudioGijs for 3D visualization and 3D modeling related services and on-site training.

                          Comment


                          • #14
                            sure!


                            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.
                            www.cgtechniques.com | http://www.hdrlabs.com - home of hdri knowledge

                            Comment


                            • #15
                              Here is a little update:


                              http://www.cgtechniques.com/goodies/doftoy/
                              www.cgtechniques.com | http://www.hdrlabs.com - home of hdri knowledge

                              Comment

                              Working...
                              X