In this lesson, you will learn how to use grayscale roughness maps to simulate the microscopic surface irregularities that determine how light scatters across your 3D models.
The Physics of Microstructure
When light hits an object, its reflection isn't just determined by the material’s color; it is governed by the "micro-surface" of that object. A perfectly smooth surface (like a mirror) reflects light in a single, focused direction. A rough surface contains microscopic ridges and valleys that scatter light in many different directions, resulting in broad, blurry specular highlights.
In Unity’s Physically Based Rendering (PBR) metallic/roughness workflow, the Roughness map acts as a control mask for this scattering.
Mapping the Grayscale Value
A roughness map is a grayscale texture where the brightness of each pixel defines the surface state:
- Black (0.0): Perfectly smooth. The surface will show sharp, tight specular reflections.
- White (1.0): Perfectly rough. The surface will diffuse light across a wide area, appearing matte or "flat."
By creating a grayscale texture, you can break up a uniform material. For example, a "worn" metal pipe might have a black base (smooth metal) with white patches of rust or dirt (high roughness).
Implementation
When configuring your Material in the Inspector, you assign your texture to the Smoothness or Roughness slot (note: depending on your specific shader settings, you may need to invert your texture if the pipeline expects Smoothness rather than Roughness).
// Conceptually, the shader uses the map value to lerp the specular exponent
float surfaceRoughness = tex2D(_RoughnessMap, uv).r;
// Low value = High specular intensity, tight highlight
// High value = Low specular intensity, broad highlight
Using these maps is significantly more efficient than trying to model surface variation geometrically. Instead of millions of polygons to represent tiny scratches, you simply paint the variation into a texture, allowing the lighting engine to calculate the light scattering math per-pixel based on your map. This provides a tactile, realistic "feel" to your assets without sacrificing frame rate.
Key Takeaway: Roughness maps transform uniform surfaces into dynamic, realistic materials by telling the light engine exactly where to scatter or focus its reflections based on grayscale intensity.