Articles
Textures and Materials
The Flat Material

The Flat Material

A 2D object, shown in both the Simulator and Viewport.

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.

It's a good idea to use flat materials where you can, because they're more performant than the standard material.

Creating a flat material

Materials are always applied to an object. You can test out the flat material by creating a rectangle:

  1. In the Scene panel, click Add Object.
  2. Select Rectangle from the menu.

Then, to create a flat material:

  1. In the Assets panel, click Add Asset and select Material from the menu.
  2. Select the material in the Assets panel.
  3. Set the Shader Type to Flat in the Inspector.

You'll see a flat white material covering your object:

A Rectangle with a white material applied to it, as seen in the Simulator and Viewport.

Adding colors and textures

Add colors and textures under Diffuse in the Inspector:

  1. Click the box next to Color to choose a color from the palette.
  2. Click the dropdown next to Texture to add a texture.

Below, we've added a texture underneath the Diffuse property. The texture itself has some subtle shading, giving a sense of depth:

A 2D object, shown in both the Simulator and Viewport.

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.

Editing opacity

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.

The rectange is transparent, and is adding a red tint to the effect.

Properties

Diffuse

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.

Environment

Check this box to add an environment texture to your material. Choose a texture from the dropdown menu.

Alpha

Use this option to mask the alpha channel. Use Invert to switch which part of the texture is masked.

Tiling Options

Tile

Scale the textures you've applied to your material.

Offset

Shift the origin of your textures.

Render Options and Advanced Render Options

Edit these properties to control how the material renders in the scene.

Used By

The object this material is applied to.

Was this article helpful?