In this guide you'll learn to create a simple world effect that places objects in a fixed position in someone's environment, instead of relative to the camera's view and movement.
We're going to use a particle system and a texture to make it look like you're surrounded by particles of light. Download the sample content
You can make a different kind of world effect in Spark AR Studio using an object called the plane tracker. Objects in plane tracking effects will appear when the camera is pointed at a horizontal surface.
Open the unfinished effect in the sample content folder to follow along.
We've already added a particle system with a material and texture applied to it. This is how the project looks:
You can find out more about particle systems in this tutorial.
It's worth changing the video to blank, to get a clearer view of the 3D space. To do this:
The particle system is in camera space because it's a child of the Camera in the Scene panel:
This means it moves with the camera. You can test this using the Simulator.
The Simulator is set to Simulate Orbit by default. This simulates the movement of the camera. The blue lines in the Viewport also indicate what the camera can see.
If you click and drag in the Simulator to simulate the movement of the camera, you can see in both the Simulator and the Viewport that the particles are moving with it.
To create a world effect, all you need to do is move the object so it's no longer a child of the Camera.
To do this, select the particle system in the Scene Panel - it's listed as emitter0. Drag it to the bottom of the list of objects, and let go.
In the Viewport, you can see the object is no longer within the lines that represent what the camera can see. You can't see it in the Simulator, either, because of where it's currently positioned:
Editing the Size and Position of the particle system will change this.
You can easily edit the particle system in the Inspector. We experimented to find values that look good for this effect. We used the Manipulators to try different positions and adjusted other properties in the Inspector.
Start by changing the size of the particle system itself. We want the particles to cover a large space, so they're visible all around the person using the effect. To do this:
The particles are now covering a large space - but you can barely see them.
To change this:
In the Simulator and Viewport, you can clearly see the particles now:
It would look better if the particle system was placed at the bottom of the scene - so that when we view the effect through the camera, it looks like the particles are moving upwards from the ground.
To do this, under Transformations change the Position of the particle system to -1.7 on the Y axis.
If you simulate the movement of the camera, you can now see the particles are covering the scene completely.
You can use the Spark AR Player app to see how the effect looks in real life on your device.
Change someone’s environment with segmentation and the camera texture.
Position rectangles a texture to create a frame that scales with the device screen.