Quickstart
This is a quick reference guide to how to get started defocussing using MagicDefocus2. It will contain links to more detailed descriptions, however, this should get you far enough to make some pretty images!
Also good to know, each knob in the node has a tooltip included. If you ever need some information, just hover the knob.
If you're looking for technical explanations, the Detailed page contains that. If you're searching something but don't know where to find it? The search bar can probably find it for you.
We'll go through the different tabs and their purposes.
Interface difference between MagicDefocus1 and MagicDefocus2
If you're already used to the original MagicDefocus1 node, this will be almost identical.
Node inputs
If you create the MagicDefocus2 node, you'll notice 3 inputs.
- image: this is the input image that you want to defocus. If you want to defocus deep, just connect a deep input here! Just be aware, deep is always much more heavy to process ( Deep).
- filter (optional): this is a bokeh kernel/filter that you want to use for applying the defocus
- cam (optional): use this camera input to apply an optically accurate defocus according to the camera settings ( Camera Input)
Defocus tab
The defocus tab is responsible for having the defocus settings, applying focus, setting sizes, setting modes, etc.
When you open the node, you will see the main a.k.a. defocus tab. See the image below:
The most important options are:
- mode: the mode to apply the defocus. Either 2D, depth or camera
- math: only when performing depth based defocus, define the type of depth map being used. ( Depth math)
- size: the size of the defocus in pixels.
- focus plane (C): define the point of focus, comparable to focussing on a real lens.
- maximum: when using depth, this will define the maximum defocus value ( Defocus size).
These controls are made as similar as possible to existing tools, to make it easy to adapt it in your workflow.
Quality
This is a new feature that makes MagicDefocus2 incredibly fast. It allows you to make quick adjustments without slowing down the script too much.
Understand quality
You could compare it to a sample setting in a ScanlineRender node for example.
Lots of motion increase samples :Large bokehs increase quality
It is recommended to set the quality to medium or low during compositing work. When sending it to a render farm, it will render in high quality automatically.



Defocussing our first image
Bokeh tab
MagicDefocus2 includes an easy to use and extended bokeh tab. Allowing you to create any bokeh you'd like.
You can find the settings under the tab Bokeh
.
Previewing the bokeh creation
Easiest is to select the preview filter
checkbox and directly see what the bokeh is you are creating.
Filter type
The filter type defines the shape creation. You can select disc for a circle. Bladed is selected by default and sets the bokeh in a shape similar to the \(f\)-stop blades.
The other option is image, and will be automatically selected if you connect the filter input to an image. This image can be any size.
Custom image input bounding box
It is important that the filter input bounding box is cropped to the region of the bokeh, as this defines the sampling patttern for the defocus result, which improves quality massively.
Bladed
When bladed is selected, the blades will be defined by the blades
knob. The sharpness is defined by the curvature
knob. Setting a value to 1 will make it entirely circular. Setting the value to 0 will make the corners sharp.


Creating the bokeh
Best way to get started with the bokeh creation tab is to just play around with the sliders. You can see a gif here doing that exactly and showing how fast you can create something unique.
Non uniform
The non-uniform tab is responsible for any effects that are unique depending on their depth and position on screen. This can be a cutting, cropping, scaling, etc. effect.
This is where it gets really fun. There are now more effects than ever, including effects that were technically not possible at all before.
For a detailed technical explanations about these effects, like how they occur physically, I'd refer you to the Non uniform page.
An overview of the tab
Each effect has its own section. Pressing the enable checkbox will make it possible to make adjustments to the specific non uniform feature.
Fast non uniform
Compared to the original MagicDefocus1, there is no enable non-uniform knob anymore.
This is because there is no speed difference between using non uniform and not using it. As the non-uniform processing is now encapsulated within the defocus core source code and thus no longer being a post-process.
Catseye
Catseye is an effect that cuts the bokeh by itself depending on the position. It is not visible in the center, but most visible in the edges.
Barndoors
Barndoorns is an effect that occurs when light is blocked by a barndoor/flare. This is attached to the lens itself.
With MagicDefocus2 all sides can be controlled uniquely.
Astigmatism
Bokehs can appear stretched at the corners, this is called Astigmatism in lens terms (note: eye astigmatism is something different).
Axial aberration
Axial aberration is affected by light rays not entering the lens the same way depending on the focus distance. Instead of regular chromatic aberration that shifts the edges of the image, this is on a bokeh level.


It is also possible to change the color combination. All the options are:
- red/blue
- green/purple
- blue/yellow
Inverse bokeh shape in foreground
This effect is enabled by default. In this image an arrow shapes kernel is used. Notice how the arrow points up in the background and down in the foreground. This is caused by light rays traversing once they've hit the sensor. This is present on all lenses/cameras.


Non uniform stacking
All the effects can be combined, this allows you to create some really unique and optical results.
Inverse non uniform in foreground
This is another new feature, which is optically accurate. This is a technical story so the explanation can be found on the Inverse foreground. However, in simple terms it means the light rays inverse in the foreground with respect to the background.
What happens visually, is the following:

