POV-Ray : Newsgroups : povray.general : What would it take to get focal blur fixed? : Re: What would it take to get focal blur fixed? Server Time
31 Jul 2024 20:18:51 EDT (-0400)
  Re: What would it take to get focal blur fixed?  
From: Christoph Hormann
Date: 24 Sep 2006 03:50:03
Message: <ef5d2h$jr0$1@chho.imagico.de>
dkleckner wrote:
> I noticed recently that focal blur has difficulty dealing with thin objects
> which are out of focus, producing artifacts regardless of the number of
> blur_samples and confidence/variance values.  To see a simple example of
> this, render the following code:

The current focal blur code has special handling for low number of 
samples (up to 37).  It could well be that the distribution of the 
additional samples and/or the jittering of the samples is suboptimal.

> 
> Even worse, turning the number of blur samples down can actually make it
> look better.  The artifact seems to realize it self exactly at blur_samples
> 19 (try 18 and 19, and compare!).  I had a look at the source code, at it
> seems to happen because of some strange hexagon-shaped grid which is used
> to decide on the points from which to shoot rays to calculate the focal
> blur.  (There is also a comment in there indicating "this should probably
> be changed!")

The comment is actually misleading - the hexagonal grid is used in all 
cases.

> It seems to me that it would be _very_ easy to rewrite this code, using a
> monte-carlo (i.e. random) approach to determine where in the aperature to
> send rays from.

No, the claim that it would be very easy to redesign the focal blur is 
quite baseless (actually it may be not but the claim to redesign it to a 
reliable and efficient solution is).

There has already been a patch made to allow custom sample grids:

http://pov.monde.free.fr/mael/mlpov083eng.html

but note this is still based on the same concept as the original system. 
    And there has actually been only very limited interest in having 
this added to MegaPOV of official POV-Ray.

> 
> I'd do all of this myself, as it wouldn't take long, but even figuring out
> how to get the source code to compile seems like a major project. 

Building POV-Ray is not more difficult than downloading

http://www.povray.org/redirect/www.povray.org/ftp/pub/povray/Official/Linux/povlinux-3.6.tgz

and calling configure && make.  And yes, this is also possible on 
Windows, provided that you have a POSIX emulation layer like Cygwin 
installed.

You should feel invited to try improving the focal blur but i would 
suggest you don't assume this to be very easy and rush into it since 
this will most likely result in a patch hardly usable in production code.

A final note: while it can be tempting to create a focal blur function 
that cross-uses samples among several pixels this would be pretty 
useless for multithreaded rendering in POV-Ray 3.7 (unless you add a 
thread-safe ray caching system which would be quite complicated).

Christoph

-- 
POV-Ray tutorials, include files, Landscape of the week:
http://www.imagico.de/ (Last updated 20 Aug. 2006)
MegaPOV with mechanics simulation: http://megapov.inetart.net/


Post a reply to this message

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