Public Functions:
hammersley1D
hammersley2D
Engine defined, should stay an internal and not used from elsewhere
const float _hammersleySize = 1024.0;
Hammerlsley texture (_hammersleySize
x 1). This is engine provided.
//: param auto texture_hammersley
uniform sampler2D hammersley_tex;
Return the ith number from hammersley sequence.
float hammersley1D(int i)
{
float xInHammersleyTex = (float(i)+0.5) / _hammersleySize;
return texture2D(hammersley_tex, vec2(xInHammersleyTex, 0.5)).x;
}
Return the ith couple from the hammerlsey sequence. nbSample is required to get an uniform distribution. nbSample has to be less than 1024.
vec2 hammersley2D(int i, int nbSamples)
{
return vec2(
(float(i)+0.5) / float(nbSamples),
hammersley1D(i)
);
}