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.
AR Studio has several different types of patches. This is what a patch looks like in 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.
Change the name of producer patches by double-clicking their default name.
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.
In the example below 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. They're blue in color, and will generally be the final patches in a graph.
If you weren't using the Patch Editor, you'd use the Inspector panel to apply these properties to your object.
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.
Change the name of consumer patches by double-clicking their default name.
Asset patches represent an asset you've added to your effect, for example an audio file or a texture. They're orange in color.
Asset patches can be inserted multiple times.
Change the name of asset patches by double-clicking their default name.
You can group patches to help organize your graph. Select the patches you want to group, right-click and select Group.
The input and output ports of a Group patch define the input and output for the whole group. You can create them by:
Capture a tap anywhere on the screen.
Capture a tap on an object in the scene.
Capture head rotation, using data from a face tracker in the scene.
Capture a head nod, using data from a face tracker in the scene.
Capture a head shake, using data from a face tracker in the scene.
Capture an opened mouth, using data from a face tracker in the scene.
Capture blinked eyes, using data from a face tracker in the scene.
Capture raised eyebrows, using data from a face tracker in the scene.
Capture lowered eyebrows, using data from a face tracker in the scene.
Left Eye Closed
Determine when the left eye is closed, using data from a face tracker in the scene.
Right Eye Closed
Determine when the right eye is closed, using data from a face tracker in the scene.
Detect a smile, using data from a face tracker in the scene.
Animate an element in your scene.
Animate an element in your scene repeatedly.
Convert a progress value to a value between a new range defined by the start and end values.
Convert a progress value to a value between a new range defined by the start and end values. Progress output is used to chain multiple transitions.
Map scalar values to progress values.
Flip a boolean from true to false, or from false to true.
Check if 2 booleans are true together.
Check if either one of 2 booleans are true.
Check if 2 numbers are equal.
Greater Than or Equal To
Check if one input value is greater than or equal to another.
Check if one value is greater than another.
Less Than or Equal To
Check if one value is less than or equal to another.
Check if one value is less than another.
Create a point with 3 dimensions (X, Y and Z).
Turn a point into its individual X, Y and Z values.
Trigger a pulse whenever a state changes from on to off or vice versa.
Control up to 5 states using an index (0, 1, 2...). This is useful for tracking a state that is one of many options. By default, the output is 0.
Create a counter that starts at 0, where the value can be increased or decreased gradually, or set to a specific number.
Math patches can be used to perform a math operation on their input.
Adds 2 values.
Multiplies 2 values.
Subtracts 2 values.
Divides 2 values.
Negates the value.
Rounds down the value.
Rounds up the value.
Calculates the sine of the given argument.
Calculates the cosine of the given argument.
Calculates the tangent of the given argument.
Calculates the arcsine of the given argument.
Calculates the arccosine of the given argument.
Calculates the arctangent of the given arguments.
Calculates the natural exponentiation of the given argument.
Calculates the natural logarithmn of the given argument.
Calculates the value of the first parameter raised to the power of the second.
Calculates division remainder for the given values.
Rounds the value according to the specified rounding mode.
Returns the absolute value of the argument.
Extracts the sign of the value.
Returns the lesser of two values.
Returns the greater of two values.
Constrains a value to lie between two given bounds.
Linearly interpolates between two values modulated by Alpha.
Generates a step function by comparing two values.
Performs Hermite interpolation between two values.
Calculates the square root of the value.
Maps the given value from the specified range to the [0, 1] range.
Maps the given value from the [0, 1] range to the specified range.
The patches in the table above will apply the operation separately on each component of the input.
So, if the input is Vector2 with the values
(3.1,4.7), and we used the Round patch, the outputs will be (3, 5).
This also applies if there are two inputs. If you have an input of
(1,6) and we use the Add patch, the outputs will be
The input types must be compatible, for example you can't have an input of Vector2 and input of Vector3 connected to the same Add patch.
If you want to use a number and another input, for example Vector2, AR Studio will automatically expand the number to the corresponding input. So, if you have an input of
(5,7) and the number 2 in an Add patch, the output would be
Calculates the dot product of two vectors.
Calculates the cross product of two vectors.
Calculates the distance between two points.
Calculates the length of a Vector.
Calculates the unit vector in the same direction as the original vector.
Calculates the reflection direction for an incident vector.