summaryrefslogtreecommitdiffstats
path: root/math.cginc
blob: 17ce86fdb19ce9ed45268cbea50cdc5662ddf0cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#ifndef __MATH_INC
#define __MATH_INC

#define PI 3.14159265358979323846264
#define TAU (2 * PI)

float pow5(float x)
{
  float tmp = x * x;
  return (tmp * tmp) * x;
}

float wrapNoL(float NoL, float factor) {
		// https://www.iro.umontreal.ca/~derek/files/jgt_wrap_final.pdf
    return pow(max(1E-4, (NoL + factor) / (1 + factor)), 1 + factor);
}

#endif  // __MATH_INC