Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve stratified sample strategy #530

Open
gkjohnson opened this issue Feb 11, 2024 · 3 comments
Open

Improve stratified sample strategy #530

gkjohnson opened this issue Feb 11, 2024 · 3 comments
Milestone

Comments

@gkjohnson
Copy link
Owner

gkjohnson commented Feb 11, 2024

Related to #527, #449

There should be some way to de-correlate samples a bit more since at the moment all samples across the image are sampling from the same stratum with a common x and y offset. This results in highly correlated samples that expose the sampling patterns of shapes. This results in some swirling patterns especially when any spherical sampling is done. The shuffling approach could possibly also use some improvement.

Thoughts:

  • Possibly reshuffling the strata more intelligently would help which requires understand generation step more.
  • It's possible that we won't have a good image until all stratum have been sampled
  • Possibly using a 4 color blue noise seed this can be helped
  • Use a 3d texture with X: full strata for one sample, Y: new strata per id, Z: new strata per bounce
@gkjohnson gkjohnson modified the milestones: v0.0.18, v0.0.19 Feb 11, 2024
@gkjohnson
Copy link
Owner Author

The core issue is that we only have a single blue noise value which is used to offset both a X and Y across the strata so it's correlated between both axes. Using an offset that's spread well across both X and Y (and Z if possible) would be best. Perhaps some kind of 2d blue noise point pattern. The blue noise pattern could be reshuffled into a 2d point based on intensity value across the image

@gkjohnson gkjohnson modified the milestones: v0.0.19, v0.0.18 Feb 13, 2024
@gkjohnson
Copy link
Owner Author

gkjohnson commented Feb 13, 2024

Using the blue noise texture to derive evenly space points seems to not produce a smooth result. Possibly worth making sure the points are actually evenly spaced? Or maybe using another poisson or halton sequence numbers or another approach.

Before After
image

Point generation

	this.image.data = new Float32Array( ( size ** 2 ) * 2 );
	this.format = RGFormat;

	const result = generator.generate();
	const bin = result.data;
	const maxValue = result.maxValue;

	const newData = this.image.data;
	for ( let i = 0; i < maxValue; i ++ ) {

		const index = bin.indexOf( i );
		const x = index % size;
		const y = Math.floor( index / size );
		newData[ 2 * i + 0 ] = x / size;
		newData[ 2 * i + 1 ] = y / size;

	}
``

@gkjohnson gkjohnson modified the milestones: v0.0.18, v0.0.19 Feb 13, 2024
@gkjohnson
Copy link
Owner Author

@gkjohnson gkjohnson modified the milestones: v0.0.21, v0.0.22 Feb 23, 2024
@gkjohnson gkjohnson modified the milestones: v0.0.22, v0.0.23 May 2, 2024
@gkjohnson gkjohnson modified the milestones: v0.0.23, v0.0.24 Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant