UE5 - Materials


  • Base Color
    • Real world materials are not darker than 20 srgb or brighter than 240 srgb
    • Rough surfaces have a higher minimun, around 50 srgb
    • Out of range values will not light correctly, so staying in range is critical
    • On a non-metallic material this controls the diffuse
      • On a metallic material this controls the specular
      • On a metallic material the diffuse is black
  • Specular
    • A multiplier for the direct and indirect specular lighting
    • Defining the reflectivity when looking straight at the surface
    • Non-metal surfaces reflects about 4% of the light
    • Specular value:
      • 0.5 represents 4% reflection
      • 1.0 represents 8% reflection (to high for most materials)
    • At glancing angles all surfaces are 100 % reflective
      • The fresnell term is built into the engine
    • Specular maps should mostly be at 0.5
    • Only use lower values to mask areas that should not be reflective like crevices
      • A crevice map multiplied with 0.5 makes a good specular map.
  • Roughness
    • Represents the roughness of the surface at a microscopic scale.
    • White is rough and black is smooth
    • Controls the focus of reflections
      • Smooth = tight, sharp reflections
      • Rough = blurry, diffuse reflections
    • No technical constraints - completely artistic choice
      • A roughness map can be used to define the “character” of the surface and show its history
  • Metallic
    • Switches the shader to metallic mode
    • When the metallic is set to 1 (a metallic material)
      • Now the base color controls the specular of the material
      • Now the specular range is up to 100%
      • Most metals are between 60-100% reflective
      • Be sure to use real-world measurements for metal “base color”
        • Metals have colored reflections
        • The values should be around 180 srgb or brighter
        • The base color controls the specular
      • The specular parameter is ignored (since it is controlled by the base color)
      • The diffuse is always black
    • Values of either 0 or 1 should be used.
      • Values in between should be avoided since that will produce a weird mix of non-metal / metal behaviour
      • A few pixles of “inbetween values” where a map transitions from 0 to 1 are ok, but generally the map should be 0 or 1
  • Ambient Occlusion
    • Only used if we use a baked gloabl illumination solution.


Math / Misc

  • Mask - [math] componentMask
    • Selects a specific subset of channels (R, G, B, and/or A)
  • Split Components - [Misc] splitComponents
    • Can split out components of a vec3. (Can not output alpha vec4)
  • Append - [Math] appendVector
    • Construct a vector with more channels than the original. You can appen to floats to create a vec2 or one float and a vec2 to cfreate a vec3.
  • AppenMany - [Misc] appendMany
    • Allows you to append up to 4 scalars in one function
  • Swizzle - [Misc] swizzle
    • Can rearrange the components of a vector


  • Dropping one resolution step reduces memory 4 times.
  • Using 4k textures is very expensive
  • Uncompressed textures need to be at a low resolution, otherwise they will require alot of memory.
  • Using a alpha channel doubles memory usage, since the alpha channel are stored at a higher quality
    • Therefore if you pack channels you should pack the channel that needs the best quality in the alpha.


  • Optimization
    • Reduce in game texture size
      • texture editor > details tab > compression > advanced
      • Set the maximum texture size to the size you want
      • Note that a value of 0 will use the original size
    • Compress without Alpha
      • If your texture has an alpha channel but you do not need it you can make the editor skip the alpha
      • This will reduce the size by half
      • texture editor > details tab > compression
      • enable Compress without alpha


Material Functions

A material function that is used to transform UVs. Based on Ben Cloward´s work
A material function that generates pseudo random vec3 noise seeded by a vec2. Based on Ben Cloward´s work
A material function that generates random UV transform, rotation & scale. Based on Ben Cloward´s work
Requires: ( 2 ) MF_UvTransform, MF_Hash2to3
A material function that generates a hex grid that can be used to tile textures without repetition. Based on Ben Cloward´s work. (Note to self, look into the Epic Matrix city demo for a material function called MF_Cellbombing
A material function that rotates the normals. Based on Ben Cloward´s work