In this Tutorial we will be examining different operations that can be used to construct a procedural model of a texture or some form of geometric data.

Procedural techniques are a powerful way of defining some aspect of a computer-generated model through algorithms and/or mathematical functions. In contrast to using pre-existing data such as a static images or photographs, procedural models can generate visual complexity of arbitrary resolution and infinite variation. In conjunction with parametric controls, such models can be used to build a flexible interface for controlling complex behaviors and capturing a special effect.

Jitter provides a comprehensive set of basis functions and generators that are exposed through the jit.bfg object. Each function performs a point-wise operation in n-dimensional space whose evaluation is independent of neighboring results. This means that these operations can be performed on any number of dimensions, across any coordinate, without any need of referencing existing calculations. In addition, since they all share a common interface, these objects can be combined together and evaluated in a function graph by cross-referencing several jit.bfg objects.

There are several categories of functions, each of which are characterized by a different intended use. These categories include fractal, noise, filter, transfer, and distance operations. Functions contained in these folders can be passed by name to jit.bfg either fully qualified (category.classname) or relaxed (classname).

Before looking at these categories in detail, we'll first explore the general interface of jit.bfg and show how to create different types of procedural functions and fill a jit.matrix with our results.

Once the patch loads, take a look at the different objects being used. Notice that we have a metro object attached to the jit.bfg object. Once activated, a bang message will notify jit.bfg to evaluate and output a Jitter matrix just like most other Jitter objects. In this example, jit.bfg has been setup to generate a single plane matrix of type float32 and size 128x128.

• Click on the toggle box connected to the metro object to begin sending bang messages to jit.bfg.

Notice that the jit.pwindow object remains solid black in color! Since jit.bfg has not been told what basis function evaluate, jit.bfg is not outputting a matrix and jit.pwindow remains unchanged.

• Select the noise.cell basis function from the list in the umenu object.

An evaluated basis function.

Now that jit.bfg has been given a function to evaluate, we can see the results of its calculation in jit.pwindow. Internally, jit.bfg is generating a series of Cartesian coordinates that it passes to the indicated basis function during its evaluation.

If we wanted to, we could adjust these coordinates and have jit.bfg perform the evaluation over a different domain.

• Change the value of the number box connected to the scalemessage box.

• Select the distance.euclidean basis function from the list in the umenu object.

• Again change the value of the number box connected to the scalemessage box.

Notice that positive values in the scalenumber box have little effect on the results being shown in jit.pwindow, whereas negative values flip the image components from white to black. What is going on? Distance should always be positive and increase outward from the origin, right?

jit.normalize

The output of jit.bfg goes into a jit.normalize object connected to the jit.pwindow. This object will examine an incoming matrix and scale the minimum and maximum values into a normalized range of 0-1.

When we changed the scale values being sent to jit.bfg for evaluating the distance.euclidean function from positive to negative, the highest and lowest values that were being outputted from jit.bfg switched as we crossed over the origin. Since jit.normalize always scales the input matrix maximum to 1 and the minimum to 0, our colors flipped.

Since the output range of jit.bfg may yield extremely large results, especially when evaluating unbounded functions such as fractals, we need to normalize our output in order to map the results for display.

Basis Categories

Now that we are familiar with the basic interface for setting up jit.bfg and specifying a basis function to evaluate, let's examine the contents of each function category.

Distance Functions

The functions in the distance category each define a unique metric for determining the positional difference from a given point to the global origin.

Descriptions of each of these functions are provided in the following list.

• chebychev: Absolute maximum difference between two points.

• euclidean: True straight line distance in Euclidean space.

• euclidean.squared: Squared Euclidean distance.

• manhattan: Rectilinear distance measured along axes at right angles.

• manhattan.radial: Manhattan distance with radius fall-off control.

• minkovsky: Exponentially controlled distance.

The noise.voronoi object requires one of thesedistance objects to be specified as part of its evaluation.

Filter Functions

The filter category contains signal processing filters which can be used to perform image sampling and reconstruction or to create pre-computed kernels for a general convolution.

Descriptions of each of these functions are provided in the following list.

These transfer functions can be used inside of several of the noise objects to change their smoothing function and/or alter their output.

Noise Functions

Deterministic stochastic patterns (aka pseudo-random coherent noise functions) are the cornerstone of nearly every procedural model. They allow a controllable amount of complexity to be created by adding visual detail.

A brief description of these functions is contained in the list below.

Notice the effect of the transform. Also notice the drop in performance when a rotation is performed – we will always get better frame rates if the rotation attribute is left at 0 for each matrix dimension.

Technical Detail: In addition to the internal coordinate generation already described, jit.bfg also accepts an input matrix of coordinates to evaluate (XYZ map to planes 0-2, and the input matrix must be the same dim as the jit.bfg output matrix).

• Change the 1stnumber box connected to rotation to 0 to disable rotation.

As mentioned previously, all of the basis functions that Jitter provides can be evaluated over any number of dimensions. This message has changed our output matrix to be a 3D matrix, and has correspondingly set the evaluation to be performed in 3-dimensional space. Since our display is still a 2D screen, we only need to evaluate a single slice in 3D, and thus our 3rd dim is set to 1.

Notice how the planes separate and become more visible as the align amount gets larger.

• To see more specific examples for different combinations of basis functions, open the help patch for the jit.bfg object and look in the subpatchers for each category of function..

Technical Detail: The output of jit.bfg can actually be used as an input to another jit.bfg to perform domain distortion, similar to the way noise.distorted operates. Check out the example patch in jit-examples/other/jit.bfg.distorter.pat.

Summary

The jit.bfg object gives us access to a library of procedural basis functions and generators that we can use to define a procedural model for creating textures and modifying geometry. Internally jit.bfg generates Cartesian coordinates along a grid. These coordinates can be transformed using the corresponding origin, offset, and rotation attributes, or overridden altogether via an input matrix containing evaluation coordinates.