Drawing with Render Pass in Spark AR
Drawing with Render Pass in Spark AR is a great way to draw in Spark AR. You can do it with your finger, or 3D object.
It works by rendering and delaying the frames selectively. In this tutorial, we will render a drawing object, delay it and blend it with the Background canvas.
Here’s a screenshot of what we will be making.
1. Add Render Pipeline
- Select “Device” from the Scene panel on the left
- In the Properties Panel, press “Create” to add the Default Pipeline.
Now we have a good start. Let’s add a few more objects.
1. Add Patches
- Add the “Shader Render Pass” object by selecting + Add Patch. We need 2 of them.
- Add the “Delay Frame” object.
- Right click on the Delay Frame object and select “Make Receiver”
- If you have other receivers in your project, make sure the receiver says “Delay Frame”.
2. Add Scene Objects
Now we can set some values and hook up our other objects. But first, let’s add a Canvas.
- In the Scene Panel select + Add Object and add Rectangle
- Set the rectangle to fill the width and height of the screen.
- Create a Background material and set the material texture to cameraTexture0
- If you do not see cameraTexture0, select your Camera object in the scene panel and Create a Texture Extraction in the Properties Panel on the right.
- Create another rectangle and set it’s material to a material with your drawing object texture. In this example template, it is a star.
3. Hook it up
Add the remaining scene objects as shown below. Alter their settings and play with values until you achieve the effect you desire.
Render pass is a fun and efficient way to play with the images we see on the screen. This project along with other templates and tools can be found by clicking the button below.
For custom filters and questions about Spark AR, feel free to send me a message from the Contact page.