When creating Meta Spark effects, you may want your objects to be sized to real-world scale. This is key when creating effects for business use cases. For example, if your effect allows users to place items from a furniture catalog in their living space, the 3D furniture should be sized based on the real-world space.
There are 2 ways to enable real world scale in Meta Spark Studio depending on the type of user experience you want to create:
- Enable Real-World Scale in the Inspector. Your object appears realistically scaled but only after a real-scale signal is detected. This means the user sees the object abruptly change size at some point after opening the effect.
- Enable Real-World Scale in the Inspector and add further logic via the Patch Editor or scripting. This method allows you to hide the object until a real-scale signal is detected. This means the user only sees the object once it’s realistically scaled.
Enable Real-World Scale in the Inspector
Before importing a 3D object, disable automatic scaling for 3D objects from Meta Spark Studio Preferences. To open Preferences:
- Click Meta Spark Studio in the menu bar and then select Preferences.
- On Mac, you can also click Command + ,
In Preferences, unselect the box to the left of Automatically scale imported 3D models.
- Import your 3D object. Make sure your object is measured in meters before importing it.
- Add a plane tracker and make your object a child of the plane tracker.
1. With planeTracker0 selected, go to the Inspector and to the right of Real-World-Scale, select the box.
2. From the Enable Effect dropdown, select one of the following the distribution methods:
- On all devices: your effect is distributed to all devices that support the plane tracker. This means that people viewing your effect on a device without real scale will see objects rendered at an arbitrary scale. On devices that support real scale, the object will render in real scale, but only after a real scale signal is detected.
- Only supported devices: your effect is only distributed to devices that support real scale. This limits your effect’s reach but is the best option if your effect doesn't make sense without real scale. Your object renders in real scale once the signal is detected.
Add futher logic
To improve the user experience on all types of devices, you can build a patch graph to hide your object unless one of the following conditions is met:
- Real scale is both supported and active and the plane tracker is found.
- Real scale is not supported and the plane tracker is found.
To build this graph, you need a plane tracker real scale patch. To find this patch:
- With planeTracker0 selected, go to the Inspector.
- Under Interactions , and to the right of Patch , select Create, then Real-World Scale.
This patch has two outputs that each send a boolean true/false signal.
- Real Scale Supported: A boolean output signal that’s true if the device supports real scale and false if real scale is unsupported.
- Real Scale Active: A boolean output signal that’s true once real scale is active and false when the device hasn’t received enough information yet to start real scale.
Example patch graph
In the example below, we built a patch graph so that a chair object is both hidden from users on newer devices until a real-scale signal is detected, and visible to users on unsupported devices.
In the example graph, the Or patch uses the signal received from both the purple Plane Tracker Real Scale and the Not patch to check which of the following conditions are true:
- Real scale isn’t supported (First Boolean in Or patch is true).
- Real scale is active (Second Boolean in Or patch is true).
When either boolean signal is true, the Or patch outputs a true signal to the First Boolean input in the And patch. The And patch checks this First Boolean signal and also checks the Second Boolean signal received from the planeTracker0 patch, which determines if the plane tracker is found or not.
The And patch only outputs a true signal to show the chair as visible if both the First and Second Boolean signals in the And patch are true, i.e.
- Real scale is either not supported or real scale is active (determined by the Or patch).
- The plane tracker is found (determined by the planeTracker0 patch).
If you’re only distributing your effect to devices with real scale, simplify your graph by disconnecting the top Real Scale supported output of the Plane Tracker Real Scale Patch and deleting the Not and OR patches:
In this example graph, the And patch sends a signal to show the chair as visible once it’s checked that both the First Boolean and Second Boolean input signals are true, i.e:
- Real scale is active.
- The plane tracker is found.
Mirroring to ar player
When you mirror your real-scale effect, objects under the plane tracker will appear in their real-world size, relative to their position from the camera.