POV-Ray : Newsgroups : povray.binaries.scene-files : 35mm Camera Macros Server Time
26 Apr 2024 07:20:41 EDT (-0400)
  35mm Camera Macros (Message 1 to 7 of 7)  
From: Edouard
Subject: 35mm Camera Macros
Date: 15 Mar 2009 22:20:00
Message: <web.49bdb54b20f77e74506891550@news.povray.org>
Hi all.

Here is version 1.0 of my camera macros.

35mm Camera Macros Version 1.0
==============================

The 35mm Camera macros were created to allow POV users to place
cameras in their scenes with the properties of a standard 35mm film
(or full frame digital) camera.

The user can specify the lens (e.g. 50mm or 300mm) and the focal
ratio (e.g. f/1.4 or f/8), and the macros set the field of view and
amount of focal blur to approximate the effect seen in the real world.

The user can specify the focal plane in several ways:
  - Setting it to the look_at point
  - Specifying a seperate point in space that is in focus
  - Specifying a distance to the focal plane
  - Allowing the camera to autofocus on an object
  - Setting the camera to the maximal hyperfocal point

Multiple options can be set, such as the standard samples, variance and
confidence of POVs focal blur, as well as other options like the
circle of confusion for the hyperfocal calculations, the autofocus
samples and tightness, etc.

There is also a "stochastic" mode that allows the user to render
multiple frames (via the animation clock settings). The passes can
then be composited together later to produce an image with focal
blur. This mode turns POV's built-in focal blur off completely.

There are also two debugging variables that can be set to show
the focal plane, and the autofocus samples respectively.

Finally these macros output some detailed information about
the cameras being use.



Camera Macros
-------------

Camera35mm( cam_pos, look_pos, focal_length, fstop )

    Creates a camera with the focal plane at the same point as the
    "look_pos" point.

    Related Options:
        Camera35mm_SetFocalSamples( num_samples )
        Camera35mm_SetFocalVariance( variance )
        Camera35mm_SetFocalConfidence( confidence )


Camera35mm_Point( cam_pos, look_pos, focal_pos, focal_length, fstop )

    Creates a camera with the focal plane at the same distance as
    the "focal_pos" point.

    Related Options:
        Camera35mm_SetFocalSamples( num_samples )
        Camera35mm_SetFocalVariance( variance )
        Camera35mm_SetFocalConfidence( confidence )

Camera35mm_Distance( cam_pos, look_pos, focal_distance, focal_length, fstop )

    Creates a camera with the focal plane set at "focal_distance"
    from the camera.

    Related Options:
        Camera35mm_SetFocalSamples( num_samples )
        Camera35mm_SetFocalVariance( variance )
        Camera35mm_SetFocalConfidence( confidence )

Camera35mm_Hyperfocal( cam_pos, look_pos, focal_length, fstop )

    Creates a camera with focal plane set to the maximal
    hyperfocal distance (i.e. such that infinity is the
    furthest distance to still be considered in focus).

    Related Options:
        Camera35mm_SetCircleOfConfusion( coc_size )
        Camera35mm_SetFocalSamples( num_samples )
        Camera35mm_SetFocalVariance( variance )
        Camera35mm_SetFocalConfidence( confidence )


Camera35mm_Autofocus( cam_pos, look_pos, focal_length, fstop, obj )

    Creates a camera with the focal plane set by shooting test
    rays at the object "obj".

    The object needs to be declared and passed to the
    macro, as follows:

    #declare ball = sphere { 0, 20 pigment { rgb <1,0,0> } };
    object { ball }
    Camera35mm_Autofocus( cam_pos, look_pos, 50, 2.8, ball )

    Related Options:
        Camera35mm_SetAutofocusTightness( fraction_of_screen )
        Camera35mm_SetAutofocusSamples( num_samples )
        Camera35mm_SetFocalSamples( num_samples )
        Camera35mm_SetFocalVariance( variance )
        Camera35mm_SetFocalConfidence( confidence )


Camera35mm_NoBlur( cam_pos, look_pos, focal_length, fstop )

    Creates a camera with focal blur turned off. Useful for
    setting up or testing a scene.



Camera Modes
------------

