CodeBlanks Logo Icon CodeBlanks

Metallic and Smoothness

Learn how Metallic and Smoothness values shape surface appearance.

Metallic and PBR fundamentals

Physically Based Rendering (PBR) accurately simulates light behavior according to real-world physics. The Metallic parameter dictates whether a surface behaves as a conductive metal or a dielectric insulator.

// Making surface fully metallic (between 0.0 and 1.0)
mat.SetFloat("_Metallic", 1.0f);

Dielectrics like wood, stone, and cloth use a Metallic value of 0.0, whereas iron, gold, and chrome use 1.0.

Smoothness

Smoothness controls microscopic surface irregularities. When set to 0.0, the surface is completely matte and diffuses light broadly.

// High gloss mirror-like smoothness setting
mat.SetFloat("_Glossiness", 0.85f);

As the value approaches 1.0, the surface becomes mirror-smooth, generating sharp, defined specular highlights and reflections.

Practice Print Metallic and Smoothness values

Assign "0.9" to metallic and "0.85" to smoothness. Print Metallic: 0.9 | Smoothness: 0.85 to the console.

Starter code

Player.cs
using System;

class Program
{
    static void Main()
    {
        // metallic ve smoothness değerlerini tanımlayıp yazdır
    }
}

Sample solution

Player.cs
using System;

class Program
{
    static void Main()
    {
        string metallic = "0.9";
        string smoothness = "0.85";
        Console.WriteLine("Metallic: " + metallic + " | Smoothness: " + smoothness);
    }
}

Expected output

Metallic: 0.9 | Smoothness: 0.85

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 In the PBR material system, what should the Metallic value be for non-metallic items like wood, plastic, or stone?

  • -1.0 (Negative reflection)
  • 0.0 (Non-metallic dielectric) Correct answer
  • 1.0 (Pure metal)
  • 0.8 (Chrome plating)

Explanation: Non-metallic dielectric surfaces possess a Metallic value of 0.0, exhibiting zero metallic conductance.

2 Set metallic value

Question
mat.SetFloat("____", 0.8f);
Answer
mat.SetFloat("_Metallic", 0.8f);

Explanation: In the Unity Standard Shader, the parameter controlling metallic factor is named '_Metallic'.

3 PBR properties

Term Meaning
PBR Physics-based realistic rendering model
Metallic Value defining surface metalness (0-1)
Smoothness Setting for shininess and reflection
Dielektrik Non-metallic surface like wood or stone

All lessons in Intermediate