Camera F-stop correct conversion

Hello guys…

i´m need input correct (camera type) F-stop number on cycles camera, but aperture parameter do not correspond to real F-Stop camera number.

in real world little f-stop numbers cause more blur (smaller Depth range).
but in cycles camera is just the oposite!

What the formula (expression) to correct this on blender? (i do the correction on Softimage with a little expression on camera aperture value).

Thanks in advance.

Ok, again i found a solution myself… the formulation for this i wrote:
Apertures radius = (lens mm / aperture fstop) / 200 (200 is conversion from diameter to radius and meters at same time)

NEWBIE Question: so, how can i put this expression on parameter? (easy way!?)

thanks.

Wow,

Thanks again for the formula. I have always wondered how to use real f-stop values.
It is possible to modify the Cycles AddOn script to do the calculation automatically.

If you do this modification wrong your Cycles may not work any longer.(so make a backup of the scripts you alter.)

Navigate to the python code of the Cycles AddOn.
You need to modify two files. properties.py and ui.py.

In properties.py you are adding a new property that triggers a def when it’s value changes.
In ui.py you are displaying the new property that you have just added above.

In properties.py at approximately line #225 replace the class with this one.


class CyclesCameraSettings(bpy.types.PropertyGroup):
    @classmethod
     
    def register(cls):
            
        def updateFstop(self,context):
            # This def gets called when one of the properties changes state.
            lens_in_mm = 35.0
            self.aperture_size = (lens_in_mm / self.true_fstop) / 200  #(200 is conversion from diameter to radius and meters at same time)
       
        bpy.types.Camera.cycles = PointerProperty(
                name="Cycles Camera Settings",
                description="Cycles camera settings",
                type=cls,
                )

        cls.aperture_size = FloatProperty(
                name="Aperture Size",
                description="Radius of the aperture for depth of field",
                min=0.0, max=10.0,
                default=0.0,
                )
        cls.aperture_blades = IntProperty(
                name="Aperture Blades",
                description="Number of blades in aperture for polygonal bokeh (at least 3)",
                min=0, max=100,
                default=0,
                )
        cls.aperture_rotation = FloatProperty(
                name="Aperture Rotation",
                description="Rotation of blades in aperture",
                soft_min=-math.pi, soft_max=math.pi,
                subtype='ANGLE',
                default=0,
                )
        cls.true_fstop = FloatProperty(
                name="True F-Stop",
                description="Calculate aperture size based upon this true f-stop value.",
                min=0.01, max=10.0,
                default=5.6,
                update=updateFstop
                )

    @classmethod
    def unregister(cls):
        del bpy.types.Camera.cycles

In ui.py go to line # approximately 273 and add the new property from the class. Remember to make sure the indents match or a python error will occur and Cycles will not load at all.


sub.prop(ccam, "true_fstop", text="F-Stop")

If you do it right, however, you get a new property in the Cycles camera panel with a True F-stop value that calculates the aperture size when you change the f-stop.

NOTE: In this example I have hard coded the Lens to 35mm. Until I can figure out how to read the actual lens data in the updateFstop def this hard code will have to do.

Attachments


Finally someone to help trully!
Thanks man… Can we suggest it to become default to next release? (with our names credit) hahah :wink:
So, anyway now we need read lens actual value, let´s try?

I´m new to Blender, but i´m find very strange to not have a easy way to put a expression on parameter direcly… (on XSI is very very intuitive). But… if we need change the hidden code… let´s go… i´m in! :slight_smile:
Rod.

Oh, i just tested! The formula is correct and working! :wink:
Now let´s discover how to read lens value and put on equation…

Very thanks Atom! I will try to investigate how to do it… if you can too, very nice.
See you soon brother.
Rod.

NOTE: I´m photographer too.