[Bf-committers] compositor defocus node

Lars Krueger lars_e_krueger at gmx.de
Sat Oct 23 12:49:46 CEST 2010

> Hi Lars,
> I have read the document, but it is really into using defocus in games. 
> Perhaps a feature request for BGE  :).  They do some tricks that will 

Where is the problem with having an algo from a game in the Blender renderer? It only means they thought about getting it fast enough for real-time. I fail to see what is bad with fast code in the Blender renderer. If you're worried about having CUDA in the renderer, I guess there isn't much to it to rewrite it in plain C. Won't be real-time anymore, though.

> become visible when using this during compositing. Some parts I have 
> already thought about (like slicing) but I don't think we can implement 
> a speedy single node whit good quality that will be capable of handling 
> all types of usages.

If by "tricks", you mean the approximation of the Circle of Confusion (CoC) by different blurred images and interpolating, then yes, this approximation of the real CoC behaviour might show. Nobody says anything about using 2 or 3 samples only. This could be a parameter trading memory vs. quality, like Blender already has a few.

In practice the CoC radius approaches a limit on either side of the in-focus depth. Depending how good the approximation is, this can look unnatural or very natural. The 2.4 node had a maximum blur radius, IIRC. If one uses this as well here, with a max of 10 pixels CoC radius and a sample for every 2 pixels, we have something like 5 RGBA images memory consumption. This is quite a bit, but defocus is expensive anyway.

Regarding speedy implementation: Gaussian filters are separable and can be implemented as such. Google for SKIP-SM. In addition, Gaussian filters can be implemented either by blurring an already blurred image more or with a different kernel size applied to the original image. The latter lends itself very well to multithreading.
Dr. Lars Krueger

Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief!  
Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail

More information about the Bf-committers mailing list