Wikipedia includes the following as an explanation for recursion. “In order to understand recursion, one must first understand recursion.” But we’re going to try and explain it here anyway. Recursive IO connections in the context of a MSG preset means that a given input Stream for a processor is also used as the output Stream.
Oftentimes this kind of connection is not unusual and is what you would want to do when editing a MSG preset. Many MSG processors work in a pixel by pixel fashion and could really care less whether their IO connections are recursive or not. However, some specific MSG processors that implement geometric transformations will generate radically different output images depending on whether their io connections are recursive or not. When used with these specific MSG processors recursive io connections can lead to a kind of visual feedback being created in the visual output from the processor as seen in the example image below.
Image created using recursive io connections in a MSG preset.
Again, recursive io connectctiomeans that the same image stream used for an input is also used for an output. If a particular processor works with color images then this would mean the same 3 image streams used for the color image input would also be used as the output streams if the io connections were recursive.
The image above was created with a MSG preset with recursive io connections. The image is visually interesting, so sometimes you might actually want recursive io connections in a particular preset depending on what you are trying to achieve visually.
But you need to be aware that the nature of the visual distortion introduced by the recursive io connections is often very difficult to control, and may radically change as the processed image size or aspect ratio changes. The visual distortion can also be dependent on the number of processors in your computer.
The horizontal banding seen in the image above is actually created by an interaction between the recursive io connections and the geometric transformations being threaded to run different parts of the canvas in parallel on multiple cpus. If you want consistent visual output for a particular msg preset that is not dependent on the number of cpus or canvas size then you should avoid using recursive io connections in your presets.
MSG IO Editing
Let’s take a look at a simple MSG preset that uses a processor that performs a geometric transformation and is recursive io sensitive. The particular processor we will use is the 3CKaleido processor which generates a kaleidoscopic warp effect.
The screen snap below shows a non-recursive io connection for the 3CKaleido processor. Note that different image streams are used for the input and output stream connections.
This next screen snap shows an edited version of this particular preset where the 3CKaleido processor’s io connections have been edited to be recursive connections.
Note that the MSG preview image for the preset has changed radically and now exhibits a vertical banding. This is true even though none of the editable parameters associated with the processor have been changed. Note that there are 8 different vertical bands, which corresponds to the fact that this preview was created on a pro-tower computer with 8 internal processors. If i had run the same preset on a 2 cpu computer there would only be 2 bands.
Even if the recursive preset was run on a single processor the visual output would be very different from the non-recursive version of the preset. To understand why this is the case you need to think though what is happening in a processor that implements some kind of geometric transformation. What this means is that an output pixel at a given spatial position in the image may be coming from a completely different spatial position in the input image.
If different image stream buffers are used for the input and output than this transformation spatial mapping will always be consistent. But when the same image stream buffer is used for both the input and the output then the geometric transformation may be referencing previously processed output pixels or unprocessed input pixels depending on what area of the recursively connected image stream is being referenced as processing progresses.
And if the canvas has been split into bands and threaded to multiple cpu for parallel processing then what could be happening visually gets even more elaborate. Not all recursive io sensitive processors will display banding artifacts. It depends on the nature of the particular processor and whether it is internally threaded on multiple cps or not.
There is a useful command link shown above that is available in the MSG Evolve Commands help called ‘Fix Recursion Problems’ that when executed will try and intelligently automatically remove any recursive io connections in the MSG presets in the Evolution grid.
Threading and Recursive Visual Effects
As mentioned above, some MSG processors that thread or split their internal processing across multiple cpu cores can generate dramatically different visual output when used with recursive IO connections. Processors that perform warp or geometric distortions are one example of the kind of processor that shows this kind of threading behavior.
Sometimes the visual banding leads to amazing visual effects and is just what you want for your MSG output. But other times it would be nice to turn off threading so as to not have visual banding artifacts in the MSG output.
Studio Artist 4 included a new MSG preference option called MSG Threading that can be used to control MSG processor threading.
The optimal setting means that the optimal number of processor cores will be used to run threaded MSG operations. So a 2 processor machine would split 2 threads for a threaded processor, an 8 cour machine would split 8 threads for a threaded processor, etc. These 2 hypothetical situations would generate a 2 or 8 horizontal banded output image respectively when used with recursive io connections.
The off setting turns off MSG threading. So if you use this setting your MSG presets will run slower since multiple threads will not be spun off to speed up processing. But any banding artifacts due to recursive processing will be removed.
The image below shows an abstract procedural image created with MSG processors using recursive io connections and threading turned on with the optimal setting on an 8 processor computer.
The image below uses the same MSG preset as the image above but was generated with the MSG Threading preference set to off.
Note that the non threaded image doesn’t have any horizontal banding and shows off the wild visual patterning caused by the recursive processing. Whether it makes sense to use threading or not for a given recursive io connection MSG preset depends on your own personal tastes and what you are trying to achieve in a given MSG effect.
If you do turn off MSG threading, make sure to reset it to the optimal setting when you are finished with your recursive processing. In general you want threading turned on since a given processor that uses threading will speed up approximately Nx times on a N processor computer.