A patch is a building block. You can build a full effect by connecting patches together in what's known as a graph. Each individual patch will control part of your effect.
Spark AR Studio includes a huge variety of patches. They can be used to create all kinds of effects, from changing the appearance of objects to adding interactivity.
This is what a patch looks like in Spark AR Studio:
When you create a patch, it will have a name. In the example above, the patch is called Loop Animation. You can rename some patches by double-clicking their name.
Patches have 'ports' - the small circles along the side of each patch.
Ports are labelled to show the behavior they can drive in the effect you're building. Ports can accept associated data types. You can set the data type in some patches by right-clicking the port and selecting an option from the Type menu.
You can adjust the values in some ports, but you can't change which ports a patch has.
Connections made between patches are read from left to right. This means the port on the right side of a patch is known as an output port, and the port on the left side is known as an input port.
For example, Loop Animation has 4 inputs:
It has 1 output port, Progress. This is a progress data type, which is a number with values 0 to 1, where 0 is the initial state and 1 is the completed state.
This graph uses producer, consumer and intermediary patches to create an effect that responds to the user's interaction. When a face with an open mouth is detected, the objects will appear in the effect.
Producers represent an object or material. You'll usually start building your graph with a producer patch. If you're not using the Patch Editor, you'll find these elements in the Scene tab.
Producer patches are purple in color. The Face Tracker patch - facetracker0 in this example - is a producer patch.
These patches take the information from the producer patch and manipulate it - depending on the type of intermediary patch you choose. They're grey in color.
In this example, Mouth Open is the intermediary patch. We've connected the Face output port on the facetracker1 patch to the Face input port on the Mouth Open patch. As a result, the Mouth Open patch will take information from facetracker0 to understand when the mouth is open.
Consumer patches represent the properties of an object. If you weren't using the Patch Editor, you'd use the Inspector panel to apply these properties to your object. They're blue in color, and will generally be the final patches in a graph.
In this example, pizzas_789, pizzas_456 and pizzas_123 are consumer patches. These patches control whether the objects are visible, because they represent the Visibility property for each object.
Because they're connected to the Mouth Open port in the Mouth Open patch, the objects will become visible when the mouth is open.
Asset patches represent an asset you've added to your project, for example an audio file or a texture. They're orange in color.
Asset patches can be inserted multiple times.
You can group patches to help organize your graph. You can also save patch groups to use again in other projects, and share with other creators. Find out more.