6 const float PI = 3.1415926535;
8 vec2 hammersley(int i, int count)
10 float y = bitfieldReverse(uint(i))*2.3283064e-10;
11 return vec2(float(i)/count, y);
14 vec3 uv_to_hemisphere(float u, float v)
17 float r = sqrt(1.0-v*v);
18 return vec3(cos(phi)*r, sin(phi)*r, v);
21 vec3 ndist_ggxtr_importance_sample(vec2 uv, float roughness)
23 float rough_q = roughness*roughness;
25 float v = sqrt((1.0-uv.y)/(1.0+(rough_q-1.0)*uv.y));
26 return uv_to_hemisphere(uv.x, v);