By deault, the camera macros all use POV's built-in focal blur, but
the mode can be changed to use a stochastic rendering technique
that renders multiple images (via the animation clock settings)
that can later be composited together to give a scene with focal
blur.

Camera35mm_SetStochasticMode()

    Turns the stochastic rendering mode on (instead of POV's built-in
    focal blur).

    Related Options:
        Camera35mm_SetIrisImage( iris_image_png_filename )


Camera35mm_SetPovFocalBlurMode()

    Turns on POV's built-in focal blur mode.
    This is the default setting.



Camera Options
--------------

The following options may be set by the user

    Camera35mm_SetFocalSamples( n )

        Set the number of focal blur samples as per the standard
        POV camera feature.


    Camera35mm_SetFocalVariance( n )

        Sets the focal blur variance as per the standard
        POV camera feature.


    Camera35mm_SetFocalConfidence( n )

        Sets the focal blur confidence as per the standard
        POV camera featue.


    Camera35mm_SetFocalParameters( n_samples, n_variance, n_confidence )

        Sets the samples, variance and confidence all in one call.


    Camera35mm_SetIrisImage( s )

        Sets the iris image used for setting up each pass of the
        stochastic render rig.

        The image file has to be a grayscale PNG file currently.

        The system has a built-in iris image that is used if
        this macro isn't called.


    Camera35mm_SetCircleOfConfusion( n )

        Sets the circle of confusion for use in the hpyerfocal
        macro.


    Camera35mm_SetAutofocusSamples( n )

        Sets the number of samples shot into the scene to determine
        the optimal focal distance given an test object.

        The default value is 500.


    Camera35mm_SetAutofocusTightness( n )

        Sets the tightness of the autofocus area. 1.0 means use a
        circle the width of the image, 0.5 is half the image, and
        0.1 is 10% of the image. The circle is always centered
        in the image.

        The default value is 0.7.

        Wider values might be helped by using more samples, and
        narrower values could use less samples.



Debugging Variables
-------------------

There are two variables that can be set to debug a scene:

Camera35mm_DebugFocalPlane

    Draws a partially transparent plane through the focal plane.


Camera35mm_DebugAutofocus

    Draws spheres at every position where an autofocus sample
    hit the object being focused on.

    The sphere are purple, except for the one choosen to focus on,
    which is green.



Example Output
--------------

Autofocus Debug Output:
 Number of hits = 77 (out of 500)
 Autofocus tightness = 0.70
 Autofocus on = <14.769, 256.538, -37.084> (distance 1263.750mm)

35mm Camera Debug Output:
 Focal Length is 50mm
 Focal Ratio is f/1.4
 Focal Distance is 1259.1mm
 Field of View is 39.6 degrees

 Sensor size is 36mm by 18mm
 Sensor size is 700 by 350 (pixels)
 Circle of confusion is 0.051mm

 Hyperfocal distance is 34772.2mm
 Near Focus is 1216.7mm
 Far Focus is 1304.5mm
 Total distance in focus is 87.80mm
 In front of focal plane 42.37mm (48.3%)
 Behind focal plane 45.43mm (51.7%)

Focal Blur Debug Output:
 Focal blur samples is 37
 Focal blur variance is (Default)
 Focal blur confidence is (Default)


Post a reply to this message


Attachments:
Download 'camera35mm.inc.txt' (17 KB)

From: clipka
Subject: Re: 35mm Camera Macros
Date: 16 Mar 2009 10:30:01
Message: <web.49be6206c78d62d789022530@news.povray.org>
Judging from first glance, this may be one of the best-documented POV macro sets
ever. Chapeau!


Post a reply to this message

From: Edouard
Subject: Re: 35mm Camera Macros
Date: 17 Mar 2009 23:15:01
Message: <web.49c06625c78d62d7617fb3dd0@news.povray.org>
"clipka" <nomail@nomail> wrote:
> Judging from first glance, this may be one of the best-documented POV macro sets
> ever. Chapeau!

Thank-you!


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: 35mm Camera Macros
Date: 18 Mar 2009 17:19:22
Message: <49c1655a@news.povray.org>
Hi Edouard.

This looks like some good, useful and thoroughly made macros.

