POV-Ray : Newsgroups : povray.binaries.images : 35mm Camera Macros Posted on p.b.s-f Server Time
8 May 2024 10:58:45 EDT (-0400)
  35mm Camera Macros Posted on p.b.s-f (Message 1 to 10 of 11)  
Goto Latest 10 Messages Next 1 Messages >>>
From: Edouard
Subject: 35mm Camera Macros Posted on p.b.s-f
Date: 15 Mar 2009 22:25:01
Message: <web.49bdb7856146d6d9506891550@news.povray.org>
Hi all.

I've posted version 1.0 of my 35m Camera Macros on povray.binaries.scene-files.

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_macros.jpg' (226 KB)

Preview of image 'camera35mm_macros.jpg'
camera35mm_macros.jpg


 

From: Carlo C 
Subject: Re: 35mm Camera Macros Posted on p.b.s-f
Date: 17 Mar 2009 12:30:01
Message: <web.49bfcf3f46c91751e341a7c40@news.povray.org>
"Edouard" <pov### [at] edouardinfo> wrote:
> Hi all.
>
> I've posted version 1.0 of my 35m Camera Macros on povray.binaries.scene-files.
>

Excellent explanation,
excellent code-syntax,
excellent everything!
For a beginner like me, here there is much to study!
;-)

--
Carlo


Post a reply to this message

From: sooperFoX
Subject: Re: 35mm Camera Macros Posted on p.b.s-f
Date: 17 Mar 2009 12:40:00
Message: <web.49bfd15c46c917513e3c08aa0@news.povray.org>
"Edouard" <pov### [at] edouardinfo> wrote:
> Hi all.
>
> I've posted version 1.0 of my 35m Camera Macros on povray.binaries.scene-files.

Hi Edouard,

Thanks a bunch for your macros, they seem to work very well... once you change
line 458 from

Camera35mm_Point( cam_pos, look_pos, percentile25_focus_point, lens, f_ratio )

to

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


Cheers

- sooperFoX


Post a reply to this message

From: Edouard
Subject: Re: 35mm Camera Macros Posted on p.b.s-f
Date: 17 Mar 2009 23:20:00
Message: <web.49c0683446c91751617fb3dd0@news.povray.org>
"Carlo C." <nomail@nomail> wrote:
> "Edouard" <pov### [at] edouardinfo> wrote:
> > Hi all.
> >
> > I've posted version 1.0 of my 35m Camera Macros on povray.binaries.scene-files.
> >
>
> Excellent explanation,
> excellent code-syntax,
> excellent everything!
> For a beginner like me, here there is much to study!
> ;-)
>
> --
> Carlo

Thank-you very much - I decided to put the extra effort in to get it to the
state where I was happy to make it public, and I think it's come out OK.
Hopefully people may find it useful.

Cheers,
Edouard.


Post a reply to this message

From: Edouard
Subject: Re: 35mm Camera Macros Posted on p.b.s-f
Date: 17 Mar 2009 23:25:01
Message: <web.49c068b946c91751617fb3dd0@news.povray.org>
"sooperFoX" <bon### [at] gmailcom> wrote:
> "Edouard" <pov### [at] edouardinfo> wrote:
> > Hi all.
> >
> > I've posted version 1.0 of my 35m Camera Macros on povray.binaries.scene-files.
>
> Hi Edouard,
>
> Thanks a bunch for your macros, they seem to work very well... once you change
> line 458 from
>
> Camera35mm_Point( cam_pos, look_pos, percentile25_focus_point, lens, f_ratio )
>
> to
>
> Camera35mm_Point( cam_pos, look_pos, percentile25_focus_point, focal_length,
> fstop )
>
>
> Cheers
>
> - sooperFoX

Arrgh! Bugs!

Thank-you for pointing out that error - I think it was masked in my testing by
the fact that I #declaring f_ratio in my main .pov file, and so the macro
didn't throw an error, and the test scene rendered correctly for me...

