Skip to main content

Introduction

In the world of CG and game development, creating realistic and stunning visuals is a top priority.

To make realistic and amazing graphics, you must know well fundamental things, like textures, materials, and shaders. These terms are often used interchangeably, but they each play distinct roles in the process of bringing digital worlds to life.

In this article, we’ll explore the differences and relationships between them, and how they collectively contribute to the visual quality.


The Basics

Before delving into the differences, let’s establish a basic understanding of each concept:

Textures

Textures are 2D images that are applied to 3D models to enhance their visual appearance. They provide surface detail, such as colors, patterns, and roughness. Textures essentially “paint” the surfaces of 3D objects, It allows artists to simulate various materials like wood, metal, fabric, and more.

Materials

Materials are collections of properties that define how a surface interacts with light. They encompass attributes like color, reflectivity, transparency, roughness, and more. Materials are responsible for giving objects their physical characteristics and visual qualities.

Shaders

Shaders are programs that run on the GPU (Graphics Processing Unit) and define how light interacts with surfaces. They use information about the properties of materials and lighting to create the colors of the pixels that form the image. Shaders are responsible for determining how objects look under different lighting conditions.

Now, keeping this info in mind, let’s take a closer look at each of these components.


Textures

Textures are 2D images that simulate the appearance of real-world materials when applied to 3D surfaces.

They include visual information such as color, surface patterns, roughness, and other fine details that give objects their desired look.

Textures are defined by properties that affect how they look when light shines on them and how they’re put onto a 3D model. Here is a list of commonly used texture types (also called maps):

  • Diffuse/Albedo Texture: Defines the base color and appearance of an object’s surface.
  • Normal Map: Simulates surface bumps and dents by encoding height information into RGB channels.
  • Specular Map: Determines the intensity of highlights on a surface.
  • Glossiness/Roughness Map: Controls the sharpness and spread of specular highlights.
  • Ambient Occlusion Map: Simulates soft shadows in areas where objects are close together.
  • Displacement Map: Physically alters the geometry of a mesh to add more detail.
  • Emissive Map: Defines areas of a surface that emit light, useful for simulating glowing objects.
  • Opacity/Alpha Map: Specifies areas of transparency or opacity in a texture.
  • Metalness Map: Defines the metalness of a material, affecting how it reflects light.
  • Height/Displacement Map: Similar to normal maps, these maps alter surface geometry to add depth.
  • Cavity Map: Highlights concave areas on a surface, enhancing depth perception.
  • Subsurface Scattering Map: Simulates light scattering beneath the surface, commonly used for skin and organic materials.
  • Translucency Map: Controls the translucency of materials, affecting how light passes through them.
  • Detail/Grayscale Map: Adds fine details to a texture, often used to enhance realism.
  • Reflection Map: Defines how reflective a surface is and what it reflects.
  • Refraction Map: Controls how light bends when passing through transparent materials.
  • Anisotropic Map: Defines the direction of anisotropic reflections, common in brushed metal surfaces.
  • Decal Map: Adds localized details, like stickers or labels, to a texture.
  • Flow Map: Guides the direction of animated texture movement, useful for simulating fluids or fire.
  • Environment Map: Used to create reflections and lighting based on the surrounding environment.
  • Mask/Blend Map: Determines how multiple textures or materials blend together.

Textures are basically files that are saved in various file formats, each with its own characteristics and advantages. The choice of texture file format depends on factors such as compression, quality, transparency support, and the specific requirements of the project.

These are common file formats used for physically based rendering (PBR):

  • Albedo/Color Map: JPEG, PNG, TIFF
  • Normal Map: PNG, TIFF, TGA
  • Metalness/Roughness Map: PNG, TIFF, TGA
  • Ambient Occlusion Map: PNG, TIFF, TGA
  • Emissive Map: PNG, TIFF, TGA

Materials

Materials are more than just textures. They include properties that describe how light interacts with an object’s surface. Materials bridge the gap between textures and shaders by combining texture maps with other surface characteristics to create a cohesive appearance.

Material includes information about its color, reflectivity, transparency, roughness, and other physical attributes. Essentially, a material is a set of parameters that dictates how an object looks in a virtual environment. Those parameters can be defined by numeric values and by textures with per-pixel accuracy. For instance, a metallic material would reflect light differently than a rough, matte material.

