Flat materials don't respond to lighting, and display color and texture values absolutely.
You might use this material if there's lighting and shadow present in your texture file already, or if you're creating a material for a 2D object.
When you create a material for a 2D object, a flat material will be created by default.
It's a good idea to use flat materials where you can, because they're more performant than the standard material.
To create a flat material:
You'll see a flat white material covering your object:
Add colors and textures under Diffuse in the Inspector panel:
Below, we've added a texture underneath the Diffuse property. The texture itself has some subtle shading, giving a sense of depth:
You can also add an environment texture, by checking the box under Environment, and choosing one of the options from the menu. This will add a realistic lighting effect to your material.
Like all materials in Spark AR Studio, there are a selection of render options for the flat material.
Below, we've created a rectangle and set the Size to Fill Width and Fill Height. This makes the rectangle the same size as its parent, the canvas. The Mode of the canvas is set to Screen Space, so its size will always match the screen of the device.
We've created a flat material for the rectangle, and adjusted its Opacity. As a result, there's a transparent colored vignette across the scene. You could combine this technique with segmentation, to add different colors to the foreground and background.
Edit the Color option to add a color from the palette to your material.
Click the dropdown next to Texture to choose the texture file you want to add from the menu, or import a new one.
Check this box to add an environment texture to your material. Choose a texture from the dropdown menu.
Use this option to mask the alpha channel. Use Invert to switch which part of the texture is masked.
Sets the blend mode of the material.
Back - Discard pieces of the mesh that are facing away from the viewer. Most effects use this mode to improve performance.
Front - Discard pieces of the mesh that are facing the viewer.
Sets the transparency of the material on an individual map level.
Displays both sides of a face normal.
Use the Write to Depth Buffer and Use Depth Test checkboxes to control certain order parameters for the object the material is applied to.
Enable read and write depth buffer. This means that closer objects will obscure far objects.
Disable read depth and enable write depth. These objects will always draw over any other object. They will obscure father objects that are drawn after unless these objects have either the Write to Depth Buffer or both boxes checked.
Enable read depth and disable write depth. These objects will be obscured by nearer objects that have already been drawn that have either the Write to Depth Buffer or both boxes checked.
These objects can be obscured by any objects drawn afterwards, whether they’re nearer or further away.
Disable read and write depth. These draw on top of any objects of any type already drawn, and in turn will be overdrawn by any later rendered objects, regardless of whether they are nearer or further away.
Check which object this material is applied to.