Tutorial: Why do Multiply and Divide work differently inside Unreal Material Editor?

Tutorial / 26 February 2023

I think this is worth explaining because understanding why can help you create better materials. First we have to briefly talk about how we represent colour in digital graphics. Our phones, TVs and monitors use the RGB colour model.
RGB is an additive colour model, with each colour; red, green and blue being represented by a value between 0.0 and 1.0 in Unreal. Going from the darkest to brightest value of that colour. Those values are added together to give the final, full colour picture. Conversely this means RGB values represent 3 dimensional coordinates (XYZ -> RGB).

Now the boring maths part. Multiplying a number by a number between 0.0 (including) and 1.0 (not including) will always give you a lower overall value. Therefore a darker colour. Because what you end up with is a fraction of the first number. So 2 times 0.41 gives us 0.82 and 0.9 times 0.3 gives us 0.27. Lower value of the multiplied colour.

In Unreal Engine (and Photoshop, Substance Painter, Procreate, you name it) RGB values are ordinarily locked in 0.0 to 1.0 range and any kind of multiplication between textures or layers results in a darker overall image.

The exact opposite happens to divided numbers. So 0.5 divided by 0.2 gives us 2.5 etc.

Did you know there are infinitely many numbers between 0 and 1? Or any other set of different values for that matter.

Image: SharkD, CC BY-SA 4.0 https://creativecommons.org/licenses/by-sa/4.0, via Wikimedia Commons