- Development UI
- Standard Parameters
- Unique Parameters
- Data Structures
One of the hardest problem facing plug-in developers is designing effects that honor the native pixel aspect ratio of any source media fed to the plug-in by the host. All FxFactory plug-ins are based on Quartz Composer, which was not designed with video applications in mind. As such it always expects and generates images with a square pixel aspect ratio. The same goes for Core Image units, OpenGL shaders and any other computer graphics technology accessed through Quartz Composer.
Why is this a problem in the first place? Host applications feed images to plug-ins at their native size. For example, if your effect is used in a ProRes 1080i sequence, Final Cut Pro will feed you one field at a time. The field has resolution 1440×540. That is obviously quite different from its ultimate display size of 1920×1080. If your composition draws a circle inside that 1440×540 field, by the time your circle is scaled to the final display resolution you end up with a nasty-looking oval:
You draw this…
…the viewer sees this:
Different hosts behave differently. Motion and After Effects always field-double their images, so the same field from the same source media will be fed to the plug-in as a 1440×1080 image.
To make effects development as simple as it can be, FxFactory has always provided an easy way out. When you enable the options “Can only render fields at full frame resolution” and “Can only render fields/frames at square pixel aspect ratio” in the Renderer section, you are asking FxFactory: “Scale input/output images for me so that I don't have to worry about pixel-aspect ratio issues”:
The “easy way out” described above is still widely used by many FxFactory plug-ins, and there will always be reasons to continue using it in the future.
In earlier versions of FxFactory, those options were on by default on any new plug-in you created. The automatic scaling of images up/down done by FxFactory behind the scenes is the source of potential filtering artifacts. But before we talk about the problems, lets talk about the situations where it is (and always will) desirable and acceptable to use the easy way out:
When designing high-quality effects, the optional, automatic scaling performed by FxFactory will introduce unwanted filtering artifacts. These are worse with interlaced media than with progressive media, and they are worse in Final Cut Pro than in other hosts (due to the fact that Motion and After Effects always field-double their media). Moreover, it's easy to see how a plug-in that processes 1440×540 fields directly will be faster than an identical effect that is forced to process 1920×1080 images.
It's important to notice that if your plug-in does not render any geometry (e.g. a color correction filter) and does not use filters that rely on a geometric distance (such as a blur radius), you get a free pass. You can (must!) safely disable all Renderer options discussed earlier, and your plug-in will render faster and at higher-quality: no extra scaling operations are being done on your source media or on the output your composition generates.
You can test this problem very easily. Take a simple pass-through filter:
Enable the following Renderer properties:
This forces FxFactory to scale the input to square-pixels, and then the output from square-pixels, when your filter is applied.
Apply the newly created filter to the built-in Render > Grid generator in Final Cut Pro. Here is the original:
…and here is the same grid with the passthrough filter:
Notice the unwanted softness introduced by the filter because of the automatic scaling, even if you are not actually touching the pixels inside the composition.
There is no general approach to handling native pixel aspect ratio correctly. The most important step is actually understanding what's going on behind the scenes. Then, depending on the effect you are designing, one of the following techniques may be used:
Unfortunately, some of the stuff mentioned above can be very tricky to figure out, and it certainly comes in the way of FxFactory's goal of keeping things as simple as they can be. That's why FxFactory sports improved versions of built-in effects (Core Image units) that handle pixel aspect ratio.
The main difference between our versions and Apple's is that our units include an extra “Pixel Aspect Ratio” input. By virtue of doing that, we have created units that are capable of honoring non-square pixel aspect ratios.
Try creating, for example, a new filter in FxFactory. You'll notice that the composition you start with now looks like this:
Notice the NI Gaussian Blur unit that honors the media's pixel aspect ratio. You just need to feed it the Pixel Aspect Ratio of the source, which you do by mapping the corresponding Image Info Structure inside FxFactory. When testing inside Quartz Composer, you'll only see a pixel aspect ratio of 1, so you need to test the end result in the host to make sure the approach is working.