Notes on Power Functions

Introduction

Bitmaps, be they single channel greyscale or RGB are essentially an array of values where each value is between 0 and 1.

Greyscale Roughness Map

Greyscale Head Roughness Map

In a shader, when we use a parameter such as ‘Roughness Power’, this parameter is used in an operation which takes a value b from the bitmap and raises it to the power of the parameter n i.e. b^n (here b is referred to as the base and n as the exponent. This operation is usually referred to as Exponentiation or a Power Law.

Blender uses the Math->Power ‘Converter’ type shadernode (light blue) to do this (shown below for illustration).

Converter Node: Math (Power)

Converter Node: Math (Power)

This type of operation is known as Gamma Correction where ‘gamma’ (\gamma) is the exponent, V_{\mathrm{in}} is the base (i.e. the input bitmap) and A is a constant of proportionality which gives Gamma Corrected V_{\mathrm{out}} (i.e. the output bitmap) in the expression:

V_{\mathrm{out}} = A V_{\mathrm{in}}^{\gamma}


Exponent Effects

When the base value you are raising to a power is between 0 and 1 (as is the case with a bitmap), the result can never be lower then 0 or greater than 1. Thus all the values in a bitmap can be safely tuned in a non-linear manner by only varying the exponent.

Important

The value of the exponent can have a dramatic effect on the bitmap. Consider the examples below:

When the exponent is 0.2 (y = x^{0.2} i.e. the quintic root x^{1/5}) smaller values are amplified much more than the higher values (with a roughness map, this would mean that the smoother areas are made somewhat rougher; with a RGB image, the darker areas would be significantly lightened)

When the exponent is 1 (y = x^{1} \equiv y = x) this is the neutral case where the operation makes no changes to the bitmap.

x02 x1

e02 e1

When the exponent is above 1 but still small, we can see a slight reduction in lower end values and a slight increase in higher end values e.g with y = x^{2}.

As the exponent becomes higher (e.g with y = x^{5}) we observe a very significant reduction of all but the highest end values (with a roughness map this would smooth out all but the roughest areas; with a RGB image, the lighter areas would be significantly darkened)

x2 x5

e2 e5

The value of the exponent should therefore be adjusted carefully.