Hazel

Materials

A material decides how a surface looks: its colour, whether it is shiny or rough, metal or plastic, whether it glows or lets light through. Every material is a .material file in your project, and one material can be used by as many objects as you like. Change the file and every object wearing it changes.

Colouring a shape quickly

A shape from the Shapes panel starts with no material. It wears a grid pattern tinted with one colour, which is why a new cube is red and a sphere blue. That grid makes it easy to judge size while you block out a level.

To change the colour, select the shape and use the Base Color row in the Material section of the Inspector. The shape updates as you drag the picker. Lower the alpha below 1 and the shape becomes see-through.

The row disappears once you give the object a real material, because from then on the material owns the surface.

Giving an object a material

Select the object and open the Material section in the Inspector.

  • Click the material slot to open a searchable grid of every material in your project, and pick one.
  • Or drag a .material file from the Assets panel onto the object in the viewport.
  • An object with no material shows a New material button: name it, pick a folder, and the file is made and applied in one go.

Texture slots

Once an object has a material, the Material section shows a row for each kind of texture:

SlotWhat the image does
Base ColorThe surface's colour and pattern.
NormalFakes small bumps and dents so flat surfaces catch light like rough ones.
RoughnessWhere the surface is shiny (dark) or matte (light).
MetallicWhich parts are metal (white) and which are not (black).
Ambient OcclusionDarkens cracks and crevices.
EmissiveParts that glow.
DisplacementA height map, so bricks and stones look like they stand out from the surface.

Only Base Color shows at first; click the line under it to unfold the rest. Drag an image onto a row, or click the row to browse, and the object updates straight away.

A filled row has two buttons. The eye turns that texture off without removing it, which is handy for seeing what a normal map is actually adding. The x removes it.

Dropping a whole texture set

Texture packs come as a set of images named after what they are for. Select several at once in the Assets panel and drop them all on the material slot: each is put in the right row by its name, so rock_normal.png goes to Normal, rock_rough.png to Roughness and rock_basecolor.png to Base Color. If the object has no material yet, one is made for it, named after the object.

Some packs ship two normal maps, one ending GL and one ending DX. Use the GL one. If you only have the DX one, it will light bumps as though they were dents; turn on Flip Green (DirectX) on its Sample Normal Map node in the graph (below) to fix it.

The Materials workspace

For anything more than textures, switch to the Materials workspace. Click an object in the viewport to load its material, or double-click a .material file in the Assets panel.

The workspace has three panels:

  • Material Graph: the node graph where the material is built.
  • Material: the material's settings, and every value in the graph as a plain list.
  • Material Preview: the material on a test shape, lit by a sky, so you can judge it without finding a surface in your scene.

Changes save as you work, and everything in the scene wearing the material updates live.

The Materials workspace: Material Preview and Material panels on the left, the Material Graph with its Surface Output node on the right

Building with nodes

A material is a set of nodes wired together, ending in the Surface Output node. Whatever reaches Surface Output is what you see.

  • Add a node: right-click the graph, or press Space over it, and type to search. Enter takes the first match.
  • Wire: drag from an output dot on a node's right edge to an input dot on another node's left edge. Drag a wire off a pin and let go on empty space to add a node that is already connected.
  • Add a texture: drag an image from the Assets panel straight onto the graph.
  • Edit a value: any input without a wire shows its own slider, colour swatch or checkbox right on the node.
  • Move nodes: drag them; they snap to the grid. Hold Alt to place freely.
  • Delete: select and press Delete.
  • Group nodes: select some and press C to put a labelled comment box around them.

The Surface Output pins you will use most

PinWhat it does
Base ColorThe main colour or texture.
Metallic0 for non-metal, 1 for metal.
Roughness0 is mirror-smooth, 1 is fully matte.
NormalA normal map, for small surface detail.
EmissiveMakes the surface glow. Pair it with Bloom on the camera for a halo.
DisplacementA height map for depth on the surface.

Anything left unplugged keeps its default, so a simple material only needs Base Color. There are more pins for car paint, glass, brushed metal and other special surfaces.

The nodes come in groups you can browse in the palette: inputs such as UVs, time and world position; textures; maths; colour; procedural patterns such as noise, bricks and checkerboards that need no image; and animation, such as scrolling UVs. You do not need to learn them all; start from textures and a few maths nodes.

Material settings

These are in the Material panel, above the list of values.

Domain says what the material is for:

DomainUse it for
SurfaceProps, walls, characters. The default.
VegetationLeaves and grass.
UnlitFlat colour that ignores lighting.
Sprite2D sprites. See 2D Games.

Alpha Mode says how see-through parts work:

ModeUse it for
OpaqueSolid surfaces. The default.
MaskHard cut-outs: leaves, fences, chain link.
BlendThings that fade as a whole: smoke, fades, soft decals.
GlassWindows and lenses: see-through but still reflecting at full strength. Give it a dark base colour.
DitheredCut-outs with soft edges: hair and fur. Needs TAA on the camera.

Double Sided draws the back of each face too, for thin things such as paper, leaves and cloth that you see from both sides.

Materials on imported models

When you import a model, each of its materials is written out as a .material file beside it. Open one in the Materials workspace to change how the model looks; every copy of that model in every scene updates.

The model finds its materials by name each time it is placed, so do not rename those .material files. A renamed file is no longer found, and the model goes back to how its source file described it.

Next steps

  • Writing a material by hand in shader code is covered in Shaders.
  • Light your materials well in Lighting.