1
$\begingroup$

This wikipedia page explains the principle of patterning in Supersampling.

However, I have a question: should the pattern be constant for every pixel?

Of course, the pattern will be constant for a "grid algorithm" but for the "random algorithm", should the randomness pattern be the same across all pixels?

I think about it because it could be an optimization, pre-computing the sub-pixel positions instead of calculating it in each pixel. However I don't know if it's an acceptable technique.

To illustrate this: Here for example a 2x2 image, with random pattern, on the left the same pattern is repeated (it is random, but the same across all pixels so can be cached). On the right the pattern is re-computed for each pixel.

enter image description here

My question is: it is visually acceptable to cache the pattern?

$\endgroup$
1
  • $\begingroup$ It's not good to reuse it - you get correlation of the error between pixels. Precomputed sequences have been used though, e.g. optimised Sobol sequences. $\endgroup$
    – lightxbulb
    Apr 5, 2022 at 8:46

1 Answer 1

1
$\begingroup$

It's common to precompute some of the sampling. The most modern approach is probably to use a blue noise pattern. Have a read through here (I belive it also has some precomputed patterns and source code you can use):

https://belcour.github.io/blog/research/publication/2019/06/17/sampling-bluenoise.html

This gives you which "subpixel" to sample from but I think you still want to apply some randomness within that subpixel.

EDIT: As lightxbulb points out, what I shared precomputes for a tile of 128x128 pixels. You don't want neightbouring pixels to be exactly the same or you will notice it when rendering.

$\endgroup$
7
  • $\begingroup$ The above is tiled over the screen. The sampling sequences are not reused within neighbouring pixels. I believe the tiles provided in the code above were $128\times 128$. Also it was quite limited in terms of dimensions. $\endgroup$
    – lightxbulb
    Apr 5, 2022 at 12:13
  • $\begingroup$ Yes that's a good point it is not the same pattern for neighbouring pixels. The dimensions are fine, you just loop back around. $\endgroup$
    – Peter
    Apr 5, 2022 at 15:18
  • $\begingroup$ "The dimensions are fine, you just loop back around." - that's not fine. $\endgroup$
    – lightxbulb
    Apr 5, 2022 at 15:37
  • $\begingroup$ You will have to take it up with the authors then because this is what they do in the sample code: "sampleDimension = sampleDimension & 255;" ;) $\endgroup$
    – Peter
    Apr 5, 2022 at 17:48
  • $\begingroup$ Sure, and what they do is wrong. I am quite familiar with the paper and code. It may produce passable results in specific scenarios, but it is wrong - you get a biased estimator with correlation between dimensions. $\endgroup$
    – lightxbulb
    Apr 5, 2022 at 17:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.