Categories
Immersion

Week 4: Materials

Understanding the RGB Channels in Material Maps

  • Red (Ambient Occlusion): Indicates how much light penetrates through (left to right).
  • Green (Roughness): Controls how much light bounces off. Bright roughness maps make objects appear wet, while darker maps create a dull appearance (top to bottom).
  • Blue (Displacement/Normal Map): Blue represents surface depth, where dark blue areas are deeper and bright blue areas are elevated (front to back).

ORM Maps

  • ORM: Combines Occlusion, Roughness, and Metalness into a single texture for efficiency in PBR workflows.
    • Red Channel: Ambient Occlusion (AO)
    • Green Channel: Roughness
    • Blue Channel: Metalness

Building Blueprint Materials

  • The naming convention for materials: MA or MM for master material.
  • Convert nodes into parameters before adding them to the blueprint; updates occur automatically.
  • Create an instance of the material and save it as MI.

Shortcuts and Tips

  • Ctrl + 1: Assign a value and convert it to a parameter.
  • F2: Rename a parameter.
  • Adding materials to landscapes requires assigning them through the landscape material settings, not drag-and-drop.

Customizing Textures in Unreal Engine 5.4

  • Unreal 5.4 lacks built-in functions for brightness/contrast adjustments, but node-based coding allows implementation.
  • Benefits of a Master Material (MA):
    • Reusable across projects if the proper folder structure is maintained.
    • Allows customization (e.g., overlaying dirt or surface imperfections like rust).
  • Brightness: Use a multiplication node with a scalar parameter for control.
  • Contrast: Use a power node with a scalar parameter for adjustments.

Master Material Custom Functions

  • Create custom PSR (Position, Scale, Rotation) functions (MF_PSR) for UV mapping.
  • Example: UV mapping can be compared to wrapping 2D foil around 3D objects like chocolate Easter bunnies.

Implementation Notes

  • Use ORM files for simplicity and efficiency.
  • Assign RGB channels to the appropriate MA nodes (Green: Roughness, Blue: Metalness, Red: Ambient Occlusion).
  • In cases where a specular texture is unavailable, use a scalar parameter to define specular values.
    • Specular Texture: Defines areas of surface imperfections like dirt or scratches to avoid flat plane aesthetics.
  • Lerp Function: Interpolates between two textures (e.g., blending roughness and surface imperfection maps).

Master Material file implementation: process and reflection

Unreal Engine 5.4 does not provide built-in functions for adjusting the brightness and contrast of textures. However, these adjustments can be implemented through node-based coding by creating a Master Material. While this requires additional setup, it offers significant benefits, allowing for greater customization of materials. For example, layers such as dirt or surface imperfections can be added, conveying a story about the material—such as rusted metal that has undergone corrosion.

Implementing a Master Material also promotes efficiency and reusability across projects, provided the project structure is well-organized. All textures and functions referenced by the Master Material must be stored in corresponding sub-directories within the main Master Material folder to ensure seamless functionality.

Adjusting brightness can be achieved using the multiplication node, with values customized through a scalar parameter, which takes floating-point numbers. Similarly, contrast adjustments can be made using the power node, with a scalar node providing an adjustable slider.

Creating a Master Material also requires defining custom PSR functions (MF_PSR) following naming conventions. PSR stands for position, scalar, and rotation, which are tied to UV mapping. This process can be likened to wrapping a 3D object, like a chocolate Easter bunny, with decorative foil. The flat, 2D foil covers the complex 3D shape, ensuring accurate texture mapping.

To create my Master Material, I followed the tutorial Unreal Engine Materials in 6 Levels of Complexity. My implementation differs slightly as I utilized an ORM file. Based on class discussions and Serra’s advice to memorize RGB channel functions, I assigned the appropriate colour channels in my Master Material: green for roughness, blue for displacement (used as metallic in my case due to research I encountered), and red for ambient occlusion. In the tutorial, the texture was connected to the specular input of the main node. However, the texture I downloaded from the Fab library lacked a specular layer. Instead, I assigned a scalar parameter to define the specular values manually.

The importance of a specular texture is well-documented: “A specular texture defines parts of the surface that might be dirty, scratched, or darker. These areas react differently to light sources. Without a specular texture, light reflects off the surface like it’s a flat plane.” Based on this insight, I may need to refine my Master Material to better align with its intended purpose, avoiding the flat-plane aesthetic and aiming for a more realistic appearance.

Additionally, I explored using the Lerp function to interpolate between two textures. For instance, to create a material that appears dirty, such as a surface touched by greasy hands, I added a layer representing surface imperfections. By blending this layer with the roughness texture using the Lerp function and promoting the alpha value to a parameter, I achieved adjustable blending in the material.

tutorial source: Unreal Engine Materials in 6 Levels of Complexity

Adding Characteristics to the Material

tutorial source: How to HIDE Texture REPETITION in Unreal Engine – UE4 Tutorial

Imperfection
Adding a surface imperfection layer on top of the roughness map provides a story about the material’s journey and wear.

  • Method: Use a texture imperfection file as Source B and a roughness map as Source A (the order doesn’t matter). Use the Lerp function to blend the two, promote the alpha to a parameter, and name it “Blend.” This parameter determines the degree of blending and accepts floating-point values.

Dirt and Filth
Adding a dirt layer on top of the albedo map creates the appearance of a dirty surface. The Static Switch Parameter, which acts as a Boolean, allows for toggling the dirt effect on or off.

  • Method: Use a texture imperfection file as the alpha channel and an albedo map as Source A. Add a Vector3 node for colour (e.g., a brownish tone) and promote it to a parameter. Use the Lerp function to blend these elements, promote the alpha to a parameter, and name it “Blend.” This parameter controls the degree of dirt application, taking floating-point values.

Summary

The process of creating a Master Material has deepened my understanding of material design within Unreal Engine. By customizing textures and parameters, I can achieve a higher level of realism and storytelling in my materials. For instance, adding imperfections or dirt layers provides depth and context to otherwise flat surfaces. While these techniques require a strong foundation in node-based logic and texture mapping, the results are highly rewarding, offering endless possibilities for material customization

Leave a Reply

Your email address will not be published. Required fields are marked *