POV-Ray : Newsgroups : povray.binaries.images : 35mm Camera Macro : Re: 35mm Camera Macro Server Time
1 Aug 2024 00:18:20 EDT (-0400)
  Re: 35mm Camera Macro  
From: Edouard Poor
Date: 26 Feb 2009 15:30:00
Message: <web.49a6fb4055a0132ebd47b0730@news.povray.org>
"Thomas de Groot" <tDOTdegroot@interDOTnlANOTHERDOTnet> wrote:
> It is probably my misunderstanding of your macro, but I get weird results.
> In particular by just changing fstop, the camera seems to jump from inside
> one of the objects to outside. So, how do you define the parameters? just as
> in RL photography? i.e. focal_length is 50 or 105; fstop is 1.4 or 16?
>
> Thomas

Yes - it should work like that. Since the camera is declared in mm, the rest of
the scene has to be in mm as well. Or you can change the camera to be 0.05
meters if you scene is in meters of course.

fstop is 1.4 or 16 as you say.

One sort of limitation is that I've only got a camera and look_at position. The
focal plane goes through the look_at position, which made sense for me, but the
macro could be changed to have a separate focal point, or a focal distance.

Future plans:
  o Another macro to automatically focus at the hyperfocal distance
  o Take the image size into account for the "circle of confusion" (in the
hyperfocal case)
  o Auto-focus! Give the camera an object, and use trace() to focus on it
  o Also post my Stochastic Render Rig version of the same macro (just got to
tweak the AA values a bit more).

Here's the scene:

#include "transforms.inc"

#macro Camera35mm( cam_pos, look_pos, focal_length, fstop, num_samples )
 #local film_width = 35;
 #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 / focal_distance) * 1000  // Magic Number

  location cam_pos
  look_at look_pos
  angle fov
  right x * 1
  up y * image_height/image_width
 }
#end

#declare cam_pos = < 0, 150, -500 >;  // in mm
#declare look_pos = < 0, 50, 0 >;  // in mm

#declare lens = 50;  // mm
#declare f_ratio = 4;  // Aperture as f ratio
#declare num_samples = 19;  // 7, 19 & 37 happen to be hexagonal

Camera35mm( cam_pos, look_pos, lens, f_ratio, num_samples )

light_source {
 <10000,20000,-2000>
 rgb 1
}

sphere {
 0, 50
 pigment { rgb <0.2, 1, 0.2 > }
 finish { specular 1 roughness 0.001 reflection 0.5 }
 translate <66, 50, 100>
}

sphere {
 0, 50
 pigment { rgb <1, 0.2, 0.2 > }
 finish { specular 1 roughness 0.001 reflection 0.5 }
 translate <0, 50, 0>
}

sphere {
 0, 50
 pigment { rgb <0.2, 0.2, 1 > }
 finish { specular 1 roughness 0.001 reflection 0.5 }
 translate <-66, 50, -100>
}

plane {
 <0.0, 1.0, 0.0>, 0.0
 pigment {
  checker
  rgb <0.123, 0, 0.998>, rgb <0.107, 0.993, 0>
  scale 100  // every 10cm
 }
 finish {
  diffuse 0.6
 }
}

sky_sphere {
 pigment {
  gradient y
  color_map {
   // http://povray.tashcorp.net/tutorials/qd_realskysphere/
   [  0/269 color rgb <120/255, 79/255, 51/255>]
   [  1/269 color rgb <141/255, 83/255, 46/255>]
   [  2/269 color rgb <177/255, 86/255, 41/255>]
   [  3/269 color rgb <235/255,128/255, 72/255>]
   [  5/269 color rgb <255/255,159/255, 72/255>]
   [  8/269 color rgb <255/255,203/255, 94/255>]
   [ 10/269 color rgb <255/255,218/255,112/255>]
   [ 13/269 color rgb <255/255,233/255,148/255>]
   [ 15/269 color rgb <251/255,241/255,172/255>]
   [ 20/269 color rgb <255/255,246/255,203/255>]
   [ 30/269 color rgb <255/255,240/255,219/255>]
   [ 40/269 color rgb <236/255,223/255,214/255>]
   [ 50/269 color rgb <205/255,204/255,212/255>]
   [ 55/269 color rgb <185/255,190/255,209/255>]
   [ 60/269 color rgb <166/255,176/255,201/255>]
   [ 65/269 color rgb <149/255,163/255,190/255>]
   [ 70/269 color rgb <129/255,149/255,182/255>]
   [ 80/269 color rgb <103/255,127/255,171/255>]
   [ 90/269 color rgb < 79/255,110/255,154/255>]
   [100/269 color rgb < 66/255, 97/255,143/255>]
   [110/269 color rgb < 52/255, 84/255,131/255>]
   [120/269 color rgb < 47/255, 75/255,122/255>]
   [140/269 color rgb < 37/255, 60/255,102/255>]
   [160/269 color rgb < 32/255, 51/255, 84/255>]
   [180/269 color rgb < 27/255, 42/255, 71/255>]
   [200/269 color rgb < 25/255, 36/255, 58/255>]
   [220/269 color rgb < 22/255, 31/255, 48/255>]
   [240/269 color rgb < 18/255, 27/255, 42/255>]
   [260/269 color rgb < 15/255, 21/255, 33/255>]
   [269/269 color rgb < 15/255, 21/255, 33/255>]
  }
 }
}


Post a reply to this message

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