But you should avoid using lowercase single characters as
variable names in your code. They are reserved for future use
in POV-Ray. (They may get special meanings in later POV-Ray
versions.)

-- 
Tor Olav
http://subcube.com


Post a reply to this message

From: fls13
Subject: Re: 35mm Camera Macros
Date: 20 Dec 2009 15:00:01
Message: <web.4b2e821cc78d62d7234595d50@news.povray.org>
How do you use this in a scene file? It looks very interesting.


Post a reply to this message

From: Stephen
Subject: Re: 35mm Camera Macros
Date: 26 Jun 2018 11:06:40
Message: <5b325680$1@news.povray.org>
Bump post

On 16/03/2009 02:16, Edouard wrote:
> Hi all.
> 
> Here is version 1.0 of my camera macros.
> 
> 35mm Camera Macros Version 1.0
> ==============================
> 
> The 35mm Camera macros were created to allow POV users to place
> cameras in their scenes with the properties of a standard 35mm film
> (or full frame digital) camera.
> 
> The user can specify the lens (e.g. 50mm or 300mm) and the focal
> ratio (e.g. f/1.4 or f/8), and the macros set the field of view and
> amount of focal blur to approximate the effect seen in the real world.
> 
> The user can specify the focal plane in several ways:
>    - Setting it to the look_at point
>    - Specifying a seperate point in space that is in focus
>    - Specifying a distance to the focal plane
>    - Allowing the camera to autofocus on an object
>    - Setting the camera to the maximal hyperfocal point
> 
> Multiple options can be set, such as the standard samples, variance and
> confidence of POVs focal blur, as well as other options like the
> circle of confusion for the hyperfocal calculations, the autofocus
> samples and tightness, etc.
> 
> There is also a "stochastic" mode that allows the user to render
> multiple frames (via the animation clock settings). The passes can
> then be composited together later to produce an image with focal
> blur. This mode turns POV's built-in focal blur off completely.
> 
> There are also two debugging variables that can be set to show
> the focal plane, and the autofocus samples respectively.
> 
> Finally these macros output some detailed information about
> the cameras being use.
> 
> 
> 
> Camera Macros
> -------------
> 
> Camera35mm( cam_pos, look_pos, focal_length, fstop )
> 
>      Creates a camera with the focal plane at the same point as the
>      "look_pos" point.
> 
>      Related Options:
>          Camera35mm_SetFocalSamples( num_samples )
>          Camera35mm_SetFocalVariance( variance )
>          Camera35mm_SetFocalConfidence( confidence )
> 
> 
> Camera35mm_Point( cam_pos, look_pos, focal_pos, focal_length, fstop )
> 
>      Creates a camera with the focal plane at the same distance as
>      the "focal_pos" point.
> 
>      Related Options:
>          Camera35mm_SetFocalSamples( num_samples )
>          Camera35mm_SetFocalVariance( variance )
>          Camera35mm_SetFocalConfidence( confidence )
> 
> Camera35mm_Distance( cam_pos, look_pos, focal_distance, focal_length, fstop )
> 
>      Creates a camera with the focal plane set at "focal_distance"
>      from the camera.
> 
>      Related Options:
>          Camera35mm_SetFocalSamples( num_samples )
>          Camera35mm_SetFocalVariance( variance )
>          Camera35mm_SetFocalConfidence( confidence )
> 
> Camera35mm_Hyperfocal( cam_pos, look_pos, focal_length, fstop )
> 
>      Creates a camera with focal plane set to the maximal
>      hyperfocal distance (i.e. such that infinity is the
>      furthest distance to still be considered in focus).
> 
>      Related Options:
>          Camera35mm_SetCircleOfConfusion( coc_size )
>          Camera35mm_SetFocalSamples( num_samples )
>          Camera35mm_SetFocalVariance( variance )
>          Camera35mm_SetFocalConfidence( confidence )
> 
> 
> Camera35mm_Autofocus( cam_pos, look_pos, focal_length, fstop, obj )
> 
>      Creates a camera with the focal plane set by shooting test
>      rays at the object "obj".
> 
>      The object needs to be declared and passed to the
>      macro, as follows:
> 
>      #declare ball = sphere { 0, 20 pigment { rgb <1,0,0> } };
>      object { ball }
>      Camera35mm_Autofocus( cam_pos, look_pos, 50, 2.8, ball )
> 
>      Related Options:
>          Camera35mm_SetAutofocusTightness( fraction_of_screen )
>          Camera35mm_SetAutofocusSamples( num_samples )
>          Camera35mm_SetFocalSamples( num_samples )
>          Camera35mm_SetFocalVariance( variance )
>          Camera35mm_SetFocalConfidence( confidence )
> 
> 
> Camera35mm_NoBlur( cam_pos, look_pos, focal_length, fstop )
> 
>      Creates a camera with focal blur turned off. Useful for
>      setting up or testing a scene.
> 
> 
> 
> Camera Modes
> ------------
> 
> By deault, the camera macros all use POV's built-in focal blur, but
> the mode can be changed to use a stochastic rendering technique
> that renders multiple images (via the animation clock settings)
> that can later be composited together to give a scene with focal
> blur.
> 
> Camera35mm_SetStochasticMode()
> 
>      Turns the stochastic rendering mode on (instead of POV's built-in
>      focal blur).
> 
>      Related Options:
>          Camera35mm_SetIrisImage( iris_image_png_filename )
> 
> 
> Camera35mm_SetPovFocalBlurMode()
> 
>      Turns on POV's built-in focal blur mode.
>      This is the default setting.
> 
> 
> 
> Camera Options
> --------------
> 
> The following options may be set by the user
> 
>      Camera35mm_SetFocalSamples( n )
> 
>          Set the number of focal blur samples as per the standard
>          POV camera feature.
> 
> 
>      Camera35mm_SetFocalVariance( n )
> 
>          Sets the focal blur variance as per the standard
>          POV camera feature.
> 
> 
>      Camera35mm_SetFocalConfidence( n )
> 
>          Sets the focal blur confidence as per the standard
>          POV camera featue.
> 
> 
>      Camera35mm_SetFocalParameters( n_samples, n_variance, n_confidence )
> 
>          Sets the samples, variance and confidence all in one call.
> 
> 
>      Camera35mm_SetIrisImage( s )
> 
>          Sets the iris image used for setting up each pass of the
>          stochastic render rig.
> 
>          The image file has to be a grayscale PNG file currently.
> 
>          The system has a built-in iris image that is used if
>          this macro isn't called.
> 
> 
>      Camera35mm_SetCircleOfConfusion( n )
> 
>          Sets the circle of confusion for use in the hpyerfocal
>          macro.
> 
> 
>      Camera35mm_SetAutofocusSamples( n )
> 
>          Sets the number of samples shot into the scene to determine
>          the optimal focal distance given an test object.
> 
>          The default value is 500.
> 
> 
>      Camera35mm_SetAutofocusTightness( n )
> 
>          Sets the tightness of the autofocus area. 1.0 means use a
>          circle the width of the image, 0.5 is half the image, and
>          0.1 is 10% of the image. The circle is always centered
>          in the image.
> 
>          The default value is 0.7.
> 
>          Wider values might be helped by using more samples, and
>          narrower values could use less samples.
> 
> 
> 
> Debugging Variables
> -------------------
> 
> There are two variables that can be set to debug a scene:
> 
> Camera35mm_DebugFocalPlane
> 
>      Draws a partially transparent plane through the focal plane.
> 
> 
> Camera35mm_DebugAutofocus
> 
>      Draws spheres at every position where an autofocus sample
>      hit the object being focused on.
> 
>      The sphere are purple, except for the one choosen to focus on,
>      which is green.
> 
> 
> 
> Example Output
> --------------
> 
> Autofocus Debug Output:
>   Number of hits = 77 (out of 500)
>   Autofocus tightness = 0.70
>   Autofocus on = <14.769, 256.538, -37.084> (distance 1263.750mm)
> 
> 35mm Camera Debug Output:
>   Focal Length is 50mm
>   Focal Ratio is f/1.4
>   Focal Distance is 1259.1mm
>   Field of View is 39.6 degrees
> 
>   Sensor size is 36mm by 18mm
>   Sensor size is 700 by 350 (pixels)
>   Circle of confusion is 0.051mm
> 
>   Hyperfocal distance is 34772.2mm
>   Near Focus is 1216.7mm
>   Far Focus is 1304.5mm
>   Total distance in focus is 87.80mm
>   In front of focal plane 42.37mm (48.3%)
>   Behind focal plane 45.43mm (51.7%)
> 
> Focal Blur Debug Output:
>   Focal blur samples is 37
>   Focal blur variance is (Default)
>   Focal blur confidence is (Default)
> 
> 


