Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ void main() {
} else {
vec4 sum = vec4(0.0, 0.0, 0.0, 0.0);

float rotation = quick_hash(id.y * uint(params.face_size) + id.x); // Add some random rotation to the Hammersley sequence
for (uint sampleNum = 0u; sampleNum < params.sample_count; sampleNum++) {
vec2 xi = Hammersley(sampleNum, params.sample_count);
xi.x += rotation;

vec3 H = ImportanceSampleGGX(xi, params.roughness, N);
vec3 V = N;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,11 @@ float radicalInverse_VdC(uint bits) {
vec2 Hammersley(uint i, uint N) {
return vec2(float(i) / float(N), radicalInverse_VdC(i));
}

float quick_hash(uint x) {
const uint k = 1103515245U;
x = ((x >> 8U) ^ x) * k;
x = ((x >> 8U) ^ x) * k;
x = ((x >> 8U) ^ x) * k;
return float(x) * (1.0 / float(0xffffffffU));
}