Everything you need to know to create an interactive augmented reality experience.
Blocks allow you to save and export pieces of a project, so you can reuse them over and over again.
This can reduce repetition when working on AR effects. Simply create a block that includes the components you want to reuse, and add the block whenever you need it.
You can create a block for most things you need to repeat or reuse in Spark AR Studio. Combinations of scene objects, assets, patches, materials and texture settings are all supported.
We’ve also put together a step-by-step tutorial. You'll create a block that can be used to add a snowy effect to your scene.
To create a block:
The block will be listed in the Assets panel. When it's selected, you can rename it if you want to:
To build and edit block:
This will open the block in a new window, so you can make changes to it:
In the new window, the block will be listed in the Scene Panel as Block Root. Simply add the objects and assets you want to include in the block, as a child of Block Root.
When you save a block, it will automatically update in all projects that use the block.
The quickest way to add a block to your scene is to simply click and drag it from the Asset Panel to the Scene Panel. Alternatively:
The block will be listed in both the Scene Panel and the Assets Panel:
Below, we've added a block to the Scene Panel. We've used it to create an effect with a particle system that looks like snow:
In the Scene Panel, Snow is the instance of the Block. You'd use the options under Inputs in the Inspector to customize how the block behaves in the effect. In the Asset Panel, Snow is the master block.
You can instantiate the same block more than once.
Learn how we made this block.
Inputs and outputs pass information to and from blocks, into your projects. You'll use them to set default values for the block's properties, allowing you to customize the block.
Supported data types for inputs and outputs are:
To create an input or output, make sure the block is open, by right-clicking on the box in the Assets Panel and selecting Edit. Then:
You can change the name, type and default value of the input or output;
Alternatively, you can create input and output ports using Patches in the Patch Editor.
Use inputs to customize your patch graph inside a block:
Alternatively, drag the block scene object from the Scene Panel into the Patch Editor.
Use outputs to pass information from the block, into your project. For example, to a patch outside the block.
In the opened block, select Block Root in the Scene Panel, then click the arrow next to the Output in the Inspector. A consumer patch will be created:
All the inputs you've added to a Block will be listed under Inputs in the Inspector, when you select the block in the Scene Panel:
You can change the values of the inputs in the Inspector, to change how the block behaves in your effect. Or, click the arrow next to the input to create a consumer patch, that can be connected to the rest of your graph:
You can also drag the block from the Scene Panel into the Patch Editor.
Once you've defined the outputs of the block, drag it from the Scene Panel into the Patch Editor to create a patch:
You can set the values of inputs and get the values of outputs in a script by using the methods of the
BlockSceneRoot class after accessing your block in the scene by name.
// Load in the scene module const Scene = require('Scene'); // Locate a block in the scene const myBlock = Scene.root.find('myBlock'); // Set a scalar input (signals also accepted) myBlock.setScalarInput('blockInput', 5); // Get a scalar output const blockOutput = myBlock.getScalarOutput('blockOutput');
It's a good idea to add descriptions to your blocks. This will help any creators you share the block with understand what it does, and help you keep track too.
To add a description:
When you select the block in the Assets Panel, you'll see the description in the Inspector:
You can package blocks to share them with other creators, or add them to other projects.
To package a block:
An .arblockpkg file will be created - you can share this with other creators. They'll be able to import the .arblockpkg file to their projects.
Join the Spark AR Community to share tips, inspiration and assets like blocks and patch groups with other creators.
Blocks allow you to structure your project, to use parts of it again and again. They can contain scene objects, assets and patches.
Patch Groups allow you to save and share groups of patches with other Spark AR Studio creators. Saved patch groups can’t contain producer patches, consumer patches or any assets.
Blocks can only be used in projects with meters as the unit of measurement.
The following features are not supported:
You can’t create a block within another block.
Find inspiration, see examples, get support, and share your work with a network of creators.Join Community