Joe Maller: FXScript Reference: Building Joe's NoiseHow I used FXScript to build my Noise filter for Final Cut Pro. |
|||||||||||
Visit the New FXScript Reference and Joe's Filters sites. These pages will be phased out soon and may already be out of date. This page describes the FXScript concepts behind Joe's Noise. If you're looking for the page about how to use the filter, click here. OverviewJoe's Noise adds several features to a conventional noise filter. Because noise is generated into an image buffer, it can be processed before compositing back into the image. Also, this filter saves processing time by creating the noise image buffer at specific size needed for later scaling. Tiny Little Image BuffersInstead of creating and processing another full-sized image buffer for noise, the script creates a smaller image buffer with the specific dimensions needed to fill the full-sized image after scaling. I sort of lucked into the math on this one even though it's simple when broken down and examined (x/y * y/x = 1). The custom-sized image buffer
Because the Random as I wanna beFXScript's noise pattern can be the same on every frame, or it can change on every frame. This is controlled by the RandomSeed function. When RandomSeed is set to zero, a new random set is generated for each frame, when it's set to anything other than zero, the same random set is generated for each frame. RandomSeed is also explained in Building Joe's Pixelizer.
Since checkboxes return either zero or one, feeding that value directly into RandomSeed determines whether the noise will be fixed or change on every frame. Make Some NoiseThe amount of noise visible in the final image is determined by the alpha channel values fed into the RandomNoise function. The function has two inputs for each image channel, a minimum and a maximum. Even though the values are labeled this way, they are interchangeable and simply define a range in either direction. At values below 100, the script uses the value as a percentage of 255 and reduces the range of visible noise by creating an alpha channel between black and varying shades of gray. At values above 100, the minimum is increased and the alpha channel is created with values between varying shades of gray and white. A noise setting of 0 would result in a black alpha channel (completely transparent), a setting of 400 would result in a white alpha channel (completely opaque). Alpha channel results are illustrated below. Alpha channel of the noise image buffer at various amounts:
The effect is similar to adjusting output levels on the alpha channel. Below 100, output white is reduced; above 100, output black is increased. To control these values, I used two variables for the alpha minimum and maximum.
These two statements set different values depending on noiseamount. Above 100, only Amax varies; below 100, only amin varies. The variable The definition statement for These values are then plugged into the RandomNoise function along with the
Spanana Blit (?)I'm not clear on what sort of data is stored in a four item point array, but these are needed to store information about the image buffers for the BlitRect function. (I plan to create a four item point arrays value reporting filter at some point.) Two 4 value point arrays are declared at the beginning of the script:
These values are later filled with the BoundsOf function based on dest and scalebuffer. Remember that scalebuffer is sized based on the scaling value selected:
The The two variables
Unfortunately, there appears to be no way to control the interpolation used when scaling. Fade to Black (and white)The script doesn't use the monochrome option in RandomNoise because this option sends the same data to all four channels. The problem with this method is that matching the alpha channel to the color channels masks out all the white areas of noise. True monochrome noise lightens as much as darkens, so a different means of acquiring monochrome noise was devised. All monochrome images send the same data to all three color channels. Knowing this, a simple
Conclusion The script ends with my standard set of composite controls, combining the noise contained within The complete FXScript source code for Joe's Noise is included with the paid version of Joe's Filters. |
The FXScript ReferenceFXScripting Joe's FiltersJoe's Filters for Final Cut Pro Building Joe's Minimum Maximum Joe's FXScript ExplorersJoe's Debug and Explore Filters Joe's 3x3 Convolve Matrix Tester Joe's 3x3 Matrix Values Tester Other FCP Stuff
Film & VideoRecording the sound of PhotographyProjectsFinal Cut ProDesignWRITINGSite Notes Archive (weblog) Web ResourcesAbout Joe MallerPast Home Pages Etc.Search joemaller.comContact Me
|
||||||||||