-- 

Regards
     Stephen


Post a reply to this message

From: Mike Horvath
Subject: Re: 35mm Camera Macros
Date: 19 Jul 2018 20:34:18
Message: <5b512e0a$1@news.povray.org>
On 6/26/2018 11:06 AM, Stephen wrote:
> Bump post
> 
> On 16/03/2009 02:16, Edouard wrote:
>> Hi all.
>>
>> Here is version 1.0 of my camera macros.
>>
>> 35mm Camera Macros Version 1.0
>> ==============================
>>
>> The 35mm Camera macros were created to allow POV users to place
>> cameras in their scenes with the properties of a standard 35mm film
>> (or full frame digital) camera.
>>
>> The user can specify the lens (e.g. 50mm or 300mm) and the focal
>> ratio (e.g. f/1.4 or f/8), and the macros set the field of view and
>> amount of focal blur to approximate the effect seen in the real world.
>>
>> The user can specify the focal plane in several ways:





>>
>> Multiple options can be set, such as the standard samples, variance and
>> confidence of POVs focal blur, as well as other options like the
>> circle of confusion for the hyperfocal calculations, the autofocus
>> samples and tightness, etc.
>>
>> There is also a "stochastic" mode that allows the user to render
>> multiple frames (via the animation clock settings). The passes can
>> then be composited together later to produce an image with focal
>> blur. This mode turns POV's built-in focal blur off completely.
>>
>> There are also two debugging variables that can be set to show
>> the focal plane, and the autofocus samples respectively.
>>
>> Finally these macros output some detailed information about
>> the cameras being use.
>>
>>
>>
>> Camera Macros
>> -------------
>>
>> Camera35mm( cam_pos, look_pos, focal_length, fstop )
>>


