Every patch in Spark AR Studio has one or more ports. Connecting these ports to other patches will send and receive data.
You can change the data types of some ports. To do this, right-click the patch and select a type from the menu.
When you draw a connection from an output port, Spark AR Studio will suggest patches that can be connected. If you try to connect ports with incompatible data types, you'll see an error message.
Data types are indicated by symbols or values shown on the patch.
At any point in time, a boolean signal is either true or false. For example, the Mouth Open port in the Mouth Open patch can tell whether a mouth is either open, or closed.
Ports with a boolean type have a small square next to them.
A scalar is a one-dimensional value. The Mouth Openness port in the Mouth Open patch has a scalar value because it reflects how open the mouth is. If a mouth is wide open the value might be 1, if it's half open it might be 0.5.
A pulse is an event that happens at some point in time. It's not a continuous signal like a boolean - which is always either true or false.
The Head Nod patch has a pulse type because a head nod is an event. Ports with a pulse type have a small square, with a circle in.
A 3D point is a three-dimensional signal that can represent a rotation, scale or position.
For example, a patch representing the position of a 3D object has a 3D Position port. This port has a 3D Point data type, because the object is positioned in 3D space.
You can tell this is a 3D Point data type because it has X, Y and Z values. In this example, these values will reflect where the object is positioned in the scene.
A 2D point is a two-dimensional signal that can represent a rotation, scale or position. Patches with a 2D point type have X and Y values.
This type represents the RGBA channels - Red, Green, Blue and Alpha. It's indicated by a circle with a color.
Progress is a scalar signal that's restricted to the 0-1 range. It could be used to drive an animation. Ports with progress types will be labelled Progress, like in the Animation patch.
VectorN is a multidimensional value consisting of N scalar components.
For example, you could use:
Vector2for 2D points and 2D texture coordinates.
Vector3for 3D points, 3D normals and 3-channel (RGB) color.
Vector4for 4D position and 4-channel (RGBA) color.
MatrixN represents a matrix of N by N scalar components.
For example, you could use:
Matrix2to represent a rotation transformation for 2D vectors.
Matrix3to represent a rotation transformation for 3D vectors or general affine transformation for 2D vectors with an additional homogeneous coordinate, which effectively makes them
Matrix4to represent a general affine transformation for 3D vectors with an additional homogeneous coordinate, which effectively makes them
Texture2D typically represents an image and can have 1 to 4 channels.
There are 4 different Texture2D types depending on the number of channels. These are
Texture2D_1chcorresponds to a gray-scale image.
Texture2D_3chcorresponds to a color image.
Texture2D_4chcorresponds to a color image with an additional alpha channel to control the transparency.
You can use a sampling patch to extract the pixel color within a texture, at a particular position.
Some data types are specific to Spark AR Studio. These ports can only be connected to other ports of the same type. For example, the Face port in the face tracker patch can only be connected to another Face port.