etlaM21 / SparkARWorkshop2022

Materials for Spark AR workshop

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Spark AR Workshop 2022

This repository functions as a hub with information for you to look up when working with Spark AR and also contains all the materials used in the workshop held on the 25th of February 2022.

Everything here refers to the workings of Spark AR v129 and won't be updated to ensure validty with future versions of Spark AR.

Setup

You will find the current version of Spark AR here: sparkar.facebook.com/ar-studio/download

For testing AR experiences without the need to upload them to the Spark AR hub (to test in Instagram / Facebook), you can use the Spark AR player on your device. Find the current version in the respective app store or follow the links on the official download page.

Publishing

Requirements

The .arexport file containing all the zipped original assets needs to be under 40 MB

The .arfx file containt the effect with compressed assets needs to be ...

  • ... less than 10 MB for Facebook effects
  • ... less than 4 MB for Instagram effects

Some features are only available for effects published on Facebook.

Public effects have to meet the Spark AR Policies and Facebook Community Standards and / or Instagram Community Guidelines.

Making the effect accesable on Instagram / Facebook

To publish your AR experience on Facebook and/or Instagram you will need to have a Facebook account.

  1. Export your effect out of Spark AR by opening the publish menu. You can export the effect or directly upload it to the Spark AR Hub should you logged in your Facebook in Spark AR already. Then you can skip ahead to step 3.
  2. Go to the Spark AR Hub and login to the Facebook on which you want to publish your project. For Instagram experiences this means you need to choose the account which the Instagram account is linked to.
  3. On the button "Publish Effect" you can fill out all the needed information about your filter and also upload the .arexport file you got out of Spark AR. Important note: If you choose Facebook only as your target plattform, you can't change it afterwards. You have to delete your effect and start the process over.
  4. You will now need a preview image and video for your experience. Click save and then send yourself a test link to the target plattform and record a preview.
  5. Upload the preview image and video in the Spark AR hub and publish your effect.

Now Facebook will review your submission. Officially this takes up to 10 working days, but in my experience it has always been less. Two working days are usually the maximum.

Problems to look out for

If the audio playback only works after the recording of the video, you have the microphone still enabled. An AR experience created with Spark AR can't simultaneously play an audio clip and record audio via the internal microphone. You can disable the microphone to enable audio playback during the recording process.

Should an audio clip only play on Apple devices, then your audio file is in the wrong codec: Spark AR supports ALAC as codec, but your audio won't be played on Android devices. Convert your file to the AAC codec.

If your shader looks different in Spark AR than on your device, the issue could be because of float precision. SparkSL only supports 16-bit floats, more about this here. You should be careful when normalizing values or making use of exponential functions. SparkSL also provides utility functions like "safeNormalize" to help you avoid such problems.

Ressources

Workshop Assets

If you don't want to clone this whole repository but still access the assets used and example projects, you can download a .zip (23 MB) here: files.maltehillebrand.de/zip/SparkARWorkshop2022.zip

Offical Ressources

Offical documentation for Spark AR can be found here: sparkar.facebook.com/ar-studio/learn

Official assets for face filter creation can be found here: lookaside.facebook.com/developers/resources/?id=Face-reference-assets-classic.zip

(Should the link to the assets be moved in the future, you might find the new one in this page of the documentation)

The official Blender Toolkit for mesh optimazition, analysis and export can be found here: lookaside.facebook.com/developers/resources/?id=Spark-AR-toolkit.zip

(Should the link to the assets be moved in the future, you might find the new one in this page of the documentation)

Unofficial Ressources

Image compression: tinypng.com

TinyPNG uses smart lossy compression techniques to reduce the file size of your PNG files

Convert Audio to .m4a: audio.online-convert.com

Spark AR only accepts audio with .m4a as file format. Parameters to use when converting to .m4a:

  • Sampling rate: 441000Hz
  • Audio channel: Mono
  • Audio codec: AAC (recommendation) or ALAC (not working on Android device)

Alternatively you can convert your audio using FFmpeg

ffmpeg -i "your_current_audio.mp3" -y -codec:a libvo_aacenc -ac 1 -ar 44100 -ab 256k "your_new_audio.mp4"

Ressources shared by the Spark AR community: github.com/Spark-AR-Community

Lots of information about and examples of shaders written in SparkSL: github.com/aferriss/sparksl-shader-examples

About

Materials for Spark AR workshop