Cheers,
Edouard.


Post a reply to this message

From: Kenneth
Subject: Re: 35mm Camera Macros Posted on p.b.s-f
Date: 18 Mar 2009 03:00:00
Message: <web.49c09b4f46c91751f50167bc0@news.povray.org>
"Edouard" <pov### [at] edouardinfo> wrote:
> Hi all.
>
> I've posted version 1.0 of my 35m Camera Macros on povray.binaries.scene-files.

Thanks for your tireless effort with this (and for getting it into such nice
form.)  I'll definitely be checking it out.

Ken W.


Post a reply to this message

From: Thomas de Groot
Subject: Re: 35mm Camera Macros Posted on p.b.s-f
Date: 18 Mar 2009 04:32:47
Message: <49c0b1af$1@news.povray.org>
"Edouard" <pov### [at] edouardinfo> schreef in bericht 
news:web.49c068b946c91751617fb3dd0@news.povray.org...
>
> Arrgh! Bugs!
>
> Thank-you for pointing out that error - I think it was masked in my 
> testing by
> the fact that I #declaring f_ratio in my main .pov file, and so the macro
> didn't throw an error, and the test scene rendered correctly for me...
>

<grin> got that too!
Excellent set of macros, Edouard! Thanks for giving us the joy of RL 
photography in POV-Ray.

Thomas


Post a reply to this message

From: sooperFoX
Subject: Re: 35mm Camera Macros Posted on p.b.s-f
Date: 18 Mar 2009 06:15:01
Message: <web.49c0c8bc46c917513e3c08aa0@news.povray.org>
"Edouard" <pov### [at] edouardinfo> wrote:
> Arrgh! Bugs!
>
> Thank-you for pointing out that error - I think it was masked in my testing by
> the fact that I #declaring f_ratio in my main .pov file, and so the macro
> didn't throw an error, and the test scene rendered correctly for me...

Yes, that makes sense.

All your macro needs now is a way to set the relative scale, in case the rest of
the scene was not modeled with 1 pov-unit = 1mm. This would help a lot with
'dropping in' the macro to existing scenes that were not written with that in
mind. For example, many of the sample scenes that come with POV!

Something like Camera35mm_SetUnitsPerMM(0.1) or Camera35mm_SetMMPerUnit(10), for
a scene where 1 pov-unit = 1cm. I can't say I completely understand the lens
maths involved with your macro so I'm not sure how feasible this would be.

Anyway, thanks again for a really useful macro!

- sooperFoX


Post a reply to this message

From: Carlo C 
Subject: Re: 35mm Camera Macros Posted on p.b.s-f
Date: 18 Mar 2009 11:40:00
Message: <web.49c115c346c91751961ca5200@news.povray.org>
Maybe I ask too much...
....But, Edouard, I have many difficulties to understand the use of *Stochastic
Rendering Technique*.
If you have a little free time, we would be grateful if you show us a short
pov-example of this rendering technique.
:-)

--
Carlo


Post a reply to this message

From: Edouard
Subject: Re: 35mm Camera Macros Posted on p.b.s-f
Date: 18 Mar 2009 19:55:01
Message: <web.49c188cd46c91751617fb3dd0@news.povray.org>
Just playing with the same basic test scene:

Changed to a new lightprobe (one I shot a couple of evenings ago). 16 lights
from LightMapGen, plus one hand placed one (the sun).

The ajax bust was processed by Samuel Benge's fastprox macro (with the mesh
patch), and the resulting proximity colour used in a pigment_patten (with some
noise and slope) to select different types of bronze textures.

50mm lens at f/8, with autofocus on the Ajax bust.

Cheers,
Edouard.


Post a reply to this message


Attachments:
Download 'sunset-test-render-2.jpg' (215 KB)

Preview of image 'sunset-test-render-2.jpg'
sunset-test-render-2.jpg


 

Goto Latest 10 Messages Next 1 Messages >>>

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