1

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?

user18228
  • 11
  • 2
  • 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. – lightxbulb Apr 05 '22 at 08:46

1 Answers1

1

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.

Peter
  • 519
  • 2
  • 5
  • 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. – lightxbulb Apr 05 '22 at 12:13
  • Yes that's a good point it is not the same pattern for neighbouring pixels. The dimensions are fine, you just loop back around. – Peter Apr 05 '22 at 15:18
  • "The dimensions are fine, you just loop back around." - that's not fine. – lightxbulb Apr 05 '22 at 15:37
  • You will have to take it up with the authors then because this is what they do in the sample code: "sampleDimension = sampleDimension & 255;" ;) – Peter Apr 05 '22 at 17:48
  • 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. – lightxbulb Apr 05 '22 at 17:50
  • And, what if **all** the pixels patterns are precomputed? That is the pattern is different for each pixel, but constant in each frame (in time) – user18228 Apr 06 '22 at 05:11
  • @user18228 Then you get a showerdoor effect. One way to deal with it is to toroidally shift those in screen space at each frame. And you don't need it for all pixels, a sufficiently large tile is sufficient. – lightxbulb Apr 06 '22 at 09:23