Overview
A 3D model (mesh) is merely "shape" data. Materials and Shaders define what color the object is and what kind of surface (metal, plastic, cloth, etc.) it has.
These two concepts are closely related and often confused, but their roles are distinctly different:
- Shader: A program (algorithm) that calculates how to draw (render) the object. Contains formulas for how light reflects, how shadows are calculated, how textures are applied, etc.
- Material: An asset for actually applying a shader to an object. A material selects a specific shader and sets concrete values for the properties that shader exposes (color, textures, smoothness, etc.).
Think of it this way: a shader is a "recipe (formula)," and a material is "the dish made by applying specific ingredients (colors and textures) to that recipe." The same recipe (shader) with different ingredients (properties) creates completely different dishes (appearances).
This article explains how to create materials and use Unity's powerful Standard Shader to give objects various surface qualities.
Creating and Applying Materials
- Create: Right-click in the Project window and select
Create > Material. A new material asset (.matfile) is created. - Apply: Drag and drop the created material asset onto a 3D object in Scene view or Hierarchy. The material is set in the object's
Mesh Renderercomponent'sMaterialsarray.
Selecting a Shader
Select a material asset to see a Shader dropdown menu at the top of the Inspector. This is where you select the "recipe" for this material. Unity includes many built-in shaders, but the most fundamental and powerful is the Standard Shader.
Standard Shader: Lit vs Unlit
In Unity's standard render pipeline (Built-in Render Pipeline), the Standard shader is default. With URP (Universal Render Pipeline) or HDRP (High Definition Render Pipeline), the base shaders are named Lit (with lighting) and Unlit (without lighting). They serve essentially the same roles:
- Lit (with lighting): Fully affected by scene lights. Receives shading from light direction, enabling realistic surface appearance. Most objects in 3D games use Lit shaders. This is the basis of PBR (Physically Based Rendering).
- Unlit (without lighting): Completely ignores scene lights. Objects display set colors/textures at constant brightness. Used for UI elements, special effects, or debug visualization.
Basic PBR (Physically Based Rendering) Properties
Lit shaders (Standard Shader) support PBR, which simulates light reflection based on physical laws. By specifying characteristics that real-world materials possess, artists can create materials that look realistic under various lighting conditions. Key properties:
-
Albedo: Defines the object's base color. Typically assigned a color texture (an image depicting the object's patterns and colors).
-
Metallic: Sets how "metallic" the surface appears, from 0 to 1.
0is non-metal (plastic, wood, cloth, etc.),1is metal (iron, gold, copper, etc.). Typically set to exactly0or1—intermediate values are rarely used. -
Smoothness / Roughness: Defines how smooth or rough the surface is.
Smoothnessnear1(Roughnessnear0) means mirror-smooth surfaces that clearly reflect light. Near0(Roughnessnear1) means rough surfaces that scatter light. This value is crucial for expressing plastic sheen, wet surfaces, frosted glass, etc. Note: Unity's standard shader usesSmoothness; Unreal Engine and many other tools useRoughness(1 - Smoothness). The concept is identical. -
Normal Map: A special texture that creates the illusion of surface bumps and details without increasing mesh polygon count. Used for brick wall grooves, fabric weaves, armor patterns on characters—dramatically enhancing visual richness.
-
Emission: Makes the object appear to emit light. Doesn't illuminate other objects like actual lights, but used for neon signs, magical items, monitor screens, etc. Combined with post-processing
Bloomeffects, creates beautiful glow effects.
Summary
Materials and shaders are essential elements for bringing 3D objects to life.
- Shaders are "formulas"; materials are "configured with specific values."
Litshaders respond to light sources for realistic surfaces.Unlitshaders ignore light sources.- PBR fundamentals: Define surface quality with three main properties—
Albedo(color),Metallic(metalness),Smoothness(smoothness). - Add detail with
Normal Maps, express self-illumination withEmission.
By adjusting these properties and combining various textures, you can create nearly infinite visual variations from the same 3D model. Good materials dramatically enhance the believability of your game world.