Polarith AI
1.8
Layer Blending

Using the parameter LayerBlending not only increases the number of possible behaviour combinations, it also improves the control over how behaviours can be combined. This might be especially crucial when you want to combine single behaviours to create something like boids, flocks and herds.

Instead of writing objective values directly, a behaviour using Layer Blending writes all results to an intermediate buffer. Then, in an extra step, these intermediate values are applied to the existing context values. With Layer Blending, you can define the operator which is used to apply these intermediate values. The following different types are available.

Layer Blending Type Description
None Layer Blending is deactivated. All behaviour results are written directly.
AssignGreater Overwrites the existing value only if the new value is greater.
AssignLesser Overwrites the existing value only if the new value is lesser.
Addition Adds the new value to the existing value.
Subtraction Subtracts the new value from the existing value.
Multiplication Multiplies the new value with the existing value.
Division Divides the existing value by the new value. The special case that a new value might be 0 is handled properly.

Note that most of the operations are not commutative, as its known from mathematics. Subtraction, Division and Assign Greater respectively Assign Lesser strongly depend on the Order of the used behaviours.

In combination with Layer Normalization, Layer Blending can be compared to the layer systems known from image processing tools like GIMP or Photoshop. Think of our objective magnitude values as grey values which are created through perception, whereby the receptor count of the sensor defines the resolution. The brighter the grey value, the more a receptor senses. Value Writing defines how these grey values are generated in a single layer. Now, we have a couple of pixel layers which we want to combine. The Layer Blending then specifies how these individual layers are finally combined.

The following figures show some examples. First, a sample calculation and second, an example configuration showing the intermediate results of each behaviour.

Figure 1: The top table shows an example without layer blending. The objective values are written directly to the context. The bottom table shows a similar example, but this time, different Layer Blending types are applied.

Figure 2: A graphical example for using Layer Blending. In both cases, the agent has got two behaviours and the combined effect is shown from left to right (0: Seek, 1: Seek, Avoid). The Value Writing type is the same for both agents, Seek: Addition, Avoid: Assign Greater. Since the Seek uses Addition, at state 1, we can see that it overshadows the Avoid in the top example. The bottom example uses Layer Blending with Seek multiplied to Avoid. The result is that Avoid emphasizes the optimal trajectory instead of just pointing orthogonal to the danger. Awesome!

Remarks

If layer blending is set to None, no extra data is allocated. The system works exactly as in older versions of our plugin where every behaviour wrote directly to the context.

Using Layer Blending also has an effect on the Value Writing. When writing to an intermediate, the objective values has to be initialized somehow. This is done with the neutral element of the operation. That means, for Multiplication and Division, the intermediate values are initialized with 1 for each receptor, and 0 for all the other operations.

Using Layer Blending also enables a unique Layer Normalization option called Intermediate as well.

Imprint