POV-Ray : Newsgroups : povray.binaries.images : Focal blur tricks Server Time
2 Aug 2024 00:14:09 EDT (-0400)
  Focal blur tricks (Message 1 to 10 of 22)  
Goto Latest 10 Messages Next 10 Messages >>>
From: triple r
Subject: Focal blur tricks
Date: 22 Feb 2008 18:15:00
Message: <web.47bf5650425b71eaae42298f0@news.povray.org>
Just a test rendering of my trick to achieve a nice bokeh effect with a
non-square aperture.  Unfortunately the light pixels in the focal plane are an
artifact of the technique.  I think it would require a direct patch into
POV-Ray to fix the problem.  Can you guess how it's done?  Hint: the answer is
in the image.  Another hint: apparently I've misunderstood the 'no_reflection'
keyword.

 - Ricky


Post a reply to this message


Attachments:
Download 'fbtest.jpg' (40 KB)

Preview of image 'fbtest.jpg'
fbtest.jpg


 

From: nemesis
Subject: Re: Focal blur tricks
Date: 22 Feb 2008 19:35:01
Message: <web.47bf6a25806ad5e45676ec960@news.povray.org>
"triple_r" <rre### [at] hotmailcom> wrote:
> Just a test rendering of my trick to achieve a nice bokeh effect with a
> non-square aperture.  Unfortunately the light pixels in the focal plane are an
> artifact of the technique.  I think it would require a direct patch into
> POV-Ray to fix the problem.

still, looks damn good to me!  I love the stylish look of focal blur and the
bokeh in the highlights only makes it more amazing.  It's incredible how the
old dog can still learn new tricks using nothing but the builtin scripting
language...

> Can you guess how it's done?

yes, you posted the URL for the original 2005 post in another thread.  Post it
again. :)

I think POV-Ray has been getting back some of its shine back:  3.7 nearing
completion, path tracing patch in the works by fidos, an official PovRay Object
Collection started by the community, isosurface tesselation to polygons macro
rewritten by TOK, this amazing little focal trick that could go into a macro in
the Object Collection and also another patch by delles adding some cool lighting
models other than phong and IES lighting!

even Jaime Vives Piqueres has started povving again! :D

I hope to see all these efforts getting together in a near future release of
povray... perhaps POV-Ray 3.7.1? :)


Post a reply to this message

From: triple r
Subject: Re: Focal blur tricks
Date: 22 Feb 2008 20:10:01
Message: <web.47bf71df806ad5e4ae42298f0@news.povray.org>
"nemesis" <nam### [at] gmailcom> wrote:
> still, looks damn good to me!  I love the stylish look of focal blur and the
> bokeh in the highlights only makes it more amazing.  It's incredible how the
> old dog can still learn new tricks using nothing but the builtin scripting
> language...

Problem is: if, for example, the first twenty rays make it through the aperture
and hit a spot approximately in the focal plane, the variance plummets and it
moves on prematurely to the next pixel.  Here are the approximate focal blur
settings.  Now please tell me what I should have done to reduce the render time
by about two orders of magnitude...

blur_samples 3000
confidence 0.99999
variance 1/10000000000

Ouch.  Rendering now with 6000 samples and a couple more repeated digits on the
end...  I'd don't want to set them to one and zero since that would prevent any
bailout, but I kept adding zeros and the artifacts kept getting better, but not
going away.

> > Can you guess how it's done?
> yes, you posted the URL for the original 2005 post in another thread.  Post it
> again. :)



> I think POV-Ray has been getting back some of its shine back:

And it looks like someone did receive and post the SSS code from Sarah Tariq,
but I don't know what would need to be done to make use of that.  I've never
actually delved into the POV source code, but maybe it's time to start.

 - Ricky


Post a reply to this message

From: triple r
Subject: Re: Focal blur tricks
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

From: Nicolas Alvarez
Subject: Re: Focal blur tricks
Date: 22 Feb 2008 22:44:15
Message: <47bf968f@news.povray.org>

> 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
> }
> 

Could you post the complete source for your image on the original post? 
With the colored spheres.


Post a reply to this message

From: triple r
Subject: Re: Focal blur tricks
Date: 22 Feb 2008 23:40:00
Message: <web.47bfa2bb806ad5e4ae42298f0@news.povray.org>
Nicolas Alvarez <nic### [at] gmailisthebestcom> wrote:
>
> Could you post the complete source for your image on the original post?
> With the colored spheres.

No problem.  See p.t.sf.

Or if you're feeling adventurous:

