Learn

Materials for 3D Objects

Materials for 3D Objects
Photo by Orfeas Green / Unsplash

Physically Based Rendering (PBR)

Most modern 3D software uses some variation of the Physically Based Rendering standard. This simulates the way light interacts with different types of surfaces, to render realistic materials. The most basic implementation of a PBR material might include only a single color, with values for roughness and metalness. More detailed materials may have some or all of the following properties:

  • Albedo (sometimes referred to as Color or Diffuse) defines the base color of a given surface, either as a color value (RGB) or a texture
  • Metalness defines how metallic a surface is on a scale from 0 (not metallic) to 1 (fully metallic), and can be either a single floating point value, a grayscale texture, or a single color channel in a texture (e.g. the blue channel in an ORM texture)
  • Roughness determines how light reflects off of a surface, where 0 is a fully reflective surface (e.g. chrome, or wet pavement), and 1 is fully diffuse. Like the metalness value, it can be either a single floating point value, a grayscale texture, or a single color channel in a texture (e.g. the green channel in an ORM texture)
ℹī¸
In the Unity game engine, the Roughness property is replaced with a Smoothness value. When using materials from other software, be sure to invert the Roughness value (or texture) to achieve the desired results
  • Ambient Occlusion (sometimes just Occlusion) darkens the surface in areas that light doesn't reach, such as crevices in a rocky material, or the edges of mortar between bricks. It is either a grayscale texture, or a single color channel in a texture (e.g. the red channel in an ORM texture)
  • Normal Maps provide additional information about which direction a point on a surface is facing, in order to add detail to a model without using excessive vertices. Generally, this will either come from the material generation software, or from "baking" detail from a higher polygon model to a lower polygon version for use in game engines. The normal map will usually be an image file
ℹī¸
Be aware that Direct X interprets Normal Map data differently than OpenGL and Vulkan, so the apparent depth may appear inverted when using a normal map that was intended for the other API. This can be fixed by inverting the Green channel in the image.
  • Height Maps (sometimes called Depth or Displacement) provide data for simulating depth across a flat surface. This will typically be a grayscale image where a 50% gray value represents no displacement at a given point
  • Emission indicates that a surface should emit light. This will either be a color image, or a color value, paired with a strength value
  • Subsurface Scattering simulates the effect of light scattering underneath a surface. This property is generally used for organic substances like human skin, certain types of foliage, or certain foods. An easy way to visualize the effect is to turn on your phone's flashlight, and press your finger against the light
  • Many applications include additional properties such as Rim for simulating how light interacts with the edges of fabric, or Clear Coat which simulates a protective coating like on cars

Note that many of these properties will not be necessary for a lot of materials, and some can negatively impact rendering performance if overused (e.g. subsurface scattering). Also keep in mind that excessive use of texture data can increase game loading times, and eat video RAM.

Tips for conserving texture space

  • Try to reuse textures wherever possible (e.g. different shades of brushed metal, or different colored walls might use the same roughness and normal maps)
  • Avoid using high resolution textures if the added detail won't be visible on screen – not everything has to be 4K, 2K, or even 1K, if you can't see the difference
  • When working with small textures, pack multiple textures into a single texture atlas
  • Godot 4.0 introduces the ORM Material type, which combines Occlusion, Roughness, and Metalness in a single texture, to conserve texture space

UV Maps

In order to apply 2D textures to a 3D model, the engine needs to understand which parts of the texture need to be drawn on each face of the mesh. The model's UV Map stores this information. Most 3D modelling software will have the ability to "Unwrap" models to generate this information.

While UV Maps and editing are an entire topic on their own, it's important to mention here, as a default or improper UV map will make textures look distorted or misplaced. This becomes more pronounced as a model moves further and further away from simple shapes like planes or cubes.

For basic texturing on flat surfaces (e.g. walls or floors), the Godot Game Engine provides Triplanar Mapping, which will tile a basic texture across a large area, without needing a proper UV map. This can be helpful for getting used to working with PBR materials, or creating reusable materials for flat surfaces, but can't replace UV maps for organic or otherwise complex shapes.

Filed to:

Learn

Read more