Spark AR Tutorial | Making a “Which Are You?” Instagram Filter With Javascript

Spark AR Tutorial | Making a “Which Are You?” Instagram Filter With Javascript

You’ll need an updated version of Spark AR (an augmented reality studio created by Facebook), a question picture that asks a variation of “Which are you?”, and a list of pictures for the result.

You’ll need an updated version of Spark AR (an augmented reality studio created by Facebook), a question picture that asks a variation of “Which ____ are you?”, and a list of pictures for the result.

My version of the project is on Github here. Borrow from it however you want

Part One: Setup in Spark AR

Adding Textures

After opening a blank project in Spark AR, the first thing we’ll need to do is add our pictures. You will need one picture with your “Which ____ are you?” question, and then however many results you want to include.

Image for post

On the bottom left, you’ll see a section called Assets. In that section, select Import: From Computer and then choose your image files.

These pictures will be added to your project in a folder called Textures. In Spark AR, you can think of textures like a top-coat of paint. Later on, we will use them to cover an AR material in the Spark AR studio.

Adding a Face Tracker

Above Assets is another menu called Scene. At the bottom right of this menu, select Add Objects, and choose Face Tracker from the popup menu. Our project can now follow the movements of the user’s face.

Image for post

However, Face Tracker isn’t a ‘physical’ object so we need to right-click faceTracker0 from our Scene hierarchy, select Add, and then choose Add Plane. This will add a checkerboard patterned square in front of the person in the simulator and a plane0 underneath Face Tracker in our Scene hierarchy.

You don’t need to change the name of the plane, but select it and look at the menu on the far right. You will see an option to add a Material, which when selected will add a blank material0 to our Assets hierarchy.

Image for post

First, rename material0 to display. We will reference this later in our script, so it’s important that the names match. Then, under Shader Type select Flat, and under Texture select the “Which _____ are you?” image file you added before.

You will now see your image displayed in front of the face in the simulator. You can now go back to *plane0 *and play around with the position and scale until it looks right.

javascript programming spark-ar javascript-tutorial

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Now Learn JavaScript Programming Language With Microsoft

Microsoft has released a new series of video tutorials on YouTube for novice programmers to get a hands-on renowned programming language — JavaScript.

JavaScript Snake Game Tutorial - Develop a Simple Snake Game

JavaScript Snake Game - Develop simple snake game with javascript and html. In this step by step guide we provided all the instructions to develop the game easily. Snake game is an interesting JavaScript project for beginners. Snake game is a single-player game, which we’ve been playing for a very long time.

Spark AR: Particle System Masterclass

Spark AR: Particle System Masterclass - Learn more about Particle System in this short tutorial

FreeCodeCamp JavaScript Tutorial - Learn JavaScript for web development

Learn to code. Build projects. Earn certifications.Since 2015, 40,000 graduates have gotten jobs at tech companies including Google, Apple, Amazon, and Microsoft.

Functional Programming in JS

Functional programming(FP) is a programming paradigm where we think of code as a function. How fun is that everything is a function. Functional programming is not a new concept but it is gaining its popularity, Even Object-oriented programming languages are trying to have functional concepts. For eg: Lambda functions in Java.