Spark AR Studio supports textured and animated 3D objects. This article provides tips to help you create 3D objects that will work better and more efficiently in your Spark AR Studio project.
You should be familiar with:
- Applications such as Autodesk® 3ds Max® animation software, Autodesk® Maya® software and Blender.
- UV maps and UV shells.
- Material and texture maps.
- Rigging — the process of building the skeleton hierarchy of bones for a 3D object.
- Skinning — the process of attaching bones to the mesh.
- Deformers (blendshapes or shape keys.)
- Keyframe animation, animation clips.
Scale and position
When creating a Spark AR effect you’re placing 3D objects within the real world so it's important that these objects represent a realistic and uniform scale. This is especially key when creating effects for business use cases. For example, if your effect allows users to place items from a furniture catalogue in their living space, the 3D furniture should be realistically scaled.
Outside Spark AR Studio, make sure to:
- Set the right unit. Spark AR assumes models are uploaded in meters. If you export your 3D model measured in meters, the scale should already be correct by default.
- Use an in-built 3D measuring tool to check the dimensions of your object and scale the object up and down if necessary to match the object’s real-life or desired size.
- Keep all 3D objects no smaller than 1 cm and no larger than 5 meters. Users may have trouble interacting with objects beyond these dimensions.
- Set the pivot point to the object’s origin.
- Once you’ve correctly positioned and scaled your object don’t forget to set the object’s new transformation values as the default values. Do this before exporting the object.
The image on the left is an imported bird object at the wrong scale. The right-hand image shows a properly-scaled bird.
The number of triangles in a 3D object’s mesh, or the 'triangle count' will impact performance. It’s a good idea to keep the triangle count as low as possible. The maximum number of triangles per object should be below 50,000. Keep the total triangle count for all objects in an effect below 150,000.
Here are some tips to reduce triangle count:
- Remove any internal geometry from a mesh if it doesn’t need to be visible: If your object is a character wearing a hat, remove the part of the head that is hidden from view.
- Repair geometry: Try deleting loose geometry, triangles and vertices, making planar faces, deleting overlapped faces and merging overlapping vertices. This will reduce triangle count and the likelihood of producing artefacts (unintended pixelation and other graphical effects), especially when working with 3D scans. If you’re working in Blender, Spark AR Toolkit will clean up your mesh for you.
- Turn highly-detailed parts of your mesh into textures: If you’re making a flower crown and the flowers won’t be in focus throughout the effect, map them on a low-poly concave disk instead of importing an entire 3D flower with every single petal and all the stigma. You can set a lower mesh density in selected areas that don’t require as much detail.
In the right-hand side of the image below, the geometry that makes up the character’s hips and legs beneath the shorts can be removed as it won’t be visible in the end effect.
You can also optimize your mesh by:
- Merging your meshes together as much as possible. This will reduce the number of objects in your effect and generally improve performance.
- Keeping polygons in triangles and quads to avoid artifacts.
A UV map is a 2D representation of the surface of your 3D object. To achieve the best texturing results the UV mapping process must be successful. To optimize the process:
- Generate your UV maps manually instead of auto generating them.
- Keep UV shells to a minimum and don’t overlap them or you’ll get artefacts.
- Leave padding between shells. For example, a 1K texture should have 8 pixel padding between shells.
- Only use one UV map for the 3D object.
The image on the left shows a UV map with overlapping UVs. The right-hand image is a well-organized UV map.
When creating materials:
To achieve interesting yet efficient texture results:
- Use textures in sRGB space with a maximum resolution of 1024 x 1024 pixels.
- If you create your textures with Adobe® Substance Painter® texturing software use Spark AR templates to make your textures compatible.
- Merge materials as much as possible for performance benefits.
- For textures with a repeating pattern, import a lower resolution image and use Spark AR Studio's visual shaders and texture tiling feature instead of using a larger resolution image.
Texturing with realistic lighting is difficult to achieve in AR effects and it takes a lot of processing power. To reduce the impact on performance:
- Bake lighting directly into 3D objects used for decoration in face effects to hint at highlights and shadows.
- Bake lighting into static (non-moving) objects such as furniture and accessories for a more realistic effect. Use a soft light setup without strong highlights or shadows. Baked lighting works best in environments where the light, intensity, colour etc. doesn’t change throughout the effect.
- Use MatCap (material capture) reflection environment textures with flat shaders.
Rigging and skinning
If you’re building an animated 3D object you’ll create (rig) a skeleton and attach (skin) the mesh to the skeleton to control how the object deforms when it moves. If this process is not optimized for Spark AR studio, components of your animation may not work or perform well.
When creating a skeleton:
- While there is no maximum number of bones you can use in your animated object, we recommend using as few bones as possible to reduce the impact on performance and size.
- Use a consistent naming convention for the bones and use separate names for each individual bone. For example arm_L for left arm and arm_R for right arm.
- Orient your bones with Z+ Forward and Y+ Up.
- Set each bone’s scale to 1 on all axes.
- Organize your bones in a natural hierarchy. Spark AR Studio treats loose bones as null objects and will not recognise them as deformers.
Below are two possible skeleton hierarchies. The right-hand image is a best-practice example.
The skeleton hierarchy below is not recommended for animated 3D Skeleton objects.
Some general guidelines for the skinning process include:
- Limiting the number of influences per vertex to four when binding the rig to the mesh. This is the maximum number that Spark AR Studio supports for performance reasons. If your object doesn’t meet these guidelines it could result in artefacts before and during animation.
- Making sure bones are in the intended positions to avoid artefacts.
The image on the left is a 3D bird with an incorrectly positioned skeleton. The right-hand image shows a well-positioned skeleton.
Using procedural animation in Spark AR Studio lets you generate animation in real time while keeping your effect size low.
Adding keyframe animation to your object outside Spark AR Studio is a good option for creating more complex and detailed motions but it may increase file size. If you need to use keyframe animation:
- Only add keyframes to standard properties (position, scale and rotation).
- Don’t add keyframes to properties you don’t need to animate. For example, don’t add keyframes to the scale if not needed.
- Keep in mind that custom attribute keyframes won’t be exported.
- Use a frame rate of 24 fps (frames per second) in the 3D software you’re working in.
Another way to add complex animation to your 3D objects is to create animation clips and assign them to your object in Spark AR Studio. You can create clips with tools like The Game Exporter plugin in Autodesk® Maya® or with NLA (non-linear animation) actions in Blender.
Before importing your object you should also take note of the requirements and limitations on file formats and features.