|
|
"Edouard Poor" <pov### [at] edouardinfo> wrote:
> I wrote:
>
> > A simple macro I put together that approximates a 35mm camera in the scene.
>
> Updated macros - with a major bug fixed in the Camera35mm macro (I was putting
> the distance to the focal point in the calculation of the aperture - which was
> a hang over from my stochastic code, but completely wrong for the POV focal
> blur).
>
> I've also done a couple of Hyperfocal versions of the macro - one that takes the
> image sensor (i.e. the picture resolution) into account, and one that doesn't
> (and sets the circle of confusion to 0.03mm, which is roughly the right value
> for 35mm film).
>
> Any other additions people would like?
>
>
> #macro Camera35mm( cam_pos, look_pos, focal_length, fstop, num_samples )
> #local film_width = 36;
> #local fov = degrees( atan( (film_width / 2) / focal_length ) * 2 );
> #local apertureDiameter = focal_length / fstop;
> #local focal_distance = vlength( look_pos - cam_pos);
>
> camera {
> perspective
>
> focal_point look_pos
> blur_samples num_samples
> aperture (apertureDiameter ) * 2 // Magic Number
>
> location cam_pos
> look_at look_pos
> angle fov
> right x * 1
> up y * image_height/image_width
> }
> #end
>
> #macro HyperfocalCamera35mm( cam_pos, look_pos, focal_length, fstop, num_samples
> )
> #local film_width = 36;
> #local fov = degrees( atan( (film_width / 2) / focal_length ) * 2 );
> #local apertureDiameter = focal_length / fstop;
> #local look_distance = vlength( look_pos - cam_pos);
> #local circle_of_confusion = film_width / image_width;
> #local hyperfocal_distance = ((focal_length * focal_length) / (fstop *
> circle_of_confusion)) + focal_length;
> #debug concat( "Field of View is ", str( fov, 0, 1 ), " degrees\n" )
> #debug concat( "Circle of confusion is ", str( circle_of_confusion, 0, 2 ),
> "mm\n" )
> #debug concat( "Hyperfocal distance is ", str( hyperfocal_distance, 0, 0 ),
> "mm\n" )
> #debug concat( "Min distance in focus is ", str( hyperfocal_distance/2, 0, 0 ),
> "mm\n" )
>
> camera {
> perspective
>
> focal_point ((cam_pos - look_pos) / look_distance) * hyperfocal_distance
> blur_samples num_samples
> aperture (apertureDiameter) * 2 // Magic Number
>
> location cam_pos
> look_at look_pos
> angle fov
> right x * 1
> up y * image_height/image_width
> }
> #end
>
> #macro HyperfocalCamera35mm_fixed_circle_of_confusion( cam_pos, look_pos,
> focal_length, fstop, num_samples )
> #local film_width = 36;
> #local fov = degrees( atan( (film_width / 2) / focal_length ) * 2 );
> #local apertureDiameter = focal_length / fstop;
> #local look_distance = vlength( look_pos - cam_pos);
> #local circle_of_confusion = 0.03; // std circle of confusion for 35mm film
> #local hyperfocal_distance = ((focal_length * focal_length) / (fstop *
> circle_of_confusion)) + focal_length;
> #debug concat( "Field of View is ", str( fov, 0, 1 ), " degrees\n" )
> #debug concat( "Circle of confusion is ", str( circle_of_confusion, 0, 2 ),
> "mm\n" )
> #debug concat( "Hyperfocal distance is ", str( hyperfocal_distance, 0, 0 ),
> "mm\n" )
> #debug concat( "Min distance in focus is ", str( hyperfocal_distance/2, 0, 0 ),
> "mm\n" )
>
> camera {
> perspective
>
> focal_point ((cam_pos - look_pos) / look_distance) * hyperfocal_distance
> blur_samples num_samples
> aperture (apertureDiameter) * 2 // Magic Number
>
> location cam_pos
> look_at look_pos
> angle fov
> right x * 1
> up y * image_height/image_width
> }
> #end
hi,
you are doing a great job. but I have a question about the aperture.
> apertureDiameter = focal_length / fstop
(fot real camera this is 100 percent correct)
> aperture (apertureDiameter / focal_distance) * 1000
this is what I am looking for. but where did you get this formula? I look up
the Povray reference, hut there is no such a description. Can you tell me the
principle or theory?
thanks.
Ingwer
Post a reply to this message
|
|