>>




>>
>>
>> Camera35mm_Point( cam_pos, look_pos, focal_pos, focal_length, fstop )
>>


>>




>>
>> Camera35mm_Distance( cam_pos, look_pos, focal_distance, focal_length, 
>> fstop )
>>


>>




>>
>> Camera35mm_Hyperfocal( cam_pos, look_pos, focal_length, fstop )
>>



>>





>>
>>
>> Camera35mm_Autofocus( cam_pos, look_pos, focal_length, fstop, obj )
>>


>>


>>



>>






>>
>>
>> Camera35mm_NoBlur( cam_pos, look_pos, focal_length, fstop )
>>


>>
>>
>>
>> Camera Modes
>> ------------
>>
>> By deault, the camera macros all use POV's built-in focal blur, but
>> the mode can be changed to use a stochastic rendering technique
>> that renders multiple images (via the animation clock settings)
>> that can later be composited together to give a scene with focal
>> blur.
>>
>> Camera35mm_SetStochasticMode()
>>


>>


>>
>>
>> Camera35mm_SetPovFocalBlurMode()
>>


>>
>>
>>
>> Camera Options
>> --------------
>>
>> The following options may be set by the user
>>

>>


>>
>>

>>


>>
>>

>>


>>
>>

>>

>>
>>

>>


>>

>>


>>
>>

>>


>>
>>

>>


>>

>>
>>

>>




>>

>>


>>
>>
>>
>> Debugging Variables
>> -------------------
>>
>> There are two variables that can be set to debug a scene:
>>
>> Camera35mm_DebugFocalPlane
>>

>>
>>
>> Camera35mm_DebugAutofocus
>>


>>


>>
>>
>>
>> Example Output
>> --------------
>>
>> Autofocus Debug Output:



>>
>> 35mm Camera Debug Output:




>>



>>






>>
>> Focal Blur Debug Output:



>>
>>
> 
> 


Could the author please upload the macros to the Object Collection?


Mike


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.