You can create materials in Spark AR Studio, and add color and interest by adjusting their properties. You can also make textures in external software and combine them with materials to add detail and complexity.
We've provided all the textures you'll need, along with a 3D object, in the sample content. Download it to follow along.
Materials are applied to the mesh that make up a 3D object.
In the unfinished project, we've already added the 3D object you're going to work with to the scene. It's listed as origami_hand in the Scene panel. It's a child of a plane tracker which means it'll be visible through the back camera on a mobile device, when a flat surface like a table is detected.
To create the a material for the 3D object:
The material will be listed in the Assets Panel as material0.
You can rename materials if you want to, by right-clicking on the material and selecting Rename. For this tutorial, name the material hand_material.
To apply the material to the hand, click the arrow next to the origami_hand object in the Scene panel. This will expand the object and reveal the mesh, which is where you'll add the material. The mesh in this object is called origami_hand_mesh. Select it.
Then, in the Inspector:
Textures can add all kinds of details to an object when they're applied to a material.
Textures should be PNG or JPG files. They can be added to your project through the Assets panel, again by clicking Add Asset, and this time selecting Import From Computer.....
We've already added 3 textures to this project.
origami_hand_mat_BaseColor will be used to add a base color and a paper-like appearance to the hand, when we make a standard material. We'll then combine all 3 textures in the physically-based material.
You can choose from 6 types of material in Spark AR Studio. The best one to pick depends on the type of object you're using and the effect you're creating. Let's take a quick look at each of them.
Select hand_material in the Assets panel. In the Inspector you'll see an option labeled Shader Type. This is where you choose which type of material you're going to create.
As you can see, the option here is set to Standard. The standard material is generally used for materials applied to 3D objects because it responds to lighting in a way that provides realistic depth. We can change this by clicking the dropdown next to Type.
The flat material is generally used for 2D objects, because it doesn't respond to lighting. This mean it has less of an impact on the performance of your effect than a standard material.
The physically-based material can be used to create a realistic looking material, using a combination of different textures and different properties.
The face paint material is best for mask effects that paint textures over the user's face because it preserves the luminance of the face underneath, but removes the color. This means your own texture can be multiplied over it.
The blended material includes a mode to mix textures and colors.
As you can see, the Type is already set to Standard for this material, so we can leave it as it is.
You'll add colors and textures to define the color and general appearance of your object using the Diffuse option. So:
The hand now has a color and a slightly textured effect. You can make it look more interesting and realistic by adjusting the Shader Properties.
Start by checking the box next to Specular. Specular defines the shine and highlight color of a surface - adjusting this can make an object more realistic.
Adjusting the slider next to Smoothness will make the specular effect appear stronger or weaker. This is because you're controlling whether the highlight is spread out across a wide area, or concentrated in a smaller area. I think this effect looks better with Smoothness set to about 20%.
The hand looks pretty cool using just a standard material. Now let's try using a physically-based material instead.
Start by changing the Shader Type for hand_material to Physically Based. As you can see, the object looks a little flatter now. This is because physically-based materials mimic light in a different way from the standard material.
Let's add a color above Texture. Select the box next to Color. Click pencils icon, and select the yellow pencil - Cantaloupe.
Adding an Environment Texture
Environment textures use images to add realistic lighting effects to objects. There are several to choose from in Spark AR Studio - or you can import your own.
To create an environment texture:
Each of these textures mimic lighting from a different environment - for example an office or bathroom.
For this effect, choose Sunny Vondelpark - which will give the hand the effect of light in a park on a sunny day. You'll see the texture listed in the Assets panel as sunnyPark0.
To add the texture to the material:
You can see the hand now has realistic lighting.
Adding an ORM Texture
ORM stands for occlusion, roughness and metallic. Use an ORM texture to control how metallic or rough an object looks.
To apply the ORM texture, click the dropdown next to ORM texture and select origami_hand_mat_OcclucsionRoughtnessMetallic from the menu.
Using the sliders under Surface Parameters, set:
Occlusion maps are used to approximate soft shadows baked into the creased areas of a surface. If you're using an ORM map with occlusion baked into its red channel, the occlusion strength slider can be used to control the strength of the occlusion map. Otherwise the slider will have no effect.
The hand will now have a more textured, metallic appearance.
Adding a Normal Map
The final step is to add a Normal map. This will add an illusion of bumpiness to the surface of the object, to make it look more interesting and realistic. You can also add normal maps to standard materials.
To add the normal map:
And there you have it! You've made a complete physically-based material.