Skip to content

Instantly share code, notes, and snippets.

View skwerner's full-sized avatar

Stefan Werner skwerner

View GitHub Profile
@skwerner
skwerner / pmg02.cpp
Created February 22, 2019 20:40
Progressive Multijittered (0, 2) Sequence
#include <iostream>
#include <random>
/* This implements the pseudo-code from http://graphics.pixar.com/library/ProgressiveMultiJitteredSampling/
*/
/* replace with your desired random number generator */
static std::random_device rd;
static std::mt19937 rng(rd());
static std::uniform_real_distribution<> dis(0, 1);
@skwerner
skwerner / jitter.cpp
Created February 20, 2019 20:14
Progressive Jittered Sample Sequence
static float rnd()
{
return drand48();
}
float2 generate_sample_point(float i, float j, float xhalf, float yhalf, float n)
{
float2 pt;
pt.x = (i + 0.5f * (xhalf + rnd())) / n;
pt.y = (j + 0.5f * (yhalf + rnd())) / n;