POV-Ray : Newsgroups : povray.binaries.images : Focal blur tricks : Re: Focal blur tricks Server Time
4 Nov 2024 22:20:39 EST (-0500)
  Re: Focal blur tricks  
From: triple r
Date: 22 Feb 2008 20:20:01
Message: <web.47bf742b806ad5e4ae42298f0@news.povray.org>
So in case you missed it, here's the summary.  No sense making you guess when
the answer's out.  POV-Ray distributes the focal blur samples on a rectangle at
the camera location.  This gives a rectangular aperture and rectangular bokeh.
To change this, you can either go into the code for the focal blur and alter
the points selected, or you can just block some points physically.  The code
below (ca. 2005) creates an aperture with curved blades.  It needs some
tweaking in the form of a matrix transformation and better controlled sizing,
but it does do the job.  Oh, and this will reduce the brightness of the scene
by about 20%.  You get what you pay for.

 - Ricky

background{rgb 0}
camera {
 perspective
 up y right x
 location <0,0,0>
 angle 48
 look_at <0,0,3>
 focal_point <0,0,-.5>
 aperture 0.35 //A little larger than the physical aperture
 blur_samples 800
}
light_source{<15,25,-25> rgb 0.5}
light_source{<30,2,-25> rgb 0.5}
light_source{<45,45,-0> rgb 0.5}

difference{
 box{<-5,-.0001,-5>,<5,.0001,5>}
 intersection{
  #declare curvature = 0.25;
  #declare blades = 5;
  #declare ang = 0;
  #while(ang < 360)
   cylinder{-y*0.001,y*0.001,1/curvature
   //intersection of circles form the aperture
   translate (1/curvature-1.0)*x
   rotate y*ang
   }
   #declare ang = ang+360/blades;
  #end
 }
 scale 0.07  //small
 rotate x*90 //in plane perp. to the camera
 translate z*.001 //and very close to the camera
}
union{
 sphere{<0,0,3>,1}
 sphere{<.015,.015,.529>,.02}
 sphere{<-.12,-.14,0.78>,.11}
 sphere{<-.12,.12,0.6>,.05}
 pigment{rgb 1} finish{diffuse .7 phong 50 phong_size 1100}
 //very strong, sharp phong for the effect
}


Post a reply to this message

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