The way materials are defined can vary from one software to another (like Blender, Unreal Engine, Maya, 3ds Max, etc.), there are common things that you’ll find in most CG software:

  • Material Library: A collection of predefined materials you can use as a starting point or for quick application.
  • Shader/Node Editor: A visual interface where you connect nodes to create and modify materials by controlling attributes and textures.
  • Texture Slots: Spaces where you assign various textures (diffuse, normal, roughness, etc.) to specific material attributes.
  • Parameter Controls: Sliders, color pickers, and checkboxes to adjust material attributes like color, shininess, transparency, etc.
  • Preview Window: A real-time or near-real-time view of how your material will look when applied to a 3D model under different lighting conditions.

Materials are the place where you’re defining how textures are applied to the objects’ surface. There are multiple ways how you can do that, like using an object’s UV coordinates, world, or camera position.

In materials, you can also tile and scale textures. Tiling repeats the texture, which is good for things like floors or walls. Scaling changes the size of the texture to match the object it’s on.


Shaders

Shaders are the programs that run on the GPU (Graphics Processing Unit) and are responsible for computing the color, lighting, and other visual attributes of pixels or fragments on the screen. Shaders are closely related to materials, as they define the computations and algorithms that control the visual characteristics of materials.

They are the bridge between the mathematical equations that define light behavior and the final pixel color displayed on the screen. Shaders combine textures and material properties to produce the final visual output. They are responsible for creating effects like shadows, reflections, refractions, and various lighting models (e.g., Phong, Blinn-Phong, physically based rendering).

Materials and shaders are closely connected because a material’s visual properties and behavior are defined through shader programs. A material is a higher-level description of how a surface should look, including attributes like color, shininess, roughness, transparency, and more. A shader, on the other hand, is responsible for implementing these attributes using mathematical computations.

When you work with materials in a CG software’s shader editor or node-based system, you’re essentially designing the behavior of shaders that will be applied to objects with those materials. You connect nodes in the shader editor to create a network that defines how the shader responds to light and textures, ultimately determining the material’s appearance.

Shaders can be categorized into three main types:

  1. Vertex Shaders: These shaders manipulate the position of vertices in a 3D model, preparing them for further processing.
  2. Geometry Shaders: Geometry shaders can generate new vertices or even entire primitive shapes, enabling effects like tessellation and particle systems.
  3. Fragment/Pixel Shaders: These shaders compute the color of each pixel on the screen, considering lighting, material properties, and textures.

When a 3D model is rendered, shaders use the information from the textures and materials to calculate the final appearance of an object. For instance, if a model represents a wooden table, the associated texture could include the wood grain pattern, while the material parameters might specify the color, reflectivity, and roughness of the wood. The shader then uses this information to simulate how light interacts with the wood’s surface, producing highlights, shadows, and reflections that contribute to the table’s overall appearance.

Nowadays shaders usually can be written and operated using a node-based editor inside the software, which will transform it into code automatically. But, in fact, before the popularity of node-based editors, shaders were primarily written as code in programming languages designed for graphics programming, such as OpenGL Shading Language (GLSL) and High-Level Shader Language (HLSL). These languages allow you to create shaders by writing code that defines how light interacts with surfaces and how pixels are shaded.

Instead of using a node-based editor, you write shader code directly in a text editor or integrated development environment (IDE). This code defines the computations and calculations necessary to achieve the desired material appearance.

While node-based editors offer a visual and more user-friendly way to create shaders, writing shaders as code provides more precise control and flexibility over the rendering process. However, coding shaders requires a deeper understanding of graphics programming and shader languages.


Conclusion

As you can see, in the realm of computer graphics and game development, textures, materials, and shaders are essential components that work harmoniously to create visually captivating and immersive digital environments.

While these terms are often used interchangeably, it is important to understand which is which and how they relate to each other. Textures and materials work hand in hand to create a realistic visual experience, and shaders bring them to life by providing lighting, shadows, and other effects that make the environment feel more immersive.

So, as with any fundamental information, a clear understanding of this helps you work more efficiently and achieve better (and fancier!) results.


Get ahead with CG secrets and exclusive content