I've never gone beyond opening up the source code and deciding it's pretty
complicated, but it took about ten minutes to patch this into POV-Ray, at least
for circular apertures.  At ~line 650 in render.cpp, all you have to do is
select new random points until (x*x+y*y)<1.0.  Custom bokeh could be easily
loaded from an image and sampled randomly.  There's some details I may have
neglected about 37 samples on a hex grid or something, but it seems like
someone who knows what they're doing could patch a circular_aperture keyword
into the syntax in a matter of minutes.  Much like circular for area_lights.
I'll post an image in a little bit showing the utility of such a command.  Very
nice effect, although slow to render.  Perhaps adaptive sampling, something like
AA, could be used to locate the bright spots and send more samples there.
You'll notice in these images that the bokeh are just below a comfortable noise
threshold, but the rest of the scene is extremely oversampled.  That fix might
not be so easy, but if it could be accomplished, would make the focal_blur much
more powerful.

 - Ricky


Post a reply to this message

From: Nicolas Alvarez
Subject: Re: Focal blur tricks
Date: 23 Feb 2008 10:33:35
Message: <47c03ccf$1@news.povray.org>

> Nicolas Alvarez <nic### [at] gmailisthebestcom> wrote:
>> Could you post the complete source for your image on the original post?
>> With the colored spheres.
> 
> No problem.  See p.t.sf.

Thanks. I rendered the source you posted on this thread, with 3000 
samples, confidence 0.99999 and variance 0.00001. And colored spheres :P 
Took four hours. I'll attach it to the *next* message.

> I've never gone beyond opening up the source code and deciding it's pretty
> complicated, but it took about ten minutes to patch this into POV-Ray, at least
> for circular apertures.  At ~line 650 in render.cpp, all you have to do is
> select new random points until (x*x+y*y)<1.0.  Custom bokeh could be easily
> loaded from an image and sampled randomly.  There's some details I may have
> neglected about 37 samples on a hex grid or something, but it seems like
> someone who knows what they're doing could patch a circular_aperture keyword
> into the syntax in a matter of minutes.  Much like circular for area_lights.
> I'll post an image in a little bit showing the utility of such a command.  Very
> nice effect, although slow to render.  Perhaps adaptive sampling, something like
> AA, could be used to locate the bright spots and send more samples there.
> You'll notice in these images that the bokeh are just below a comfortable noise
> threshold, but the rest of the scene is extremely oversampled.  That fix might
> not be so easy, but if it could be accomplished, would make the focal_blur much
> more powerful.

Well I don't think I would attempt it either :) Last time I looked at 
the code, I saw focal blur code was scattered all over POV instead of 
self-contained somewhere... But maybe that was just me.


Post a reply to this message

From: Nicolas Alvarez
Subject: Re: Focal blur tricks
Date: 23 Feb 2008 10:38:30
Message: <47c03df6@news.povray.org>

> I rendered the source you posted on this thread, with 3000 
> samples, confidence 0.99999 and variance 0.00001. And colored spheres :P 
> Took four hours. I'll attach it to the *next* message.

Attaching image.


Post a reply to this message


Attachments:
Download 'focal_blur.png' (182 KB)

Preview of image 'focal_blur.png'
focal_blur.png


 

From: triple r
Subject: Re: Focal blur tricks
Date: 23 Feb 2008 10:55:01
Message: <web.47c04192806ad5e4ae42298f0@news.povray.org>
Nicolas Alvarez <nic### [at] gmailisthebestcom> wrote:

>
> Well I don't think I would attempt it either :) Last time I looked at
> the code, I saw focal blur code was scattered all over POV instead of
> self-contained somewhere... But maybe that was just me.

Turns out it's all right around lines 600-650 in render.cpp.  It's really no so
much a patch as it is a hack, but with minimal effort I've managed to load in a
grayscale image for the aperture.  There's no SDL interface for it, but it does
work without these dirty SDL tricks.  Much easier to control.  I'll post
results when the renders are done.  Turns out the best thing you can do for
render speed is prevent your computer from going to sleep after fifteen
minutes.

 - Ricky


Post a reply to this message

From: triple r
Subject: Re: Focal blur tricks
Date: 23 Feb 2008 14:10:01
Message: <web.47c06ed1806ad5e4ae42298f0@news.povray.org>
"triple_r" <rre### [at] hotmailcom> wrote:
> I think it would require a direct patch into
> POV-Ray to fix the problem.

So with very little effort, here's the result of my patched POV.  It's hardly
fair to call it that since it's only a couple lines and there's no SDL
interface for it.  It just reads a grayscale ppm file and varies the density of
the sample grid according to the image.  You can even tell the difference
without the strong highlights which makes me wonder why the default is a square
aperture.  Not quite sure when that would be preferable, but maybe people don't
use strong focal blur too often.

 - Ricky


Post a reply to this message


Attachments:
Download 'fbtests.jpg' (138 KB)

Preview of image 'fbtests.jpg'
fbtests.jpg


 

Goto Latest 10 Messages Next 10 Messages >>>

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